diff options
| author | Richard Trieu <rtrieu@google.com> | 2014-06-21 02:43:02 +0000 |
|---|---|---|
| committer | Richard Trieu <rtrieu@google.com> | 2014-06-21 02:43:02 +0000 |
| commit | c1485223a688abe8a86e27529e86bd0fa885ceeb (patch) | |
| tree | 01e75c881a2bfd892b2d1c06ab1bd8ff014db96c /llvm/lib/IR/Core.cpp | |
| parent | 9eaae3d8f67a7f85c58888b2074854f63266bfac (diff) | |
| download | bcm5719-llvm-c1485223a688abe8a86e27529e86bd0fa885ceeb.tar.gz bcm5719-llvm-c1485223a688abe8a86e27529e86bd0fa885ceeb.zip | |
Add back functionality removed in r210497.
Instead of asserting, output a message stating that a null pointer was found.
llvm-svn: 211430
Diffstat (limited to 'llvm/lib/IR/Core.cpp')
| -rw-r--r-- | llvm/lib/IR/Core.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index 68b9baa2baa..0cb781c2c6b 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -281,8 +281,11 @@ char *LLVMPrintTypeToString(LLVMTypeRef Ty) { std::string buf; raw_string_ostream os(buf); - assert(unwrap(Ty) != nullptr && "Expecting non-null Type"); - unwrap(Ty)->print(os); + if (unwrap(Ty)) + unwrap(Ty)->print(os); + else + os << "Printing <null> Type"; + os.flush(); return strdup(buf.c_str()); @@ -532,8 +535,11 @@ char* LLVMPrintValueToString(LLVMValueRef Val) { std::string buf; raw_string_ostream os(buf); - assert(unwrap(Val) != nullptr && "Expecting non-null Value"); - unwrap(Val)->print(os); + if (unwrap(Val)) + unwrap(Val)->print(os); + else + os << "Printing <null> Value"; + os.flush(); return strdup(buf.c_str()); |

