diff options
author | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-04-21 01:05:26 +0000 |
---|---|---|
committer | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-04-21 01:05:26 +0000 |
commit | 015da3534aaa687c47c520a5bc442c15b15b3d01 (patch) | |
tree | e63c0823a75733018d067ba44a6bb7b5866ee7f4 /clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | |
parent | e03dc7d7546f8e42fa1dd9688f7003905e5ff2ad (diff) | |
download | bcm5719-llvm-015da3534aaa687c47c520a5bc442c15b15b3d01.tar.gz bcm5719-llvm-015da3534aaa687c47c520a5bc442c15b15b3d01.zip |
[analyzer] Fix assert in ExprEngine::processSwitch
This diff replaces getTypeSize(CondE->getType()))
with getIntWidth(CondE->getType())) in ExprEngine::processSwitch.
These calls are not equivalent for bool, see ASTContext.cpp
Add a test case.
Test plan:
make check-clang-analysis
make check-clang
Differential revision: https://reviews.llvm.org/D32328
llvm-svn: 300936
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngine.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 9e6ec09010e..8ee34190891 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1904,8 +1904,8 @@ void ExprEngine::processSwitch(SwitchNodeBuilder& builder) { // Evaluate the LHS of the case value. llvm::APSInt V1 = Case->getLHS()->EvaluateKnownConstInt(getContext()); - assert(V1.getBitWidth() == getContext().getTypeSize(CondE->getType())); - + assert(V1.getBitWidth() == getContext().getIntWidth(CondE->getType())); + // Get the RHS of the case, if it exists. llvm::APSInt V2; if (const Expr *E = Case->getRHS()) |