improve some more is*Type predicates to look through asqualtypes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62063 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index b9db41e..9c6e036 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -20,7 +20,7 @@
 
 using namespace clang;
 
-bool QualType::isConstant(ASTContext& Ctx) const {
+bool QualType::isConstant(ASTContext &Ctx) const {
   if (isConstQualified())
     return true;
 
@@ -90,20 +90,23 @@
 bool Type::isVoidType() const {
   if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
     return BT->getKind() == BuiltinType::Void;
+  if (const ASQualType *AS = dyn_cast<ASQualType>(CanonicalType))
+    return AS->getBaseType()->isVoidType();
   return false;
 }
 
 bool Type::isObjectType() const {
   if (isa<FunctionType>(CanonicalType))
     return false;
-  else if (CanonicalType->isIncompleteType())
-    return false;
-  else
-    return true;
+  if (const ASQualType *AS = dyn_cast<ASQualType>(CanonicalType))
+    return AS->getBaseType()->isObjectType();
+  return !CanonicalType->isIncompleteType();
 }
 
 bool Type::isDerivedType() const {
   switch (CanonicalType->getTypeClass()) {
+  case ASQual:
+    return cast<ASQualType>(CanonicalType)->getBaseType()->isDerivedType();
   case Pointer:
   case VariableArray:
   case ConstantArray:
@@ -112,10 +115,8 @@
   case FunctionNoProto:
   case Reference:
     return true;
-  case Tagged: {
-    const TagType *TT = cast<TagType>(CanonicalType);
-    return !TT->getDecl()->isEnum();
-  }
+  case Tagged:
+    return !cast<TagType>(CanonicalType)->getDecl()->isEnum();
   default:
     return false;
   }
@@ -140,6 +141,8 @@
 bool Type::isComplexType() const {
   if (const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
     return CT->getElementType()->isFloatingType();
+  if (const ASQualType *AS = dyn_cast<ASQualType>(CanonicalType))
+    return AS->getBaseType()->isComplexType();
   return false;
 }
 
@@ -147,6 +150,8 @@
   // Check for GCC complex integer extension.
   if (const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
     return CT->getElementType()->isIntegerType();
+  if (const ASQualType *AS = dyn_cast<ASQualType>(CanonicalType))
+    return AS->getBaseType()->isComplexIntegerType();
   return false;
 }
 
@@ -155,7 +160,9 @@
   if (const ComplexType *CTy = dyn_cast<ComplexType>(this)) {
     if (CTy->getElementType()->isIntegerType())
       return CTy;
+    return 0;
   }
+  
   // If the canonical form of this type isn't the right kind, reject it.
   const ComplexType *CTy = dyn_cast<ComplexType>(CanonicalType);
   if (!CTy || !CTy->getElementType()->isIntegerType())