mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
Bug 319107: [c++0x] DeclSpecWriter add support for decltype and typeof
https://bugs.eclipse.org/bugs/show_bug.cgi?id=319107
This commit is contained in:
parent
e911f1d564
commit
3fe0d27e62
2 changed files with 34 additions and 8 deletions
|
@ -170,3 +170,13 @@ auto var = 42;
|
||||||
//%CPP
|
//%CPP
|
||||||
long long int i;
|
long long int i;
|
||||||
|
|
||||||
|
//!C++0x decltype
|
||||||
|
//%CPP
|
||||||
|
int i;
|
||||||
|
decltype(i) j = 3;
|
||||||
|
|
||||||
|
//!C++0x typeof
|
||||||
|
//%CPP
|
||||||
|
int i;
|
||||||
|
typeof i j = 3;
|
||||||
|
|
||||||
|
|
|
@ -125,10 +125,18 @@ public class DeclSpecWriter extends NodeWriter {
|
||||||
if (isCpp)
|
if (isCpp)
|
||||||
return Keywords.AUTO;
|
return Keywords.AUTO;
|
||||||
break;
|
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$
|
System.err.println("Unknown specifier type: " + type); //$NON-NLS-1$
|
||||||
throw new IllegalArgumentException("Unknow Specifiertype: " + type); //$NON-NLS-1$
|
throw new IllegalArgumentException("Unknown specifier type: " + type); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeCDeclSpec(ICASTDeclSpecifier cDeclSpec) {
|
private void writeCDeclSpec(ICASTDeclSpecifier cDeclSpec) {
|
||||||
|
@ -374,6 +382,14 @@ public class DeclSpecWriter extends NodeWriter {
|
||||||
private void writeCPPSimpleDeclSpec(ICPPASTSimpleDeclSpecifier simpDeclSpec) {
|
private void writeCPPSimpleDeclSpec(ICPPASTSimpleDeclSpecifier simpDeclSpec) {
|
||||||
printQualifiers(simpDeclSpec);
|
printQualifiers(simpDeclSpec);
|
||||||
scribe.print(getCPPSimpleDecSpecifier(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) {
|
private void printQualifiers(IASTSimpleDeclSpecifier simpDeclSpec) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue