From: Steve Naroff Date: Thu, 7 Feb 2008 15:26:07 +0000 (+0000) Subject: Minor cleanup from yesterday's -fms-extension commit. Move __int* MS keywords to... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=419154d6d8e80ff2083dd039095781a0eb99444f;p=clang Minor cleanup from yesterday's -fms-extension commit. Move __int* MS keywords to predefined macros. This removes some of the MS-madness from Parser::ParseDeclarationSpecifiers(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46852 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Lex/Preprocessor.cpp b/Lex/Preprocessor.cpp index f4e737413a..2fe08c6715 100644 --- a/Lex/Preprocessor.cpp +++ b/Lex/Preprocessor.cpp @@ -430,6 +430,10 @@ static void InitializePredefinedMacros(Preprocessor &PP, DefineBuiltinMacro(Buf, "_cdecl="); DefineBuiltinMacro(Buf, "__ptr64="); DefineBuiltinMacro(Buf, "__forceinline="); + DefineBuiltinMacro(Buf, "__int8=char"); + DefineBuiltinMacro(Buf, "__int16=short"); + DefineBuiltinMacro(Buf, "__int32=int"); + DefineBuiltinMacro(Buf, "__int64=long"); } // FIXME: Should emit a #line directive here. } diff --git a/Parse/ParseDecl.cpp b/Parse/ParseDecl.cpp index 902c5230f1..2fc4d0de21 100644 --- a/Parse/ParseDecl.cpp +++ b/Parse/ParseDecl.cpp @@ -516,11 +516,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) { break; // type-specifiers - case tok::kw___int16: case tok::kw_short: isInvalid = DS.SetTypeSpecWidth(DeclSpec::TSW_short, Loc, PrevSpec); break; - case tok::kw___int64: case tok::kw_long: if (DS.getTypeSpecWidth() != DeclSpec::TSW_long) isInvalid = DS.SetTypeSpecWidth(DeclSpec::TSW_long, Loc, PrevSpec); @@ -542,11 +540,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) { case tok::kw_void: isInvalid = DS.SetTypeSpecType(DeclSpec::TST_void, Loc, PrevSpec); break; - case tok::kw___int8: case tok::kw_char: isInvalid = DS.SetTypeSpecType(DeclSpec::TST_char, Loc, PrevSpec); break; - case tok::kw___int32: case tok::kw_int: isInvalid = DS.SetTypeSpecType(DeclSpec::TST_int, Loc, PrevSpec); break; diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def index e17e0fe1de..f747da11e4 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -302,10 +302,6 @@ KEYWORD(__private_extern__ , EXTC90|EXTC99|NOTCPP) // Microsoft Extensions. KEYWORD(__w64 , EXTC90|EXTC99|NOTCPP) KEYWORD(__declspec , EXTC90|EXTC99|NOTCPP) -KEYWORD(__int8 , EXTC90|EXTC99|NOTCPP) -KEYWORD(__int16 , EXTC90|EXTC99|NOTCPP) -KEYWORD(__int32 , EXTC90|EXTC99|NOTCPP) -KEYWORD(__int64 , EXTC90|EXTC99|NOTCPP) // Alternate spelling for various tokens. There are GCC extensions in all // languages, but should not be disabled in strict conformance mode.