warn about long long when in c89 mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41543 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaType.cpp b/Sema/SemaType.cpp
index 17ab64a..bbf8457 100644
--- a/Sema/SemaType.cpp
+++ b/Sema/SemaType.cpp
@@ -16,6 +16,7 @@
#include "clang/AST/Decl.h"
#include "clang/Parse/DeclSpec.h"
#include "clang/Lex/IdentifierTable.h"
+#include "clang/Basic/LangOptions.h"
using namespace clang;
/// ConvertDeclSpecToType - Convert the specified declspec to the appropriate
@@ -122,6 +123,11 @@
/// GetTypeForDeclarator - Convert the type for the specified declarator to Type
/// instances.
QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
+ // long long is a C99 feature.
+ if (!getLangOptions().C99 &&
+ D.getDeclSpec().getTypeSpecWidth() == DeclSpec::TSW_longlong)
+ Diag(D.getDeclSpec().getTypeSpecWidthLoc(), diag::ext_longlong);
+
QualType T = ConvertDeclSpecToType(D.getDeclSpec(), Context);
// Apply const/volatile/restrict qualifiers to T.