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

Chris Lattner lattner at cs.uiuc.edu
Sun Jun 1 22:12:00 PDT 2003


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.90 -> 1.91

---
Log message:

Fix bug: CBackend/2003-06-01-NullPointerType.ll


---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.90 llvm/lib/CWriter/Writer.cpp:1.91
--- llvm/lib/CWriter/Writer.cpp:1.90	Sat May 31 22:36:51 2003
+++ llvm/lib/CWriter/Writer.cpp	Sun Jun  1 22:10:53 2003
@@ -435,7 +435,9 @@
 
   case Type::PointerTyID:
     if (isa<ConstantPointerNull>(CPV)) {
-      Out << "(NULL)";
+      Out << "((";
+      printType(Out, CPV->getType());
+      Out << ")/*NULL*/0)";
       break;
     } else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(CPV)) {
       writeOperand(CPR->getValue());
@@ -545,9 +547,8 @@
   Out << "#include <stdarg.h>\n";
   Out << "#include <setjmp.h>\n";
   
-  // Provide a definition for null if one does not already exist,
-  // and for `bool' if not compiling with a C++ compiler.
-  Out << "#ifndef NULL\n#define NULL 0\n#endif\n\n"
+  // Provide a definition for `bool' if not compiling with a C++ compiler.
+  Out << "\n"
       << "#ifndef __cplusplus\ntypedef unsigned char bool;\n#endif\n"
     
       << "\n\n/* Support for floating point constants */\n"





More information about the llvm-commits mailing list