diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2018-08-07 02:27:38 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2018-08-07 02:27:38 +0000 |
commit | afdce6684eff7f25ba9a40dcf41570bc3c20e2bd (patch) | |
tree | 4084239e48afcbbcdafe88a3f262ddb89d9efbbc /clang/include | |
parent | 5a5b86742208bd6fbc909b0313d80eb402caaad3 (diff) | |
download | bcm5719-llvm-afdce6684eff7f25ba9a40dcf41570bc3c20e2bd.tar.gz bcm5719-llvm-afdce6684eff7f25ba9a40dcf41570bc3c20e2bd.zip |
[analyzer] pr37204: Take signedness into account in getTruthValue().
It now actually produces a signed APSInt when the QualType passed into it is
signed, which is what any caller would expect.
Fixes a couple of crashes.
Differential Revision: https://reviews.llvm.org/D50363
llvm-svn: 339088
Diffstat (limited to 'clang/include')
-rw-r--r-- | clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h index b72b158194c..1c5d4eb2de3 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h @@ -211,7 +211,8 @@ public: } const llvm::APSInt &getTruthValue(bool b, QualType T) { - return getValue(b ? 1 : 0, Ctx.getIntWidth(T), true); + return getValue(b ? 1 : 0, Ctx.getIntWidth(T), + T->isUnsignedIntegerOrEnumerationType()); } const llvm::APSInt &getTruthValue(bool b) { |