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 | 7921239c411aeeaef55998cc64495aa1ea1a3ea3 (patch) | |
tree | 5d606ccc0402f191214c7db4b647fa86d2b9ff0b /lib/IR | |
parent | 5d0ff9c9289fc4f9e99c7b27b7c8b42597cd8765 (diff) | |
download | llvm-7921239c411aeeaef55998cc64495aa1ea1a3ea3.tar.gz llvm-7921239c411aeeaef55998cc64495aa1ea1a3ea3.tar.bz2 llvm-7921239c411aeeaef55998cc64495aa1ea1a3ea3.tar.xz |
Add back functionality removed in r210497.
Instead of asserting, output a message stating that a null pointer was found.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211430 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r-- | lib/IR/Core.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index 68b9baa2ba..0cb781c2c6 100644 --- a/lib/IR/Core.cpp +++ b/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()); |