summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFG.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2018-11-30 21:26:09 +0000
committerFangrui Song <maskray@google.com>2018-11-30 21:26:09 +0000
commitf5d3335d75dfe13b1263bbc305514ccfbc25417d (patch)
tree109c58b9f8af11bcec6b2b974867c9f7d07729af /clang/lib/Analysis/CFG.cpp
parentd1a4b06c208c177a4a86c4c8ec994ca4fd44870e (diff)
downloadbcm5719-llvm-f5d3335d75dfe13b1263bbc305514ccfbc25417d.tar.gz
bcm5719-llvm-f5d3335d75dfe13b1263bbc305514ccfbc25417d.zip
Revert r347417 "Re-Reinstate 347294 with a fix for the failures."
Kept the "indirect_builtin_constant_p" test case in test/SemaCXX/constant-expression-cxx1y.cpp while we are investigating why the following snippet fails: extern char extern_var; struct { int a; } a = {__builtin_constant_p(extern_var)}; llvm-svn: 348039
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r--clang/lib/Analysis/CFG.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index 96130c25be8..cfda27dd37a 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -1039,13 +1039,11 @@ private:
if (!areExprTypesCompatible(Expr1, Expr2))
return {};
- Expr::EvalResult L1Result, L2Result;
- if (!Expr1->EvaluateAsInt(L1Result, *Context) ||
- !Expr2->EvaluateAsInt(L2Result, *Context))
- return {};
+ llvm::APSInt L1, L2;
- llvm::APSInt L1 = L1Result.Val.getInt();
- llvm::APSInt L2 = L2Result.Val.getInt();
+ if (!Expr1->EvaluateAsInt(L1, *Context) ||
+ !Expr2->EvaluateAsInt(L2, *Context))
+ return {};
// Can't compare signed with unsigned or with different bit width.
if (L1.isSigned() != L2.isSigned() || L1.getBitWidth() != L2.getBitWidth())
@@ -1136,16 +1134,13 @@ private:
case BO_And: {
// If either operand is zero, we know the value
// must be false.
- Expr::EvalResult LHSResult;
- if (Bop->getLHS()->EvaluateAsInt(LHSResult, *Context)) {
- llvm::APSInt IntVal = LHSResult.Val.getInt();
+ llvm::APSInt IntVal;
+ if (Bop->getLHS()->EvaluateAsInt(IntVal, *Context)) {
if (!IntVal.getBoolValue()) {
return TryResult(false);
}
}
- Expr::EvalResult RHSResult;
- if (Bop->getRHS()->EvaluateAsInt(RHSResult, *Context)) {
- llvm::APSInt IntVal = RHSResult.Val.getInt();
+ if (Bop->getRHS()->EvaluateAsInt(IntVal, *Context)) {
if (!IntVal.getBoolValue()) {
return TryResult(false);
}
OpenPOWER on IntegriCloud