summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CWriter/Writer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-02 03:10:53 +0000
committerChris Lattner <sabre@nondot.org>2003-06-02 03:10:53 +0000
commit239ff501acd6e0e03756415c5ca281cdea2b3d80 (patch)
tree4a3e8c6d65d013eb215c6fdc8c655f4fd1062f6b /llvm/lib/CWriter/Writer.cpp
parentf557cbd31409c6a7a9e05e3edeaeacd925589aa1 (diff)
downloadbcm5719-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.cpp9
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"
OpenPOWER on IntegriCloud