Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java7
3 files changed, 13 insertions, 10 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java
index ee4c9d86257..4718e1e11ac 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java
@@ -105,13 +105,13 @@ public class DeclarationGeneratorImpl extends DeclarationGenerator {
returnedDeclSpec = declSpec;
} else if (type instanceof ICPPTemplateInstance) {
returnedDeclSpec = getDeclSpecForTemplate((ICPPTemplateInstance) type);
-
} else if (type instanceof IBinding) { /* ITypedef, ICompositeType... */
// BTW - we need to distinguish (and fail explicitly) on literal composites like:
// struct { } aSingleInstance;
returnedDeclSpec = getDeclSpecForBinding((IBinding) type);
}
+ // TODO(sprigogin): Be honest and return null instead of void.
// Fallback...
if (returnedDeclSpec == null) {
IASTSimpleDeclSpecifier specifier = factory.newSimpleDeclSpecifier();
@@ -129,7 +129,7 @@ public class DeclarationGeneratorImpl extends DeclarationGenerator {
// Addition of pointer operators has to be in reverse order, so it's deferred until the end
Map<IASTDeclarator, LinkedList<IASTPointerOperator>> pointerOperatorMap = new HashMap<IASTDeclarator, LinkedList<IASTPointerOperator>>();
- IASTName newName = (name != null) ? factory.newName(name) : factory.newName();
+ IASTName newName = name != null ? factory.newName(name) : factory.newName();
// If the type is an array of something, create a declaration of a pointer to something instead
// (to allow assignment, etc)
@@ -311,8 +311,8 @@ public class DeclarationGeneratorImpl extends DeclarationGenerator {
ICPPNodeFactory cppFactory = (ICPPNodeFactory) factory;
ICPPASTTemplateId tempId = cppFactory.newTemplateId(templateName.copy());
for (ICPPTemplateArgument arg : type.getTemplateArguments()) {
- IASTDeclSpecifier argDeclSpec = createDeclSpecFromType(arg.isTypeValue() ? arg
- .getTypeValue() : arg.getTypeOfNonTypeValue());
+ IASTDeclSpecifier argDeclSpec = createDeclSpecFromType(arg.isTypeValue() ?
+ arg.getTypeValue() : arg.getTypeOfNonTypeValue());
IASTTypeId typeId = cppFactory.newTypeId(argDeclSpec, null);
tempId.addTemplateArgument(typeId);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java
index 83dd18fdf43..f9992e2c681 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java
@@ -39,7 +39,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
* @author Emanuel Graf
*/
public class ASTWriter {
- private ASTModificationStore modificationStore = new ASTModificationStore();
+ private final ASTModificationStore modificationStore = new ASTModificationStore();
/**
* Creates a <code>ASTWriter</code>.
@@ -63,7 +63,7 @@ public class ASTWriter {
* Generates the source code representing this node including comments.
*
* @param rootNode Node to write.
- * @param commentMap Node Comment Map <code>ASTCommenter</code>
+ * @param commentMap comments for the translation unit
* @return A <code>String</code> representing the source code for the node.
* @throws ProblemRuntimeException if the node or one of it's children is
* an <code>IASTProblemNode</code>.
@@ -79,10 +79,6 @@ public class ASTWriter {
return writer.toString();
}
- public void setModificationStore(ASTModificationStore modificationStore) {
- this.modificationStore = modificationStore;
- }
-
/**
* Returns <code>true</code> if the node should be separated by a blank line from the node
* before it.
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 cd1e5c363d9..ef08a0ba868 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
@@ -80,6 +80,13 @@ public class ASTWriterVisitor extends ASTVisitor {
shouldVisitTypeIds = true;
}
+ /**
+ * Creates a writer with an empty comment map.
+ */
+ public ASTWriterVisitor() {
+ this(new NodeCommentMap());
+ }
+
public ASTWriterVisitor(NodeCommentMap commentMap) {
super();
init(commentMap);

Back to the top