Pretty print as:
"case sizeof x:"
instead of:
"case sizeofx:"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41339 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/StmtPrinter.cpp b/AST/StmtPrinter.cpp
index 2c77f13..ec37f9e 100644
--- a/AST/StmtPrinter.cpp
+++ b/AST/StmtPrinter.cpp
@@ -404,8 +404,21 @@
OS << ")";
}
void StmtPrinter::VisitUnaryOperator(UnaryOperator *Node) {
- if (!Node->isPostfix())
+ if (!Node->isPostfix()) {
OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
+
+ // Print a space if this is an "identifier operator" like sizeof or __real.
+ switch (Node->getOpcode()) {
+ default: break;
+ case UnaryOperator::SizeOf:
+ case UnaryOperator::AlignOf:
+ case UnaryOperator::Real:
+ case UnaryOperator::Imag:
+ case UnaryOperator::Extension:
+ OS << ' ';
+ break;
+ }
+ }
PrintExpr(Node->getSubExpr());
if (Node->isPostfix())