[cfe-commits] r85063 - /cfe/trunk/lib/Sema/SemaType.cpp

Chris Lattner sabre at nondot.org
Sun Oct 25 11:25:04 PDT 2009


Author: lattner
Date: Sun Oct 25 13:25:04 2009
New Revision: 85063

URL: http://llvm.org/viewvc/llvm-project?rev=85063&view=rev
Log:
move the extwarn about using long long out of the entry of
GetTypeForDeclarator and into the code that handles long long 
already.

Modified:
    cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=85063&r1=85062&r2=85063&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Sun Oct 25 13:25:04 2009
@@ -184,14 +184,28 @@
       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::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;





More information about the cfe-commits mailing list