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
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index b33a7ca..8c16c9f 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1605,7 +1605,7 @@
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 @@
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 35577f6..5ef2524 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -1742,7 +1742,7 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
// 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 @@
// 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 0b36984..4deef68 100644
--- a/lib/Analysis/GRSimpleVals.cpp
+++ b/lib/Analysis/GRSimpleVals.cpp
@@ -381,7 +381,7 @@
// 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);