diff options
author | Anders Carlsson <andersca@mac.com> | 2009-03-23 19:10:31 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-03-23 19:10:31 +0000 |
commit | eb0c532faa826e512c4513aae918125f72007748 (patch) | |
tree | a0863a7912e65967a96680d4732cb8f9850ac480 /clang/lib/Sema/SemaDecl.cpp | |
parent | 1773177a9922e59d1d6bff099f6a79741bca58fb (diff) | |
download | bcm5719-llvm-eb0c532faa826e512c4513aae918125f72007748.tar.gz bcm5719-llvm-eb0c532faa826e512c4513aae918125f72007748.zip |
More improvements to abstract type checking. Handle arrays correctly, and make sure to check parameter types before they decay.
llvm-svn: 67550
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index c964daf6fd9..d71417b9577 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1996,12 +1996,6 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, } else if (FTI.NumArgs > 0 && FTI.ArgInfo[0].Param != 0) { for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) { ParmVarDecl *PVD = (ParmVarDecl *)FTI.ArgInfo[i].Param; - - // Function parameters cannot have abstract class types. - if (RequireNonAbstractType(PVD->getLocation(), PVD->getType(), - diag::err_abstract_type_in_decl, - 1 /* parameter type */)) - InvalidDecl = true; Params.push_back(PVD); } } @@ -2611,6 +2605,13 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { // FIXME: If a source translation tool needs to see the original type, then // we need to consider storing both types (in ParmVarDecl)... // + + // Parameters can not be abstract class types. + if (RequireNonAbstractType(D.getIdentifierLoc(), parmDeclType, + diag::err_abstract_type_in_decl, + 1 /* parameter type */)) + D.setInvalidType(true); + if (parmDeclType->isArrayType()) { // int x[restrict 4] -> int *restrict parmDeclType = Context.getArrayDecayedType(parmDeclType); |