summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-06-25 01:45:26 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-06-25 01:45:26 +0000
commit7939ba08ab42922a00b7f1b7e4761c7f9cc51f0c (patch)
treedc56e20bcaa28f707ad3f87372eeefab7a8cd5a0 /clang/lib/StaticAnalyzer/Core
parent079924b0b7fe5ee62ec9b9e4346544d147c781eb (diff)
downloadbcm5719-llvm-7939ba08ab42922a00b7f1b7e4761c7f9cc51f0c.tar.gz
bcm5719-llvm-7939ba08ab42922a00b7f1b7e4761c7f9cc51f0c.zip
[cxx2a] P1236R1: the validity of a left shift does not depend on the
value of the LHS operand. llvm-svn: 364265
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core')
-rw-r--r--clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp b/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
index 9ae30b605a0..7cd48bf4437 100644
--- a/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
@@ -231,9 +231,6 @@ BasicValueFactory::evalAPSInt(BinaryOperator::Opcode Op,
// FIXME: This logic should probably go higher up, where we can
// test these conditions symbolically.
- if (V1.isSigned() && V1.isNegative())
- return nullptr;
-
if (V2.isSigned() && V2.isNegative())
return nullptr;
@@ -242,8 +239,13 @@ BasicValueFactory::evalAPSInt(BinaryOperator::Opcode Op,
if (Amt >= V1.getBitWidth())
return nullptr;
- if (V1.isSigned() && Amt > V1.countLeadingZeros())
+ if (!Ctx.getLangOpts().CPlusPlus2a) {
+ if (V1.isSigned() && V1.isNegative())
+ return nullptr;
+
+ if (V1.isSigned() && Amt > V1.countLeadingZeros())
return nullptr;
+ }
return &getValue( V1.operator<<( (unsigned) Amt ));
}
OpenPOWER on IntegriCloud