summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-11-26 18:27:54 +0000
committerTed Kremenek <kremenek@apple.com>2007-11-26 18:27:54 +0000
commitebb1c0ca7496b85e87af851ce9e84a816be9eb41 (patch)
tree392ef93c5077328d1727e056aad2451a3bcc60d2 /clang
parent138988765ccec41a90a0c2455cd40610a8d5ecd0 (diff)
downloadbcm5719-llvm-ebb1c0ca7496b85e87af851ce9e84a816be9eb41.tar.gz
bcm5719-llvm-ebb1c0ca7496b85e87af851ce9e84a816be9eb41.zip
Fixed StmtPrinter to handle GCC extension to the ternary operator "?:" where
the LHS subexpression can be NULL. Patch provided by Nuno Lopes! llvm-svn: 44328
Diffstat (limited to 'clang')
-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