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
This commit is contained in:
parent
138988765c
commit
ebb1c0ca74
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue