summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaPseudoObject.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2013-07-20 00:40:58 +0000
committerEli Friedman <eli.friedman@gmail.com>2013-07-20 00:40:58 +0000
commit75807f239e06e94cb177eed61955790e6dc6e306 (patch)
tree1a5218c565964125bfd63cdbdfcbc53f93677110 /clang/lib/Sema/SemaPseudoObject.cpp
parent19b4986b80c92dfdf55af1320c888dbc3bde8d5a (diff)
downloadbcm5719-llvm-75807f239e06e94cb177eed61955790e6dc6e306.tar.gz
bcm5719-llvm-75807f239e06e94cb177eed61955790e6dc6e306.zip
Make IgnoreParens() look through ChooseExprs.
This is the same way GenericSelectionExpr works, and it's generally a more consistent approach. A large part of this patch is devoted to caching the value of the condition of a ChooseExpr; it's needed to avoid threading an ASTContext into IgnoreParens(). Fixes <rdar://problem/14438917>. llvm-svn: 186738
Diffstat (limited to 'clang/lib/Sema/SemaPseudoObject.cpp')
-rw-r--r--clang/lib/Sema/SemaPseudoObject.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp
index a10612a8b07..106250fe0f5 100644
--- a/clang/lib/Sema/SemaPseudoObject.cpp
+++ b/clang/lib/Sema/SemaPseudoObject.cpp
@@ -101,6 +101,25 @@ namespace {
resultIndex);
}
+ if (ChooseExpr *ce = dyn_cast<ChooseExpr>(e)) {
+ assert(!ce->isConditionDependent());
+
+ Expr *LHS = ce->getLHS(), *RHS = ce->getRHS();
+ Expr *&rebuiltExpr = ce->isConditionTrue() ? LHS : RHS;
+ rebuiltExpr = rebuild(rebuiltExpr);
+
+ return new (S.Context) ChooseExpr(ce->getBuiltinLoc(),
+ ce->getCond(),
+ LHS, RHS,
+ rebuiltExpr->getType(),
+ rebuiltExpr->getValueKind(),
+ rebuiltExpr->getObjectKind(),
+ ce->getRParenLoc(),
+ ce->isConditionTrue(),
+ rebuiltExpr->isTypeDependent(),
+ rebuiltExpr->isValueDependent());
+ }
+
llvm_unreachable("bad expression to rebuild!");
}
};
OpenPOWER on IntegriCloud