aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-08-31 18:02:20 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-08-31 18:02:20 +0000
commitf9b949fecf339a2c9bd97dd11a272c4878f85ce4 (patch)
tree332ce91a818b140448ac03acb9ecea310fd94d8a /lib/Sema/SemaExpr.cpp
parentfe72e9ceeae6cc8669cd8bb722425300190638ea (diff)
AST work to support [C++] [IRgen] for ?: with missing LHS
This is also pr7726 and wip. No change in functionality at this time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 455730c909..ca9c5dc56e 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -4521,8 +4521,10 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
// If this is the gnu "x ?: y" extension, analyze the types as though the LHS
// was the condition.
bool isLHSNull = LHSExpr == 0;
- if (isLHSNull)
- LHSExpr = CondExpr;
+ Expr *SAVEExpr = 0;
+ if (isLHSNull) {
+ LHSExpr = SAVEExpr = CondExpr;
+ }
QualType result = CheckConditionalOperands(CondExpr, LHSExpr,
RHSExpr, QuestionLoc);
@@ -4530,8 +4532,9 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
return ExprError();
return Owned(new (Context) ConditionalOperator(CondExpr, QuestionLoc,
- isLHSNull ? 0 : LHSExpr,
- ColonLoc, RHSExpr, result));
+ LHSExpr, ColonLoc,
+ RHSExpr, SAVEExpr,
+ result));
}
// CheckPointerTypesForAssignment - This is a very tricky routine (despite