summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/AST/StmtPrinter.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/AST/StmtPrinter.cpp b/clang/AST/StmtPrinter.cpp
index c68257ec336..9822e4789e6 100644
--- a/clang/AST/StmtPrinter.cpp
+++ b/clang/AST/StmtPrinter.cpp
@@ -673,9 +673,16 @@ void StmtPrinter::VisitCompoundAssignOperator(CompoundAssignOperator *Node) {
}
void StmtPrinter::VisitConditionalOperator(ConditionalOperator *Node) {
PrintExpr(Node->getCond());
- OS << " ? ";
- PrintExpr(Node->getLHS());
- OS << " : ";
+
+ if (Node->getLHS()) {
+ OS << " ? ";
+ PrintExpr(Node->getLHS());
+ OS << " : ";
+ }
+ else { // Handle GCC extention where LHS can be NULL.
+ OS << " ?: ";
+ }
+
PrintExpr(Node->getRHS());
}
OpenPOWER on IntegriCloud