]> granicus.if.org Git - clang/commitdiff
Pretty print as:
authorChris Lattner <sabre@nondot.org>
Thu, 23 Aug 2007 21:46:40 +0000 (21:46 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 23 Aug 2007 21:46:40 +0000 (21:46 +0000)
  "case sizeof x:"
instead of:
  "case sizeofx:"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41339 91177308-0d34-0410-b5e6-96231b3b80d8

AST/StmtPrinter.cpp

index 2c77f131d8528c22a2a0fb2530121bacc49c15c0..ec37f9e81c5227d0515dd80030526caf6261fc20 100644 (file)
@@ -404,8 +404,21 @@ void StmtPrinter::VisitParenExpr(ParenExpr *Node) {
   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())