diff options
author | Chris Lattner <sabre@nondot.org> | 2003-06-02 03:10:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-06-02 03:10:53 +0000 |
commit | 239ff501acd6e0e03756415c5ca281cdea2b3d80 (patch) | |
tree | 4a3e8c6d65d013eb215c6fdc8c655f4fd1062f6b /llvm/lib/CWriter/Writer.cpp | |
parent | f557cbd31409c6a7a9e05e3edeaeacd925589aa1 (diff) | |
download | bcm5719-llvm-239ff501acd6e0e03756415c5ca281cdea2b3d80.tar.gz bcm5719-llvm-239ff501acd6e0e03756415c5ca281cdea2b3d80.zip |
Fix bug: CBackend/2003-06-01-NullPointerType.ll
llvm-svn: 6526
Diffstat (limited to 'llvm/lib/CWriter/Writer.cpp')
-rw-r--r-- | llvm/lib/CWriter/Writer.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CWriter/Writer.cpp b/llvm/lib/CWriter/Writer.cpp index a12afa79581..954266163b1 100644 --- a/llvm/lib/CWriter/Writer.cpp +++ b/llvm/lib/CWriter/Writer.cpp @@ -435,7 +435,9 @@ void CWriter::printConstant(Constant *CPV) { 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 @@ void CWriter::printModule(Module *M) { 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" |