aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFrancois Pichet <pichet2000@gmail.com>2011-04-28 01:59:37 +0000
committerFrancois Pichet <pichet2000@gmail.com>2011-04-28 01:59:37 +0000
commit338d7f7362d18fa9c39c6bb5282b4e20574a9309 (patch)
tree38f50a1b68742b83dae11505e6764caff7056650 /lib
parent1d59f7f8fb39fa44ddbb6e2abd321af863b1f55b (diff)
Upgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin defines to real types.
Otherwise statements like: __int64 var = __int64(0); would be expanded to: long long var = long long(0); and fail to compile. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130369 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Frontend/InitPreprocessor.cpp6
-rw-r--r--lib/Parse/ParseDecl.cpp12
-rw-r--r--lib/Parse/ParseExpr.cpp1
-rw-r--r--lib/Parse/ParseExprCXX.cpp4
-rw-r--r--lib/Parse/ParseTentative.cpp2
5 files changed, 19 insertions, 6 deletions
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index 58379d3459..abe251d67d 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -335,12 +335,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
}
if (LangOpts.Microsoft) {
- // Filter out some microsoft extensions when trying to parse in ms-compat
- // mode.
- Builder.defineMacro("__int8", "__INT8_TYPE__");
- Builder.defineMacro("__int16", "__INT16_TYPE__");
- Builder.defineMacro("__int32", "__INT32_TYPE__");
- Builder.defineMacro("__int64", "__INT64_TYPE__");
// Both __PRETTY_FUNCTION__ and __FUNCTION__ are GCC extensions, however
// VC++ appears to only like __FUNCTION__.
Builder.defineMacro("__PRETTY_FUNCTION__", "__FUNCTION__");
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index dabb7565cb..24a487c89c 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -171,6 +171,7 @@ void Parser::ParseGNUAttributes(ParsedAttributes &attrs,
case tok::kw_short:
case tok::kw_int:
case tok::kw_long:
+ case tok::kw___int64:
case tok::kw_signed:
case tok::kw_unsigned:
case tok::kw_float:
@@ -1688,6 +1689,10 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
isInvalid = DS.SetTypeSpecWidth(DeclSpec::TSW_longlong, Loc, PrevSpec,
DiagID);
break;
+ case tok::kw___int64:
+ isInvalid = DS.SetTypeSpecWidth(DeclSpec::TSW_longlong, Loc, PrevSpec,
+ DiagID);
+ break;
case tok::kw_signed:
isInvalid = DS.SetTypeSpecSign(DeclSpec::TSS_signed, Loc, PrevSpec,
DiagID);
@@ -1986,6 +1991,10 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid,
isInvalid = DS.SetTypeSpecWidth(DeclSpec::TSW_longlong, Loc, PrevSpec,
DiagID);
break;
+ case tok::kw___int64:
+ isInvalid = DS.SetTypeSpecWidth(DeclSpec::TSW_longlong, Loc, PrevSpec,
+ DiagID);
+ break;
case tok::kw_signed:
isInvalid = DS.SetTypeSpecSign(DeclSpec::TSS_signed, Loc, PrevSpec, DiagID);
break;
@@ -2704,6 +2713,7 @@ bool Parser::isKnownToBeTypeSpecifier(const Token &Tok) const {
// type-specifiers
case tok::kw_short:
case tok::kw_long:
+ case tok::kw___int64:
case tok::kw_signed:
case tok::kw_unsigned:
case tok::kw__Complex:
@@ -2772,6 +2782,7 @@ bool Parser::isTypeSpecifierQualifier() {
// type-specifiers
case tok::kw_short:
case tok::kw_long:
+ case tok::kw___int64:
case tok::kw_signed:
case tok::kw_unsigned:
case tok::kw__Complex:
@@ -2895,6 +2906,7 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
// type-specifiers
case tok::kw_short:
case tok::kw_long:
+ case tok::kw___int64:
case tok::kw_signed:
case tok::kw_unsigned:
case tok::kw__Complex:
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 8b9e5e752b..91fe1e1935 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -903,6 +903,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
case tok::kw_short:
case tok::kw_int:
case tok::kw_long:
+ case tok::kw___int64:
case tok::kw_signed:
case tok::kw_unsigned:
case tok::kw_float:
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 50752058cd..ca3242ba46 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -945,6 +945,7 @@ bool Parser::isCXXSimpleTypeSpecifier() const {
case tok::annot_typename:
case tok::kw_short:
case tok::kw_long:
+ case tok::kw___int64:
case tok::kw_signed:
case tok::kw_unsigned:
case tok::kw_void:
@@ -1036,6 +1037,9 @@ void Parser::ParseCXXSimpleTypeSpecifier(DeclSpec &DS) {
case tok::kw_long:
DS.SetTypeSpecWidth(DeclSpec::TSW_long, Loc, PrevSpec, DiagID);
break;
+ case tok::kw___int64:
+ DS.SetTypeSpecWidth(DeclSpec::TSW_longlong, Loc, PrevSpec, DiagID);
+ break;
case tok::kw_signed:
DS.SetTypeSpecSign(DeclSpec::TSS_signed, Loc, PrevSpec, DiagID);
break;
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index 618c3e2bd4..1c4e2b3ddc 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -676,6 +676,7 @@ Parser::isExpressionOrTypeSpecifierSimple(tok::TokenKind Kind) {
case tok::kw_float:
case tok::kw_int:
case tok::kw_long:
+ case tok::kw___int64:
case tok::kw_restrict:
case tok::kw_short:
case tok::kw_signed:
@@ -971,6 +972,7 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
case tok::kw_short:
case tok::kw_int:
case tok::kw_long:
+ case tok::kw___int64:
case tok::kw_signed:
case tok::kw_unsigned:
case tok::kw_float: