[cfe-commits] r41339 - /cfe/trunk/AST/StmtPrinter.cpp

Chris Lattner sabre at nondot.org
Thu Aug 23 14:46:40 PDT 2007


Author: lattner
Date: Thu Aug 23 16:46:40 2007
New Revision: 41339

URL: http://llvm.org/viewvc/llvm-project?rev=41339&view=rev
Log:
Pretty print as:
  "case sizeof x:"
instead of:
  "case sizeofx:"


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=41339&r1=41338&r2=41339&view=diff

==============================================================================
--- cfe/trunk/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/AST/StmtPrinter.cpp Thu Aug 23 16:46:40 2007
@@ -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())





More information about the cfe-commits mailing list