summaryrefslogtreecommitdiffstats
path: root/clang/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2007-11-30 19:04:31 +0000
committerAnders Carlsson <andersca@mac.com>2007-11-30 19:04:31 +0000
commit801c5c74677fa615bbe5c18576f38499c8d3f82c (patch)
tree17ef3c0afa808787ceb103f2408e40f067f4e35d /clang/Sema/SemaChecking.cpp
parent907703cecddca73eaaa1c4d3c4fdf9ef8c9bd987 (diff)
downloadbcm5719-llvm-801c5c74677fa615bbe5c18576f38499c8d3f82c.tar.gz
bcm5719-llvm-801c5c74677fa615bbe5c18576f38499c8d3f82c.zip
GCC has an extension where the left hand side of the ? : operator can be omitted. Handle this in a few more places.
llvm-svn: 44462
Diffstat (limited to 'clang/Sema/SemaChecking.cpp')
-rw-r--r--clang/Sema/SemaChecking.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/clang/Sema/SemaChecking.cpp b/clang/Sema/SemaChecking.cpp
index 20f0b81b430..81a18c9645f 100644
--- a/clang/Sema/SemaChecking.cpp
+++ b/clang/Sema/SemaChecking.cpp
@@ -564,10 +564,12 @@ static DeclRefExpr* EvalAddr(Expr *E) {
case Stmt::ConditionalOperatorClass: {
ConditionalOperator *C = cast<ConditionalOperator>(E);
- if (DeclRefExpr* LHS = EvalAddr(C->getLHS()))
- return LHS;
- else
- return EvalAddr(C->getRHS());
+ // Handle the GNU extension for missing LHS.
+ if (Expr *lhsExpr = C->getLHS())
+ if (DeclRefExpr* LHS = EvalAddr(lhsExpr))
+ return LHS;
+
+ return EvalAddr(C->getRHS());
}
// For implicit casts, we need to handle conversions from arrays to
@@ -674,10 +676,12 @@ static DeclRefExpr* EvalVal(Expr *E) {
// non-NULL DeclRefExpr's. If one is non-NULL, we return it.
ConditionalOperator *C = cast<ConditionalOperator>(E);
- if (DeclRefExpr *LHS = EvalVal(C->getLHS()))
- return LHS;
- else
- return EvalVal(C->getRHS());
+ // Handle the GNU extension for missing LHS.
+ if (Expr *lhsExpr = C->getLHS())
+ if (DeclRefExpr *LHS = EvalVal(lhsExpr))
+ return LHS;
+
+ return EvalVal(C->getRHS());
}
// Accesses to members are potential references to data on the stack.
OpenPOWER on IntegriCloud