Introduce Type::isStructureOrClassType(), which does the obvious
thing. Audit all uses of Type::isStructure(), changing those calls to
isStructureOrClassType() as needed (which is alsmost
everywhere). Fixes the remaining failure in Boost.Utility/Swap.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102386 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Checker/BasicStore.cpp b/lib/Checker/BasicStore.cpp
index 7c53991..34470af 100644
--- a/lib/Checker/BasicStore.cpp
+++ b/lib/Checker/BasicStore.cpp
@@ -401,7 +401,7 @@
   const VarDecl *VD = VR->getDecl();
 
   // BasicStore does not model arrays and structs.
-  if (VD->getType()->isArrayType() || VD->getType()->isStructureType())
+  if (VD->getType()->isArrayType() || VD->getType()->isStructureOrClassType())
     return store;
 
   if (VD->hasGlobalStorage()) {
diff --git a/lib/Checker/CallAndMessageChecker.cpp b/lib/Checker/CallAndMessageChecker.cpp
index 9d0dc33..c619d75 100644
--- a/lib/Checker/CallAndMessageChecker.cpp
+++ b/lib/Checker/CallAndMessageChecker.cpp
@@ -290,7 +290,7 @@
   ASTContext &Ctx = C.getASTContext();
   CanQualType CanRetTy = Ctx.getCanonicalType(RetTy);
 
-  if (CanRetTy->isStructureType()) {
+  if (CanRetTy->isStructureOrClassType()) {
     // FIXME: At some point we shouldn't rely on isConsumedExpr(), but instead
     // have the "use of undefined value" be smarter about where the
     // undefined value came from.
diff --git a/lib/Checker/CastToStructChecker.cpp b/lib/Checker/CastToStructChecker.cpp
index 2c16f89..eeaed97 100644
--- a/lib/Checker/CastToStructChecker.cpp
+++ b/lib/Checker/CastToStructChecker.cpp
@@ -51,7 +51,7 @@
   QualType OrigPointeeTy = OrigPTy->getPointeeType();
   QualType ToPointeeTy = ToPTy->getPointeeType();
 
-  if (!ToPointeeTy->isStructureType())
+  if (!ToPointeeTy->isStructureOrClassType())
     return;
 
   // We allow cast from void*.
diff --git a/lib/Checker/GRExprEngine.cpp b/lib/Checker/GRExprEngine.cpp
index 376f9fc..c11a16f 100644
--- a/lib/Checker/GRExprEngine.cpp
+++ b/lib/Checker/GRExprEngine.cpp
@@ -2504,9 +2504,7 @@
   QualType T = getContext().getCanonicalType(E->getType());
   unsigned NumInitElements = E->getNumInits();
 
-  if (T->isArrayType() || T->isStructureType() ||
-      T->isUnionType() || T->isVectorType()) {
-
+  if (T->isArrayType() || T->isRecordType() || T->isVectorType()) {
     llvm::ImmutableList<SVal> StartVals = getBasicVals().getEmptySValList();
 
     // Handle base case where the initializer has no elements.
diff --git a/lib/Checker/RegionStore.cpp b/lib/Checker/RegionStore.cpp
index 73158f2..1e15d43 100644
--- a/lib/Checker/RegionStore.cpp
+++ b/lib/Checker/RegionStore.cpp
@@ -1037,7 +1037,7 @@
   }
 #endif
 
-  if (RTy->isStructureType() || RTy->isClassType())
+  if (RTy->isStructureOrClassType())
     return RetrieveStruct(store, R);
 
   // FIXME: Handle unions.
@@ -1345,7 +1345,7 @@
 
 SVal RegionStoreManager::RetrieveStruct(Store store, const TypedRegion* R) {
   QualType T = R->getValueType(getContext());
-  assert(T->isStructureType() || T->isClassType());
+  assert(T->isStructureOrClassType());
   return ValMgr.makeLazyCompoundVal(store, R);
 }
 
@@ -1375,7 +1375,7 @@
 
   // Check if the region is a struct region.
   if (const TypedRegion* TR = dyn_cast<TypedRegion>(R))
-    if (TR->getValueType(getContext())->isStructureType())
+    if (TR->getValueType(getContext())->isStructureOrClassType())
       return BindStruct(store, TR, V);
 
   // Special case: the current region represents a cast and it and the super
@@ -1429,7 +1429,7 @@
 
   if (T->isArrayType())
     return BindArray(store, VR, InitVal);
-  if (T->isStructureType())
+  if (T->isStructureOrClassType())
     return BindStruct(store, VR, InitVal);
 
   return Bind(store, ValMgr.makeLoc(VR), InitVal);
@@ -1454,7 +1454,7 @@
     V = ValMgr.makeNull();
   else if (T->isIntegerType())
     V = ValMgr.makeZeroVal(T);
-  else if (T->isStructureType() || T->isArrayType()) {
+  else if (T->isStructureOrClassType() || T->isArrayType()) {
     // Set the default value to a zero constant when it is a structure
     // or array.  The type doesn't really matter.
     V = ValMgr.makeZeroVal(ValMgr.getContext().IntTy);
@@ -1530,7 +1530,7 @@
     SVal Idx = ValMgr.makeArrayIndex(i);
     const ElementRegion *ER = MRMgr.getElementRegion(ElementTy, Idx, R, getContext());
 
-    if (ElementTy->isStructureType())
+    if (ElementTy->isStructureOrClassType())
       store = BindStruct(store, ER, *VI);
     else
       store = Bind(store, ValMgr.makeLoc(ER), *VI);
@@ -1551,7 +1551,7 @@
     return store;
 
   QualType T = R->getValueType(getContext());
-  assert(T->isStructureType());
+  assert(T->isStructureOrClassType());
 
   const RecordType* RT = T->getAs<RecordType>();
   RecordDecl* RD = RT->getDecl();
@@ -1583,7 +1583,7 @@
 
     if (FTy->isArrayType())
       store = BindArray(store, FR, *VI);
-    else if (FTy->isStructureType())
+    else if (FTy->isStructureOrClassType())
       store = BindStruct(store, FR, *VI);
     else
       store = Bind(store, ValMgr.makeLoc(FR), *VI);