[cfe-commits] r49273 - in /cfe/trunk/lib: Parse/ParseDecl.cpp Sema/SemaType.cpp

Chris Lattner sabre at nondot.org
Sun Apr 6 00:49:58 PDT 2008


Author: lattner
Date: Sun Apr  6 02:49:57 2008
New Revision: 49273

URL: http://llvm.org/viewvc/llvm-project?rev=49273&view=rev
Log:
move a semantic check out of the parser into sema.

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

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=49273&r1=49272&r2=49273&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Sun Apr  6 02:49:57 2008
@@ -1304,19 +1304,6 @@
     if (Tok.is(tok::kw___attribute))
       ParmDecl.AddAttributes(ParseAttributes());
     
-    // Verify C99 6.7.5.3p2: The only SCS allowed is 'register'.
-    if (DS.getStorageClassSpec() != DeclSpec::SCS_unspecified &&
-        DS.getStorageClassSpec() != DeclSpec::SCS_register) {
-      Diag(DS.getStorageClassSpecLoc(),
-           diag::err_invalid_storage_class_in_func_decl);
-      DS.ClearStorageClassSpecs();
-    }
-    if (DS.isThreadSpecified()) {
-      Diag(DS.getThreadSpecLoc(),
-           diag::err_invalid_storage_class_in_func_decl);
-      DS.ClearStorageClassSpecs();
-    }
-    
     // Remember this parsed parameter in ParamInfo.
     IdentifierInfo *ParmII = ParmDecl.getIdentifier();
     

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Sun Apr  6 02:49:57 2008
@@ -504,10 +504,29 @@
   return T.getAsOpaquePtr();
 }
 
-// Called from Parser::ParseParenDeclarator().
+/// ActOnParamDeclaratorType - Called from Parser::ParseFunctionDeclarator()
+/// when analyzing function prototypes.
+///
+/// Note: parameters have identifiers, but we don't care about them here, we
+/// just want the type converted.
+///
 Sema::TypeResult Sema::ActOnParamDeclaratorType(Scope *S, Declarator &D) {
-  // Note: parameters have identifiers, but we don't care about them here, we
-  // just want the type converted.
+  DeclSpec &DS = D.getDeclSpec();
+  
+  // Verify C99 6.7.5.3p2: The only SCS allowed is 'register'.
+  if (DS.getStorageClassSpec() != DeclSpec::SCS_unspecified &&
+      DS.getStorageClassSpec() != DeclSpec::SCS_register) {
+    Diag(DS.getStorageClassSpecLoc(),
+         diag::err_invalid_storage_class_in_func_decl);
+    DS.ClearStorageClassSpecs();
+  }
+  if (DS.isThreadSpecified()) {
+    Diag(DS.getThreadSpecLoc(),
+         diag::err_invalid_storage_class_in_func_decl);
+    DS.ClearStorageClassSpecs();
+  }
+  
+  
   QualType T = GetTypeForDeclarator(D, S);
   
   assert(!T.isNull() && "GetTypeForDeclarator() returned null type");





More information about the cfe-commits mailing list