]> granicus.if.org Git - clang/commitdiff
move a semantic check out of the parser into sema.
authorChris Lattner <sabre@nondot.org>
Sun, 6 Apr 2008 07:49:57 +0000 (07:49 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 6 Apr 2008 07:49:57 +0000 (07:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49273 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
lib/Sema/SemaType.cpp

index 3ea0d9f4c17b7cdc2ed00af9a1fe2dda5e4a1568..0eb5c1f2576a4c41ad2cf9c6c4de087546447e15 100644 (file)
@@ -1304,19 +1304,6 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D) {
     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();
     
index d46e99756774936f17db06cdb0b57eb2f9ff76f9..725da223345950b1af3509001ad08a965fffe3bb 100644 (file)
@@ -504,10 +504,29 @@ Sema::TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) {
   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");