summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Taddiken2013-10-02 13:21:21 (EDT)
committer Sergey Prigogin2013-10-02 13:22:19 (EDT)
commite51a76571e0b029a80ce3a40768c878fa802fb02 (patch)
treef54145928f694fd31fb52786a94cc2a890b442a7
parenta0a2059fdd2296fe9fd9c269e129d24fe9b9bf48 (diff)
downloadorg.eclipse.cdt-e51a76571e0b029a80ce3a40768c878fa802fb02.zip
org.eclipse.cdt-e51a76571e0b029a80ce3a40768c878fa802fb02.tar.gz
org.eclipse.cdt-e51a76571e0b029a80ce3a40768c878fa802fb02.tar.bz2
Bug 414501: modification of base specifiers now works using anrefs/changes/78/15178/3
ASTRewrite Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=414501 Change-Id: Ide93fa5f988f1121fddfed9af036cbac7518fe29 Signed-off-by: Simon Taddiken <simon.taddiken@gmail.com> Reviewed-on: https://git.eclipse.org/r/15178 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java19
3 files changed, 31 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java
index 9a2a669..320140a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java
@@ -30,6 +30,7 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTLiteralNode;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@@ -140,6 +141,12 @@ public class ASTWriterVisitor extends ASTVisitor {
}
@Override
+ public int visit(ICPPASTBaseSpecifier baseSpecifier) {
+ declSpecWriter.writeBaseSpecifiers(baseSpecifier);
+ return ASTVisitor.PROCESS_SKIP;
+ }
+
+ @Override
public int visit(IASTName name) {
if (spaceNeededBeforeName && name.getSimpleID().length != 0) {
scribe.printSpace();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
index f461004..da523e5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
@@ -282,7 +282,7 @@ public class DeclSpecWriter extends NodeWriter {
return compDeclSpec.getMembers();
}
- private void writeBaseSpecifiers(ICPPASTBaseSpecifier specifier) {
+ public void writeBaseSpecifiers(ICPPASTBaseSpecifier specifier) {
switch (specifier.getVisibility()) {
case ICPPASTBaseSpecifier.v_public:
scribe.printStringSpace(Keywords.PUBLIC);
@@ -294,6 +294,10 @@ public class DeclSpecWriter extends NodeWriter {
scribe.printStringSpace(Keywords.PRIVATE);
break;
}
+
+ if (specifier.isVirtual()) {
+ scribe.printStringSpace(Keywords.VIRTUAL);
+ }
specifier.getName().accept(visitor);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
index bdd4d9e..50cf438 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
@@ -40,6 +40,7 @@ import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
@@ -175,8 +176,26 @@ public class ChangeGenerator extends ASTVisitor {
}
return super.visit(declarator);
}
+
+ @Override
+ public int visit(ICPPASTBaseSpecifier baseSpecifier) {
+ handleInserts(baseSpecifier);
+ if (requiresRewrite(baseSpecifier)) {
+ handleReplace(baseSpecifier);
+ return ASTVisitor.PROCESS_SKIP;
+ }
+ return super.visit(baseSpecifier);
+ }
@Override
+ public int leave(ICPPASTBaseSpecifier baseSpecifier) {
+ if (!requiresRewrite(baseSpecifier)) {
+ handleAppends(baseSpecifier);
+ }
+ return super.leave(baseSpecifier);
+ }
+
+ @Override
public int visit(IASTArrayModifier arrayModifier) {
handleInserts(arrayModifier);
if (requiresRewrite(arrayModifier)) {