1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Support for __int128 type introduced in GCC 4.7.

This commit is contained in:
Sergey Prigogin 2012-11-20 16:57:23 -08:00
parent da5b169b44
commit 25c47d3cbb
24 changed files with 196 additions and 79 deletions

View file

@ -153,18 +153,20 @@ public class AST2BaseTest extends BaseTestCase {
AbstractGNUSourceCodeParser parser = null;
if (lang == ParserLanguage.CPP) {
ICPPParserExtensionConfiguration config = null;
if (useGNUExtensions)
if (useGNUExtensions) {
config = new GPPParserExtensionConfiguration();
else
} else {
config = new ANSICPPParserExtensionConfiguration();
}
parser = new GNUCPPSourceParser(scanner, ParserMode.COMPLETE_PARSE, NULL_LOG,config, null);
} else {
ICParserExtensionConfiguration config = null;
if (useGNUExtensions)
if (useGNUExtensions) {
config = new GCCParserExtensionConfiguration();
else
} else {
config = new ANSICParserExtensionConfiguration();
}
parser = new GNUCSourceParser(scanner, ParserMode.COMPLETE_PARSE, NULL_LOG, config, null);
}
@ -204,10 +206,11 @@ public class AST2BaseTest extends BaseTestCase {
public static IScanner createScanner(FileContent codeReader, ParserLanguage lang, ParserMode mode,
IScannerInfo scannerInfo) {
IScannerExtensionConfiguration configuration = null;
if (lang == ParserLanguage.C)
configuration= GCCScannerExtensionConfiguration.getInstance();
else
if (lang == ParserLanguage.C) {
configuration= GCCScannerExtensionConfiguration.getInstance(scannerInfo);
} else {
configuration= GPPScannerExtensionConfiguration.getInstance(scannerInfo);
}
IScanner scanner;
scanner= new CPreprocessor(codeReader, scannerInfo, lang, NULL_LOG, configuration,
IncludeFileContentProvider.getSavedFilesProvider());

View file

@ -417,4 +417,12 @@ public class GCCCompleteParseExtensionsTest extends AST2BaseTest {
public void testTypeTraits_Bug342683() throws Exception {
parseGPP(getAboveComment());
}
// __int128 a;
// unsigned __int128 b;
public void test__int128() throws Exception {
String code= getAboveComment();
parseGCC(code);
parseGPP(code);
}
}

View file

@ -35,14 +35,14 @@ import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
/**
* @author Emanuel Graf IFS
*/
public class AddDeclarationBug extends ChangeGeneratorTest {
public class AddDeclarationBugTest extends ChangeGeneratorTest {
AddDeclarationBug() {
AddDeclarationBugTest() {
super("AddDeclarationBug");
}
public static Test suite() {
return new AddDeclarationBug();
return new AddDeclarationBugTest();
}
@Override
@ -65,16 +65,16 @@ public class AddDeclarationBug extends ChangeGeneratorTest {
ICPPASTCompositeTypeSpecifier classNode = (ICPPASTCompositeTypeSpecifier) declSpec;
IASTSimpleDeclaration newDecl = new CPPASTSimpleDeclaration();
IASTSimpleDeclSpecifier returnTyp = new CPPASTSimpleDeclSpecifier();
returnTyp.setType(IASTSimpleDeclSpecifier.t_int);
newDecl.setDeclSpecifier(returnTyp);
IASTSimpleDeclSpecifier returnType = new CPPASTSimpleDeclSpecifier();
returnType.setType(IASTSimpleDeclSpecifier.t_int);
newDecl.setDeclSpecifier(returnType);
IASTStandardFunctionDeclarator declarator = new CPPASTFunctionDeclarator(
new CPPASTName("exp".toCharArray())); //$NON-NLS-1$
IASTSimpleDeclSpecifier paramTyp = new CPPASTSimpleDeclSpecifier();
paramTyp.setType(IASTSimpleDeclSpecifier.t_int);
IASTSimpleDeclSpecifier paramType = new CPPASTSimpleDeclSpecifier();
paramType.setType(IASTSimpleDeclSpecifier.t_int);
IASTDeclarator decl = new CPPASTDeclarator(new CPPASTName("i".toCharArray())); //$NON-NLS-1$
ICPPASTParameterDeclaration param = new CPPASTParameterDeclaration(paramTyp, decl);
ICPPASTParameterDeclaration param = new CPPASTParameterDeclaration(paramType, decl);
declarator.addParameterDeclaration(param);
newDecl.addDeclarator(declarator);

View file

@ -29,7 +29,7 @@ public class InsertBeforeTestSuite {
suite.addTest(ArrayModifierTest.suite());
suite.addTest(ExpressionTest.suite());
suite.addTest(ArraySizeExpressionTest.suite());
suite.addTest(AddDeclarationBug.suite());
suite.addTest(AddDeclarationBugTest.suite());
suite.addTest(MultilineWhitespaceHandlingTest.suite());
suite.addTest(SelfInsertionTest.suite());

View file

@ -73,6 +73,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeIdExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
import org.eclipse.cdt.core.parser.GCCKeywords;
import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
@ -625,6 +626,9 @@ public class ASTStringUtil {
case IASTSimpleDeclSpecifier.t_int:
buffer.append(Keywords.INT).append(' ');
break;
case IASTSimpleDeclSpecifier.t_int128:
buffer.append(GCCKeywords.cp__int128).append(' ');
break;
case IASTSimpleDeclSpecifier.t_float:
buffer.append(Keywords.FLOAT).append(' ');
break;

View file

@ -33,6 +33,7 @@ import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTTypeIdExpression;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTArrayRangeDesignator;
import org.eclipse.cdt.core.parser.GCCKeywords;
import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.internal.core.dom.parser.ASTProblem;
import org.eclipse.cdt.internal.core.model.ASTStringUtil;
@ -775,6 +776,14 @@ public class ASTSignatureUtil {
result.append(Keywords.INT);
needSpace = true;
break;
case IASTSimpleDeclSpecifier.t_int128:
if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(GCCKeywords.__INT128);
needSpace = true;
break;
case IASTSimpleDeclSpecifier.t_void:
if (needSpace) {
result.append(SPACE);

View file

@ -100,6 +100,11 @@ public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier {
*/
public static final int t_char32_t = 12;
/**
* <code>__int128 i;</code>
* @since 5.5
*/
public static final int t_int128 = 13;
/**
* @since 5.1

View file

@ -22,40 +22,25 @@ public interface IBasicType extends IType {
* @since 5.2
*/
enum Kind {
eUnspecified, eVoid, eChar, eWChar, eInt, eFloat, eDouble, eBoolean, eChar16, eChar32,
/** @since 5.4 */ eNullPtr
eUnspecified, eVoid, eChar, eWChar, eInt, /** @since 5.5 */ eInt128, eFloat, eDouble,
eBoolean, eChar16, eChar32, /** @since 5.4 */ eNullPtr
}
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_LONG = 1;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_SHORT = 1 << 1;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_SIGNED = 1 << 2;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_UNSIGNED = 1 << 3;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_COMPLEX = 1 << 4;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_IMAGINARY = 1 << 5;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_LONG_LONG = 1 << 6;
/**
* This returns the kind of basic type you are looking at. The type is
* then refined by qualifiers for signed/unsigned and short/long/long long.

View file

@ -25,6 +25,7 @@ import org.eclipse.cdt.core.dom.parser.c.ICParserExtensionConfiguration;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.parser.IParserLogService;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
@ -70,6 +71,11 @@ public class GCCLanguage extends AbstractCLikeLanguage {
return C_GNU_SCANNER_EXTENSION;
}
@Override
protected IScannerExtensionConfiguration getScannerExtensionConfiguration(IScannerInfo info) {
return GCCScannerExtensionConfiguration.getInstance(info);
}
/**
* Returns the extension configuration used for creating the parser.
* @since 5.1

View file

@ -27,7 +27,14 @@ import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
*/
public abstract class GNUScannerExtensionConfiguration extends AbstractScannerExtensionConfiguration {
private static GNUScannerExtensionConfiguration sInstance;
/**
* @noreference This method is not intended to be referenced by clients.
*/
protected static int version(int major, int minor) {
return (major << 16) + minor;
}
@SuppressWarnings("nls")
public GNUScannerExtensionConfiguration() {
addMacro("__complex__", "_Complex");

View file

@ -1,42 +1,77 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Ed Swartz (Nokia)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
* Contributors:
* IBM - Initial API and implementation
* Ed Swartz (Nokia)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.core.dom.parser.c;
import java.util.Map;
import org.eclipse.cdt.core.dom.parser.GNUScannerExtensionConfiguration;
import org.eclipse.cdt.core.parser.GCCKeywords;
import org.eclipse.cdt.core.parser.IGCCToken;
import org.eclipse.cdt.core.parser.IScannerInfo;
/**
* Configures the preprocessor for parsing c-sources as accepted by gcc.
*/
public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfiguration {
private static final int VERSION_4_7 = version(4, 7);
private static GCCScannerExtensionConfiguration CONFIG= new GCCScannerExtensionConfiguration();
private static GCCScannerExtensionConfiguration CONFIG_4_7= new GCCScannerExtensionConfiguration(VERSION_4_7);
private static GCCScannerExtensionConfiguration sInstance= new GCCScannerExtensionConfiguration();
/**
* @since 5.1
*/
public static GCCScannerExtensionConfiguration getInstance() {
return sInstance;
return CONFIG;
}
/**
* @since 5.5
*/
public static GCCScannerExtensionConfiguration getInstance(IScannerInfo info) {
if (info != null) {
try {
final Map<String, String> definedSymbols = info.getDefinedSymbols();
int major= Integer.valueOf(definedSymbols.get("__GNUC__")); //$NON-NLS-1$
int minor= Integer.valueOf(definedSymbols.get("__GNUC_MINOR__")); //$NON-NLS-1$
int version= version(major, minor);
if (version >= VERSION_4_7) {
return CONFIG_4_7;
}
} catch (Exception e) {
// Fall-back to the default configuration.
}
}
return CONFIG;
}
@SuppressWarnings("nls")
public GCCScannerExtensionConfiguration() {
this(0);
}
/**
* @since 5.5
*/
@SuppressWarnings("nls")
public GCCScannerExtensionConfiguration(int version) {
addMacro("__null", "(void *)0");
addMacro("__builtin_offsetof(T,m)", "((size_t) &((T *)0)->m)");
if (version >= VERSION_4_7) {
addKeyword(GCCKeywords.cp__int128, IGCCToken.t__int128);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
*/
@Override
public boolean supportMinAndMaxOperators() {
return false;

View file

@ -29,13 +29,11 @@ import org.eclipse.cdt.core.parser.Keywords;
public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfiguration {
private static final int VERSION_4_3 = version(4, 3);
private static final int VERSION_4_6 = version(4, 6);
private static final int VERSION_4_7 = version(4, 7);
private static GPPScannerExtensionConfiguration CONFIG= new GPPScannerExtensionConfiguration();
private static GPPScannerExtensionConfiguration CONFIG_4_3= new GPPScannerExtensionConfiguration(VERSION_4_3);
private static GPPScannerExtensionConfiguration CONFIG_4_6= new GPPScannerExtensionConfiguration(VERSION_4_6);
private static int version(int major, int minor) {
return (major << 16) + minor;
}
private static GPPScannerExtensionConfiguration CONFIG_4_7= new GPPScannerExtensionConfiguration(VERSION_4_7);
public static GPPScannerExtensionConfiguration getInstance() {
return CONFIG;
@ -51,6 +49,9 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
int major= Integer.valueOf(definedSymbols.get("__GNUC__")); //$NON-NLS-1$
int minor= Integer.valueOf(definedSymbols.get("__GNUC_MINOR__")); //$NON-NLS-1$
int version= version(major, minor);
if (version >= VERSION_4_7) {
return CONFIG_4_7;
}
if (version >= VERSION_4_6) {
return CONFIG_4_6;
}
@ -102,11 +103,11 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
addKeyword(GCCKeywords.cp__is_standard_layout, IGCCToken.tTT_is_standard_layout);
addKeyword(GCCKeywords.cp__is_trivial, IGCCToken.tTT_is_trivial);
}
if (version >= VERSION_4_7) {
addKeyword(GCCKeywords.cp__int128, IGCCToken.t__int128);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
*/
@Override
public boolean supportMinAndMaxOperators() {
return true;

View file

@ -23,6 +23,8 @@ public class GCCKeywords {
public static final String __ALIGNOF__ = "__alignof__";
public static final String __ATTRIBUTE__ = "__attribute__";
public static final String __DECLSPEC = "__declspec";
/** @since 5.5 */
public static final String __INT128 = "__int128";
public static final char[]
cpTYPEOF = TYPEOF.toCharArray(),
@ -46,9 +48,7 @@ public class GCCKeywords {
cp__TYPEOF= "__typeof".toCharArray(),
cp__TYPEOF__= "__typeof__".toCharArray();
/**
* @since 5.3
*/
/** @since 5.3 */
public static final char[]
cp__has_nothrow_assign= "__has_nothrow_assign".toCharArray(),
cp__has_nothrow_copy= "__has_nothrow_copy".toCharArray(),
@ -67,10 +67,9 @@ public class GCCKeywords {
cp__is_polymorphic= "__is_polymorphic".toCharArray(),
cp__is_union= "__is_union".toCharArray();
/**
* @since 5.5
*/
/** @since 5.5 */
public static final char[]
cp__int128= __INT128.toCharArray(),
cp__is_literal_type= "__is_literal_type".toCharArray(),
cp__is_standard_layout= "__is_standard_layout".toCharArray(),
cp__is_trivial= "__is_trivial".toCharArray();

View file

@ -44,4 +44,6 @@ public interface IGCCToken extends IToken {
/** @since 5.5 */ int tTT_is_literal_type= FIRST_RESERVED_IGCCToken + 22;
/** @since 5.5 */ int tTT_is_standard_layout= FIRST_RESERVED_IGCCToken + 23;
/** @since 5.5 */ int tTT_is_trivial= FIRST_RESERVED_IGCCToken + 24;
/** @since 5.5 */ int t__int128 = FIRST_RESERVED_IGCCToken + 25;
}

View file

@ -2591,6 +2591,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
case IToken.t_short:
case IToken.t_int:
case IToken.t_long:
case IGCCToken.t__int128:
case IToken.t_float:
case IToken.t_double:
case IToken.t__Bool:

View file

@ -58,10 +58,12 @@ public class SizeofCalculator {
public final SizeAndAlignment size_2;
public final SizeAndAlignment size_4;
public final SizeAndAlignment size_8;
public final SizeAndAlignment size_16;
public final SizeAndAlignment sizeof_pointer;
public final SizeAndAlignment sizeof_int;
public final SizeAndAlignment sizeof_long;
public final SizeAndAlignment sizeof_long_long;
public final SizeAndAlignment sizeof_int128;
public final SizeAndAlignment sizeof_short;
public final SizeAndAlignment sizeof_bool;
public final SizeAndAlignment sizeof_wchar_t;
@ -118,10 +120,12 @@ public class SizeofCalculator {
size_2 = new SizeAndAlignment(2, Math.min(2, maxAlignment));
size_4 = new SizeAndAlignment(4, Math.min(4, maxAlignment));
size_8 = new SizeAndAlignment(8, Math.min(8, maxAlignment));
size_16 = new SizeAndAlignment(16, Math.min(16, maxAlignment));
sizeof_pointer = getSize(sizeofMacros, "__SIZEOF_POINTER__", maxAlignment); //$NON-NLS-1$
sizeof_int = getSize(sizeofMacros, "__SIZEOF_INT__", maxAlignment); //$NON-NLS-1$
sizeof_long = getSize(sizeofMacros, "__SIZEOF_LONG__", maxAlignment); //$NON-NLS-1$
sizeof_long_long = getSize(sizeofMacros, "__SIZEOF_LONG_LONG__", maxAlignment); //$NON-NLS-1$
sizeof_int128 = getSize(sizeofMacros, "__SIZEOF_INT128__", maxAlignment); //$NON-NLS-1$
sizeof_short = getSize(sizeofMacros, "__SIZEOF_SHORT__", maxAlignment); //$NON-NLS-1$
sizeof_bool = getSize(sizeofMacros, "__SIZEOF_BOOL__", maxAlignment); //$NON-NLS-1$
sizeof_wchar_t = getSize(sizeofMacros, "__SIZEOF_WCHAR_T__", maxAlignment); //$NON-NLS-1$
@ -137,10 +141,12 @@ public class SizeofCalculator {
size_2 = new SizeAndAlignment(2, 2);
size_4 = new SizeAndAlignment(4, 4);
size_8 = new SizeAndAlignment(8, 8);
size_16 = new SizeAndAlignment(16, 16);
sizeof_pointer = null;
sizeof_int = null;
sizeof_long = null;
sizeof_long_long = null;
sizeof_int128 = size_16;
sizeof_short = null;
sizeof_bool = null;
sizeof_wchar_t = null;
@ -201,9 +207,10 @@ public class SizeofCalculator {
case eInt:
return type.isShort() ? sizeof_short : type.isLong() ? sizeof_long :
type.isLongLong() ? sizeof_long_long : sizeof_int;
case eFloat: {
case eInt128:
return sizeof_int128;
case eFloat:
return type.isComplex() ? sizeof_complex_float : sizeof_float;
}
case eDouble:
return type.isComplex() ?
(type.isLong() ? sizeof_long_double : sizeof_double) :
@ -215,7 +222,7 @@ public class SizeofCalculator {
case eChar32:
return size_4;
case eNullPtr:
return sizeAndAlignmentOfPointer();
return sizeof_pointer;
default:
return null;
}

View file

@ -98,7 +98,7 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
}
private int getType(Kind kind) {
switch(kind) {
switch (kind) {
case eBoolean:
return t_bool;
case eChar:
@ -112,6 +112,8 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
return t_float;
case eInt:
return t_int;
case eInt128:
return t_int128;
case eUnspecified:
return t_unspecified;
case eVoid:

View file

@ -71,6 +71,8 @@ public class CBasicType implements ICBasicType, ISerializableType {
return Kind.eFloat;
case IASTSimpleDeclSpecifier.t_int:
return Kind.eInt;
case IASTSimpleDeclSpecifier.t_int128:
return Kind.eInt128;
case IASTSimpleDeclSpecifier.t_void:
return Kind.eVoid;
default:

View file

@ -1002,6 +1002,13 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
encounteredRawType= true;
endOffset= consume().getEndOffset();
break;
case IGCCToken.t__int128:
if (encounteredTypename)
break declSpecifiers;
simpleType = IASTSimpleDeclSpecifier.t_int128;
encounteredRawType= true;
endOffset= consume().getEndOffset();
break;
case IToken.t_long:
if (encounteredTypename)
break declSpecifiers;

View file

@ -92,6 +92,8 @@ public class CPPASTSimpleDeclSpecifier extends CPPASTBaseDeclSpecifier
return t_float;
case eInt:
return t_int;
case eInt128:
return t_int128;
case eUnspecified:
return t_unspecified;
case eVoid:

View file

@ -102,6 +102,8 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
return Kind.eFloat;
case IASTSimpleDeclSpecifier.t_int:
return Kind.eInt;
case IASTSimpleDeclSpecifier.t_int128:
return Kind.eInt128;
case IASTSimpleDeclSpecifier.t_void:
return Kind.eVoid;
default:

View file

@ -2830,6 +2830,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
encounteredRawType= true;
endOffset= consume().getEndOffset();
break;
case IGCCToken.t__int128:
if (encounteredTypename)
break declSpecifiers;
simpleType = IASTSimpleDeclSpecifier.t_int128;
encounteredRawType= true;
endOffset= consume().getEndOffset();
break;
case IToken.t_float:
if (encounteredTypename)
break declSpecifiers;

View file

@ -202,8 +202,9 @@ public class TemplateArgumentDeduction {
IType type2= arg.getTypeOfNonTypeValue();
// Template-argument deduced from an array bound may be of any integral
// type.
if (type2 instanceof TypeOfValueDeducedFromArraySize && isIntegerType(type1)) {
arg = new CPPTemplateNonTypeArgument(arg.getNonTypeValue(), type1);
if (type2 instanceof TypeOfValueDeducedFromArraySize && isIntegralType(type1)) {
IValue value = isBooleanType(type1) ? Value.create(true) : arg.getNonTypeValue();
arg = new CPPTemplateNonTypeArgument(value, type1);
deduct.fDeducedArgs.put(tpar, arg);
} else if (!type1.isSameType(type2)) {
return false;
@ -218,9 +219,28 @@ public class TemplateArgumentDeduction {
return false;
}
private static boolean isIntegerType(IType type) {
// 3.9.1 - 7
private static boolean isIntegralType(IType type) {
type = SemanticUtil.getNestedType(type, SemanticUtil.TDEF);
return type instanceof IBasicType && ((IBasicType) type).getKind() == IBasicType.Kind.eInt;
if (!(type instanceof IBasicType))
return false;
switch (((IBasicType) type).getKind()) {
case eInt:
case eInt128:
case eBoolean:
case eChar:
case eChar16:
case eChar32:
case eWChar:
return true;
default:
return false;
}
}
private static boolean isBooleanType(IType type) {
type = SemanticUtil.getNestedType(type, SemanticUtil.TDEF);
return type instanceof IBasicType && ((IBasicType) type).getKind() == IBasicType.Kind.eBoolean;
}
private static boolean deduceFromFunctionArg(IType par, IType arg, ValueCategory valueCat,

View file

@ -34,6 +34,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.parser.GCCKeywords;
import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@ -79,6 +80,8 @@ public class DeclSpecWriter extends NodeWriter {
return Keywords.CHAR;
case IASTSimpleDeclSpecifier.t_int:
return Keywords.INT;
case IASTSimpleDeclSpecifier.t_int128:
return GCCKeywords.__INT128;
case IASTSimpleDeclSpecifier.t_float:
return Keywords.FLOAT;