diff options
author | Anna Zaks <ganna@apple.com> | 2011-12-09 03:34:02 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-12-09 03:34:02 +0000 |
commit | 6af472aa3bd50463ab8a366eb424f14bcda8d494 (patch) | |
tree | 8c7527e4f18b7c5db84366efb3cb291eb7fff7ef /clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp | |
parent | 98e642db2c27d89e50ec5c2e70bffd09d5bc5d5c (diff) | |
download | bcm5719-llvm-6af472aa3bd50463ab8a366eb424f14bcda8d494.tar.gz bcm5719-llvm-6af472aa3bd50463ab8a366eb424f14bcda8d494.zip |
[analyzer] Fix inconsistency on when SValBuilder assumes that 2
types are equivalent.
+ A taint test which tests bitwise operations and which was
triggering an assertion due to presence of the integer to integer cast.
llvm-svn: 146240
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp b/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp index 89d9dc02429..a7b67fbe8a5 100644 --- a/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp +++ b/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp @@ -80,16 +80,14 @@ SVal SimpleSValBuilder::evalCastFromNonLoc(NonLoc val, QualType castTy) { if (const SymExpr *se = val.getAsSymbolicExpression()) { QualType T = Context.getCanonicalType(se->getType(Context)); - if (T == Context.getCanonicalType(castTy)) - return val; - + // If types are the same or both are integers, ignore the cast. // FIXME: Remove this hack when we support symbolic truncation/extension. // HACK: If both castTy and T are integers, ignore the cast. This is // not a permanent solution. Eventually we want to precisely handle // extension/truncation of symbolic integers. This prevents us from losing // precision when we assign 'x = y' and 'y' is symbolic and x and y are // different integer types. - if (T->isIntegerType() && castTy->isIntegerType()) + if (haveSameType(T, castTy)) return val; if (!isLocType) @@ -483,7 +481,7 @@ SVal SimpleSValBuilder::evalBinOpNN(const ProgramState *state, // Otherwise, make a SymbolVal out of the expression. return MakeSymIntVal(symIntExpr, op, rhsInt->getValue(), resultTy); - // LHS is a simple symbol. + // LHS is a simple symbol (not a symbolic expression). } else { nonloc::SymbolVal *slhs = cast<nonloc::SymbolVal>(&lhs); SymbolRef Sym = slhs->getSymbol(); |