summaryrefslogtreecommitdiff
path: root/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2019-09-21 04:18:54 +0000
committerRichard Trieu <rtrieu@google.com>2019-09-21 04:18:54 +0000
commit4d764c760bc19a720a89edadb05d5c13fc5908b6 (patch)
tree9918204e52f8f56c94cea3cb750a6c8c86fbc63d /lib/AST/Expr.cpp
parentdbb59f794229857ec4acc86f12f3f9172ec253f6 (diff)
downloadclang-4d764c760bc19a720a89edadb05d5c13fc5908b6.tar.gz
Fix bad APInt compare.
APInt comparison require both to have the same bitwidth. Since only the value is needed, use the compare function APInt::isSameValue instead. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r--lib/AST/Expr.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index b5fb7fafb0..c9394bba2d 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -3983,7 +3983,8 @@ bool Expr::isSameComparisonOperand(const Expr* E1, const Expr* E2) {
const auto Integer1 = dyn_cast<IntegerLiteral>(Idx1);
const auto Integer2 = dyn_cast<IntegerLiteral>(Idx2);
if (Integer1 && Integer2) {
- if (Integer1->getValue() != Integer2->getValue())
+ if (!llvm::APInt::isSameValue(Integer1->getValue(),
+ Integer2->getValue()))
return false;
} else {
if (!isSameComparisonOperand(Idx1, Idx2))