mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
pointer refence of the return value got lost, bug 238253
This commit is contained in:
parent
14c57a13dd
commit
cba281ab15
2 changed files with 28 additions and 0 deletions
|
@ -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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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.IASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
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.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
||||||
|
@ -181,6 +182,9 @@ public class ImplementMethodRefactoring extends CRefactoring {
|
||||||
createdMethodDeclarator = new CPPASTFunctionDeclarator();
|
createdMethodDeclarator = new CPPASTFunctionDeclarator();
|
||||||
createdMethodDeclarator.setName(qname);
|
createdMethodDeclarator.setName(qname);
|
||||||
createdMethodDeclarator.setConst(functionDeclarator.isConst());
|
createdMethodDeclarator.setConst(functionDeclarator.isConst());
|
||||||
|
for(IASTPointerOperator pop : functionDeclarator.getPointerOperators()) {
|
||||||
|
createdMethodDeclarator.addPointerOperator(pop);
|
||||||
|
}
|
||||||
|
|
||||||
func.setDeclarator(createdMethodDeclarator);
|
func.setDeclarator(createdMethodDeclarator);
|
||||||
func.setBody(new CPPASTCompoundStatement());
|
func.setBody(new CPPASTCompoundStatement());
|
||||||
|
|
Loading…
Add table
Reference in a new issue