[llvm] r211430 - Add back functionality removed in r210497.
Richard Trieu
rtrieu at google.com
Fri Jun 20 19:43:02 PDT 2014
Author: rtrieu
Date: Fri Jun 20 21:43:02 2014
New Revision: 211430
URL: http://llvm.org/viewvc/llvm-project?rev=211430&view=rev
Log:
Add back functionality removed in r210497.
Instead of asserting, output a message stating that a null pointer was found.
Modified:
llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
llvm/trunk/lib/Analysis/IVUsers.cpp
llvm/trunk/lib/Analysis/LoopPass.cpp
llvm/trunk/lib/Analysis/RegionPass.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/IR/Core.cpp
llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp
Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=211430&r1=211429&r2=211430&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Fri Jun 20 21:43:02 2014
@@ -603,8 +603,10 @@ namespace {
bool runOnSCC(CallGraphSCC &SCC) override {
Out << Banner;
for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
- assert((*I)->getFunction() && "Expecting non-null Function");
- (*I)->getFunction()->print(Out);
+ if ((*I)->getFunction())
+ (*I)->getFunction()->print(Out);
+ else
+ Out << "Printing <null> Function";
}
return false;
}
Modified: llvm/trunk/lib/Analysis/IVUsers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IVUsers.cpp?rev=211430&r1=211429&r2=211430&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IVUsers.cpp (original)
+++ llvm/trunk/lib/Analysis/IVUsers.cpp Fri Jun 20 21:43:02 2014
@@ -287,8 +287,10 @@ void IVUsers::print(raw_ostream &OS, con
OS << ")";
}
OS << " in ";
- assert(UI->getUser() != nullptr && "Expected non-null User");
- UI->getUser()->print(OS);
+ if (UI->getUser())
+ UI->getUser()->print(OS);
+ else
+ OS << "Printing <null> User";
OS << '\n';
}
}
Modified: llvm/trunk/lib/Analysis/LoopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=211430&r1=211429&r2=211430&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopPass.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopPass.cpp Fri Jun 20 21:43:02 2014
@@ -45,8 +45,10 @@ public:
for (Loop::block_iterator b = L->block_begin(), be = L->block_end();
b != be;
++b) {
- assert((*b) != nullptr && "Expecting non-null block");
- (*b)->print(Out);
+ if (*b)
+ (*b)->print(Out);
+ else
+ Out << "Printing <null> block";
}
return false;
}
Modified: llvm/trunk/lib/Analysis/RegionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/RegionPass.cpp?rev=211430&r1=211429&r2=211430&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/RegionPass.cpp (original)
+++ llvm/trunk/lib/Analysis/RegionPass.cpp Fri Jun 20 21:43:02 2014
@@ -196,8 +196,10 @@ public:
bool runOnRegion(Region *R, RGPassManager &RGM) override {
Out << Banner;
for (const auto &BB : R->blocks()) {
- assert(BB != nullptr && "Expecting non-null Block");
- BB->print(Out);
+ if (BB)
+ BB->print(Out);
+ else
+ Out << "Printing <null> Block";
}
return false;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=211430&r1=211429&r2=211430&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Jun 20 21:43:02 2014
@@ -1866,8 +1866,10 @@ static void emitGlobalConstantFP(const C
SmallString<8> StrVal;
CFP->getValueAPF().toString(StrVal);
- assert(CFP->getType() != nullptr && "Expecting non-null Type");
- CFP->getType()->print(AP.OutStreamer.GetCommentOS());
+ if (CFP->getType())
+ CFP->getType()->print(AP.OutStreamer.GetCommentOS());
+ else
+ AP.OutStreamer.GetCommentOS() << "Printing <null> Type";
AP.OutStreamer.GetCommentOS() << ' ' << StrVal << '\n';
}
Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=211430&r1=211429&r2=211430&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Fri Jun 20 21:43:02 2014
@@ -281,8 +281,11 @@ char *LLVMPrintTypeToString(LLVMTypeRef
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(LLVMValueRe
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());
Modified: llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp?rev=211430&r1=211429&r2=211430&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp Fri Jun 20 21:43:02 2014
@@ -352,10 +352,12 @@ private:
}
std::string getTypeName(Type *T) {
- assert(T != nullptr && "Expecting non-null Type");
std::string TypeName;
raw_string_ostream TypeStream(TypeName);
- T->print(TypeStream);
+ if (T)
+ T->print(TypeStream);
+ else
+ TypeStream << "Printing <null> Type";
TypeStream.flush();
return TypeName;
}
More information about the llvm-commits
mailing list