1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 408470 - Define some more common C++ types in AST2TestBase

Change-Id: I794439a2d68f7b744afdef80b1f92a09996f95d2
This commit is contained in:
Nathan Ridge 2017-02-26 17:50:52 -05:00
parent 08ea44c0af
commit 4e760d8690
2 changed files with 26 additions and 2 deletions

View file

@ -98,6 +98,7 @@ import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPQualifierType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPReferenceType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.model.ASTStringUtil;
@ -137,8 +138,30 @@ public class AST2TestBase extends BaseTestCase {
protected static class CommonCPPTypes {
public static IType int_ = CPPBasicType.INT;
public static IType pointerToInt = new CPPPointerType(int_);
public static IType constInt = new CPPQualifierType(int_, true, false);
public static IType void_ = CPPBasicType.VOID;
public static IType constInt = constOf(int_);
public static IType pointerToInt = pointerTo(int_);
public static IType pointerToConstInt = pointerTo(constInt);
public static IType referenceToInt = referenceTo(int_);
public static IType referenceToConstInt = referenceTo(constInt);
public static IType rvalueReferenceToInt = rvalueReferenceTo(int_);
public static IType rvalueReferenceToConstInt = rvalueReferenceTo(constInt);
private static IType pointerTo(IType type) {
return new CPPPointerType(type);
}
private static IType constOf(IType type) {
return new CPPQualifierType(type, true, false);
}
private static IType referenceTo(IType type) {
return new CPPReferenceType(type, false);
}
private static IType rvalueReferenceTo(IType type) {
return new CPPReferenceType(type, true);
}
}
private static final ScannerInfo GNU_SCANNER_INFO = new ScannerInfo(getGnuMap());

View file

@ -45,6 +45,7 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
public static final CPPBasicType UNSIGNED_LONG_LONG = new CPPBasicType(Kind.eInt, IBasicType.IS_LONG_LONG | IBasicType.IS_UNSIGNED);
public static final CPPBasicType UNSIGNED_INT128 = new CPPBasicType(Kind.eInt128, IBasicType.IS_UNSIGNED);
public static final CPPBasicType CHAR = new CPPBasicType(Kind.eChar, 0);
public static final CPPBasicType VOID = new CPPBasicType(Kind.eVoid, 0);
private static final int FROM_STRING_LITERAL = 1 << 31;