diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-02 06:59:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-02 06:59:01 +0000 |
commit | d805bec0fbb98aa10abbb41bfdcb2e2fab1bac96 (patch) | |
tree | bb0286daad067b2609b59978cadd86bcabe315f2 /lib/Sema/SemaType.cpp | |
parent | 96b77fc05ed4a052a9e614f72b0e83572408ce48 (diff) |
Various parts of the standard require something to be an "incomplete or
object type". Add a predicate that checks exactly this, as it is equivalent
to checking ot see if the type is *not* a function type, which is faster
to check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49082 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index a1cabcff64..76bb63b1ad 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -167,8 +167,7 @@ QualType Sema::ConvertDeclSpecToType(DeclSpec &DS) { // If we have a pointer or reference, the pointee must have an object or // incomplete type. - if (!EltTy.isNull() && !EltTy->isObjectType() && - !EltTy->isIncompleteType()) { + if (!EltTy.isNull() && !EltTy->isIncompleteOrObjectType()) { Diag(DS.getRestrictSpecLoc(), diag::err_typecheck_invalid_restrict_invalid_pointee, EltTy.getAsString(), DS.getSourceRange()); @@ -229,7 +228,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) { // Enforce C99 6.7.3p2: "Types other than pointer types derived from // object or incomplete types shall not be restrict-qualified." if ((DeclType.Ptr.TypeQuals & QualType::Restrict) && - !T->isObjectType() && !T->isIncompleteType()) { + !T->isIncompleteOrObjectType()) { Diag(DeclType.Loc, diag::err_typecheck_invalid_restrict_invalid_pointee, T.getAsString()); @@ -256,7 +255,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) { // Enforce C99 6.7.3p2: "Types other than pointer types derived from // object or incomplete types shall not be restrict-qualified." if (DeclType.Ref.HasRestrict && - !T->isObjectType() && !T->isIncompleteType()) { + !T->isIncompleteOrObjectType()) { Diag(DeclType.Loc, diag::err_typecheck_invalid_restrict_invalid_pointee, T.getAsString()); |