Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanuel Graf2010-07-07 08:27:48 -0400
committerEmanuel Graf2010-07-07 08:27:48 -0400
commit3fe0d27e626e34998ca5039a9b8718f06e710b99 (patch)
tree830412fca61b2c6f51d36d6725ec96155957aebd /core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter
parente911f1d5643ab4e6260b3411be26d135a4f8096a (diff)
downloadorg.eclipse.cdt-3fe0d27e626e34998ca5039a9b8718f06e710b99.tar.gz
org.eclipse.cdt-3fe0d27e626e34998ca5039a9b8718f06e710b99.tar.xz
org.eclipse.cdt-3fe0d27e626e34998ca5039a9b8718f06e710b99.zip
Bug 319107: [c++0x] DeclSpecWriter add support for decltype and typeof
https://bugs.eclipse.org/bugs/show_bug.cgi?id=319107
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java32
1 files changed, 24 insertions, 8 deletions
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 ae153898e6..1b0666f195 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
@@ -125,10 +125,18 @@ public class DeclSpecWriter extends NodeWriter {
if (isCpp)
return Keywords.AUTO;
break;
+ case IASTSimpleDeclSpecifier.t_typeof:
+ if (isCpp)
+ return Keywords.TYPEOF;
+ break;
+ case IASTSimpleDeclSpecifier.t_decltype:
+ if (isCpp)
+ return Keywords.DECLTYPE;
+ break;
}
- System.err.println("Unknow Specifiertype: " + type); //$NON-NLS-1$
- throw new IllegalArgumentException("Unknow Specifiertype: " + type); //$NON-NLS-1$
+ System.err.println("Unknown specifier type: " + type); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unknown specifier type: " + type); //$NON-NLS-1$
}
private void writeCDeclSpec(ICASTDeclSpecifier cDeclSpec) {
@@ -280,15 +288,15 @@ public class DeclSpecWriter extends NodeWriter {
}
if(hasFreestandingComments(compDeclSpec)) {
- writeFreeStandingComments(compDeclSpec);
- }
- scribe.decrementIndentationLevel();
- scribe.print('}');
+ writeFreeStandingComments(compDeclSpec);
+ }
+ scribe.decrementIndentationLevel();
+ scribe.print('}');
if(hasTrailingComments(compDeclSpec)) {
- writeTrailingComments(compDeclSpec);
- }
+ writeTrailingComments(compDeclSpec);
}
+ }
protected IASTDeclaration[] getMembers(IASTCompositeTypeSpecifier compDeclSpec) {
return compDeclSpec.getMembers();
@@ -374,6 +382,14 @@ public class DeclSpecWriter extends NodeWriter {
private void writeCPPSimpleDeclSpec(ICPPASTSimpleDeclSpecifier simpDeclSpec) {
printQualifiers(simpDeclSpec);
scribe.print(getCPPSimpleDecSpecifier(simpDeclSpec));
+ if (simpDeclSpec.getType() == IASTSimpleDeclSpecifier.t_typeof) {
+ scribe.printSpace();
+ visitNodeIfNotNull(simpDeclSpec.getDeclTypeExpression());
+ } else if (simpDeclSpec.getType() == IASTSimpleDeclSpecifier.t_decltype) {
+ scribe.print('(');
+ visitNodeIfNotNull(simpDeclSpec.getDeclTypeExpression());
+ scribe.print(')');
+ }
}
private void printQualifiers(IASTSimpleDeclSpecifier simpDeclSpec) {

Back to the top