[cfe-commits] r44328 - /cfe/trunk/AST/StmtPrinter.cpp
Ted Kremenek
kremenek at apple.com
Mon Nov 26 10:27:57 PST 2007
Author: kremenek
Date: Mon Nov 26 12:27:54 2007
New Revision: 44328
URL: http://llvm.org/viewvc/llvm-project?rev=44328&view=rev
Log:
Fixed StmtPrinter to handle GCC extension to the ternary operator "?:" where
the LHS subexpression can be NULL. Patch provided by Nuno Lopes!
Modified:
cfe/trunk/AST/StmtPrinter.cpp
Modified: cfe/trunk/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/StmtPrinter.cpp?rev=44328&r1=44327&r2=44328&view=diff
==============================================================================
--- cfe/trunk/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/AST/StmtPrinter.cpp Mon Nov 26 12:27:54 2007
@@ -673,9 +673,16 @@
}
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());
}
More information about the cfe-commits
mailing list