diff options
author | Richard Trieu <rtrieu@google.com> | 2019-09-21 04:18:54 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2019-09-21 04:18:54 +0000 |
commit | 77297f0761d2009e25d5d709cdcb041229f3493c (patch) | |
tree | 435a48d505ce19f835b284e6792156b2f5388d81 /clang/lib/AST/Expr.cpp | |
parent | 4c05de8c1d157f4b5e0091a52dbbcce7242ee485 (diff) | |
download | bcm5719-llvm-77297f0761d2009e25d5d709cdcb041229f3493c.tar.gz bcm5719-llvm-77297f0761d2009e25d5d709cdcb041229f3493c.zip |
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.
llvm-svn: 372454
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index b5fb7fafb00..c9394bba2dd 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/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)) |