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
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index a1cabcf..76bb63b 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -167,8 +167,7 @@
// 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 @@
// 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 @@
// 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());