diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-11-13 06:10:40 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-11-13 06:10:40 +0000 |
commit | 062e2f9a0ecccfdb6c8be8d797b66abca8dfbfbc (patch) | |
tree | dbcc8a8bd662dfe7bf8fbb2ffecbd626663c3a4b | |
parent | a6afa768aa7bd3102a2807aa720917e4a1771e4e (diff) |
GRExprEngine/CFRefCount/GRSimpleVals: We don't do any special handling (yet) of vector types. Add explicit checks that when we process integers that they really are scalars.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59225 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 4 | ||||
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 30 | ||||
-rw-r--r-- | lib/Analysis/GRSimpleVals.cpp | 2 | ||||
-rw-r--r-- | test/Analysis/misc-ps.m | 11 |
4 files changed, 32 insertions, 15 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index b33a7ca5ab..8c16c9fd6b 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -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); diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index 35577f6232..5ef2524964 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -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); diff --git a/lib/Analysis/GRSimpleVals.cpp b/lib/Analysis/GRSimpleVals.cpp index 0b36984c1a..4deef68a6a 100644 --- a/lib/Analysis/GRSimpleVals.cpp +++ b/lib/Analysis/GRSimpleVals.cpp @@ -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); diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m index 14adf5937e..8fb825218d 100644 --- a/test/Analysis/misc-ps.m +++ b/test/Analysis/misc-ps.m @@ -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 }; +} + + |