aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-10-25 18:25:04 +0000
committerChris Lattner <sabre@nondot.org>2009-10-25 18:25:04 +0000
commit311157fa6be96e2769bf317390dc9fb85087d5fa (patch)
tree7b2dd1472251bfddbaad87698228c9c5bca17d09 /lib/Sema/SemaType.cpp
parent5db2bb1cb0c040dcbca1b5000f091d6d225b4bfe (diff)
move the extwarn about using long long out of the entry of
GetTypeForDeclarator and into the code that handles long long already. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85063 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 8c1730d47a..71c352396d 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -184,14 +184,28 @@ static QualType ConvertDeclSpecToType(Declarator &TheDeclarator, unsigned Skip,
case DeclSpec::TSW_unspecified: Result = Context.IntTy; break;
case DeclSpec::TSW_short: Result = Context.ShortTy; break;
case DeclSpec::TSW_long: Result = Context.LongTy; break;
- case DeclSpec::TSW_longlong: Result = Context.LongLongTy; break;
+ case DeclSpec::TSW_longlong:
+ Result = Context.LongLongTy;
+
+ // long long is a C99 feature.
+ if (!TheSema.getLangOptions().C99 &&
+ !TheSema.getLangOptions().CPlusPlus0x)
+ TheSema.Diag(DS.getTypeSpecWidthLoc(), diag::ext_longlong);
+ break;
}
} else {
switch (DS.getTypeSpecWidth()) {
case DeclSpec::TSW_unspecified: Result = Context.UnsignedIntTy; break;
case DeclSpec::TSW_short: Result = Context.UnsignedShortTy; break;
case DeclSpec::TSW_long: Result = Context.UnsignedLongTy; break;
- case DeclSpec::TSW_longlong: Result =Context.UnsignedLongLongTy; break;
+ case DeclSpec::TSW_longlong:
+ Result = Context.UnsignedLongLongTy;
+
+ // long long is a C99 feature.
+ if (!TheSema.getLangOptions().C99 &&
+ !TheSema.getLangOptions().CPlusPlus0x)
+ TheSema.Diag(DS.getTypeSpecWidthLoc(), diag::ext_longlong);
+ break;
}
}
break;
@@ -847,11 +861,6 @@ QualType Sema::GetTypeFromParser(TypeTy *Ty, DeclaratorInfo **DInfo) {
QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
DeclaratorInfo **DInfo, unsigned Skip,
TagDecl **OwnedDecl) {
- // long long is a C99 feature.
- if (!getLangOptions().C99 && !getLangOptions().CPlusPlus0x &&
- D.getDeclSpec().getTypeSpecWidth() == DeclSpec::TSW_longlong)
- Diag(D.getDeclSpec().getTypeSpecWidthLoc(), diag::ext_longlong);
-
// Determine the type of the declarator. Not all forms of declarator
// have a type.
QualType T;