1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

pointer refence of the return value got lost, bug 238253

This commit is contained in:
Emanuel Graf 2008-06-25 09:36:31 +00:00
parent 14c57a13dd
commit cba281ab15
2 changed files with 28 additions and 0 deletions

View file

@ -688,3 +688,27 @@ void Class::test()
//! Bug 238253 Pointer refence of the return value lost
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
class TestClass {
public:
//$int* get(char* val);$//
};
//@A.cpp
#include "A.h"
//=
#include "A.h"
int *TestClass::get(char *val)
{
}

View file

@ -26,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
@ -181,6 +182,9 @@ public class ImplementMethodRefactoring extends CRefactoring {
createdMethodDeclarator = new CPPASTFunctionDeclarator();
createdMethodDeclarator.setName(qname);
createdMethodDeclarator.setConst(functionDeclarator.isConst());
for(IASTPointerOperator pop : functionDeclarator.getPointerOperators()) {
createdMethodDeclarator.addPointerOperator(pop);
}
func.setDeclarator(createdMethodDeclarator);
func.setBody(new CPPASTCompoundStatement());