[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp

Nicholas Hildenbrandt hldnbrnd at cs.uiuc.edu
Mon Sep 23 16:03:01 PDT 2002


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.52 -> 1.53

---
Log message:

Parenthesis are now added to casts of type array.


---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.52 llvm/lib/CWriter/Writer.cpp:1.53
--- llvm/lib/CWriter/Writer.cpp:1.52	Fri Sep 20 18:26:33 2002
+++ llvm/lib/CWriter/Writer.cpp	Mon Sep 23 16:02:50 2002
@@ -244,7 +244,8 @@
     // Do not need parens around "* NameSoFar" if NameSoFar consists only
     // of zero or more '*' chars *and* this is not an unnamed pointer type
     // such as the result type in a cast statement.  Otherwise, enclose in ( ).
-    if (ptrTypeNameNeedsParens(NameSoFar) || !namedContext)
+    if (ptrTypeNameNeedsParens(NameSoFar) || !namedContext || 
+        PTy->getElementType()->getPrimitiveID() == Type::ArrayTyID)
       ptrName = "(" + ptrName + ")";    // 
 
     return printType(PTy->getElementType(), ptrName);





More information about the llvm-commits mailing list