]> granicus.if.org Git - clang/commitdiff
GRExprEngine/CFRefCount/GRSimpleVals: We don't do any special handling (yet) of vecto...
authorTed Kremenek <kremenek@apple.com>
Thu, 13 Nov 2008 06:10:40 +0000 (06:10 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 13 Nov 2008 06:10:40 +0000 (06:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59225 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFRefCount.cpp
lib/Analysis/GRExprEngine.cpp
lib/Analysis/GRSimpleVals.cpp
test/Analysis/misc-ps.m

index b33a7ca5ab9b9e59ea9668659b06f6aeba22f739..8c16c9fd6b13b978673c6c65e48d45253b01d30b 100644 (file)
@@ -1605,7 +1605,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst,
           QualType T = R->getType(Ctx);
           
           // FIXME: handle structs.
-          if (T->isIntegerType() || Loc::IsLocType(T)) {
+          if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())) {
             SymbolID NewSym =
               Eng.getSymbolManager().getConjuredSymbol(*I, T, Count);
             
@@ -1669,7 +1669,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst,
       
       QualType T = Ex->getType();
       
-      if (T->isIntegerType() || Loc::IsLocType(T)) {
+      if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())) {
         unsigned Count = Builder.getCurrentBlockCount();
         SymbolID Sym = Eng.getSymbolManager().getConjuredSymbol(Ex, Count);
         
index 35577f62320622a4761a5b0480fd41267a930df4..5ef2524964bf6322b5cd7e76f6062c96e31ee2b6 100644 (file)
@@ -1742,7 +1742,7 @@ void GRExprEngine::VisitDeclStmt(DeclStmt* DS, NodeTy* Pred, NodeSet& Dst) {
           SymbolID Sym = SymMgr.getConjuredSymbol(InitEx, Count);        
           InitVal = loc::SymbolVal(Sym);
         }
-        else if (T->isIntegerType()) {
+        else if (T->isIntegerType() && T->isScalarType()) {
           SymbolID Sym = SymMgr.getConjuredSymbol(InitEx, Count);        
           InitVal = nonloc::SymbolVal(Sym);                    
         }
@@ -1835,6 +1835,13 @@ void GRExprEngine::VisitInitListExpr(InitListExpr* E, NodeTy* Pred,
     return;
   }
 
+  if (T->isUnionType() || T->isVectorType()) {
+    // FIXME: to be implemented.
+    // Note: That vectors can return true for T->isIntegerType()
+    MakeNode(Dst, E, Pred, state);
+    return;
+  }
+  
   if (Loc::IsLocType(T) || T->isIntegerType()) {
     assert (E->getNumInits() == 1);
     NodeSet Tmp;
@@ -1847,11 +1854,6 @@ void GRExprEngine::VisitInitListExpr(InitListExpr* E, NodeTy* Pred,
     return;
   }
 
-  if (T->isUnionType() || T->isVectorType()) {
-    // FIXME: to be implemented.
-    MakeNode(Dst, E, Pred, state);
-    return;
-  }
 
   printf("InitListExpr type = %s\n", T.getAsString().c_str());
   assert(0 && "unprocessed InitListExpr type");
@@ -2338,11 +2340,12 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
           // FIXME: Handle structs.
           QualType T = RHS->getType();
           
-          if (RightV.isUnknown() && (T->isIntegerType() || Loc::IsLocType(T))) {
+          if (RightV.isUnknown() && (Loc::IsLocType(T) || 
+                                  (T->isScalarType() && T->isIntegerType()))) {
             unsigned Count = Builder->getCurrentBlockCount();
             SymbolID Sym = SymMgr.getConjuredSymbol(B->getRHS(), Count);
             
-            RightV = Loc::IsLocType(B->getRHS()->getType()
+            RightV = Loc::IsLocType(T
                    ? cast<SVal>(loc::SymbolVal(Sym)) 
                    : cast<SVal>(nonloc::SymbolVal(Sym));            
           }
@@ -2358,7 +2361,9 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
         case BinaryOperator::Rem:
           
           // Special checking for integer denominators.          
-          if (RHS->getType()->isIntegerType()) {
+          if (RHS->getType()->isIntegerType() && 
+              RHS->getType()->isScalarType()) {
+            
             St = CheckDivideZero(B, St, *I2, RightV);
             if (!St) continue;
           }
@@ -2429,7 +2434,8 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
 
         // Check for divide-by-zero.
         if ((Op == BinaryOperator::Div || Op == BinaryOperator::Rem)
-            && RHS->getType()->isIntegerType()) {
+            && RHS->getType()->isIntegerType()
+            && RHS->getType()->isScalarType()) {
           
           // CheckDivideZero returns a new state where the denominator
           // is assumed to be non-zero.
@@ -2489,8 +2495,8 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
 
         // EXPERIMENTAL: "Conjured" symbols.
         // FIXME: Handle structs.
-        if (Result.isUnknown() &&
-            (CTy->isIntegerType() || Loc::IsLocType(CTy))) {
+        if (Result.isUnknown() && (Loc::IsLocType(CTy) ||
+                                 (CTy->isScalarType() && CTy->isIntegerType()))) {
           
           unsigned Count = Builder->getCurrentBlockCount();
           SymbolID Sym = SymMgr.getConjuredSymbol(B->getRHS(), Count);
index 0b36984c1ac2319dc788b72fae8ec2e2b9ece6b3..4deef68a6a0b6614c3093b17453ff78b86738093 100644 (file)
@@ -381,7 +381,7 @@ void GRSimpleVals::EvalCall(ExplodedNodeSet<GRState>& Dst,
   // FIXME: We eventually should handle structs and other compound types
   // that are returned by value.
   QualType T = CE->getType();  
-  if (T->isIntegerType() || Loc::IsLocType(T)) {    
+  if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())) {    
     unsigned Count = Builder.getCurrentBlockCount();
     SymbolID Sym = Eng.getSymbolManager().getConjuredSymbol(CE, Count);
         
index 14adf5937edb5744a82a5faec74999de48e58c10..8fb825218dd9871e182d5a55d3b50ed171345ae8 100644 (file)
@@ -61,6 +61,17 @@ void checkaccess_union() {
 
 typedef float __m128 __attribute__((__vector_size__(16), __may_alias__));
 __m128 return128() {
+  // This compound literal has a Vector type.  We currently just
+  // return UnknownVal.
   return __extension__(__m128) { 0.0f, 0.0f, 0.0f, 0.0f };
 }
 
+typedef long long __v2di __attribute__ ((__vector_size__ (16)));
+typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
+__m128i vec128i(long long __q1, long long __q0) {
+  // This compound literal returns true for both isVectorType() and 
+  // isIntegerType().
+  return __extension__ (__m128i)(__v2di){ __q0, __q1 };
+}
+
+