aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Parse/ParseDecl.cpp13
-rw-r--r--lib/Sema/SemaType.cpp25
2 files changed, 22 insertions, 16 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 3ea0d9f4c1..0eb5c1f257 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -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();
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index d46e997567..725da22334 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -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");