aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2009-07-08 18:01:40 +0000
committerTorok Edwin <edwintorok@gmail.com>2009-07-08 18:01:40 +0000
commitab7c09b6b6f4516a631fd6788918c237c83939af (patch)
treeedf8970f645aa30e8d15802d5ef85768dcaf0412 /lib/VMCore
parent4de77f8afcf5920234c86bd8fba3b164b1a17a72 (diff)
downloadexternal_llvm-ab7c09b6b6f4516a631fd6788918c237c83939af.zip
external_llvm-ab7c09b6b6f4516a631fd6788918c237c83939af.tar.gz
external_llvm-ab7c09b6b6f4516a631fd6788918c237c83939af.tar.bz2
Start converting to new error handling API.
cerr+abort -> llvm_report_error assert(0)+abort -> LLVM_UNREACHABLE (assert(0)+llvm_unreachable-> abort() included) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75018 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp4
-rw-r--r--lib/VMCore/Globals.cpp6
-rw-r--r--lib/VMCore/Instructions.cpp18
-rw-r--r--lib/VMCore/PassManager.cpp4
-rw-r--r--lib/VMCore/Type.cpp5
-rw-r--r--lib/VMCore/Value.cpp5
-rw-r--r--lib/VMCore/Verifier.cpp6
7 files changed, 24 insertions, 24 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index cbf7070..70c27eb 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -31,6 +31,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CFG.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
@@ -1234,8 +1235,7 @@ static void PrintLinkage(GlobalValue::LinkageTypes LT, raw_ostream &Out) {
case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break;
case GlobalValue::ExternalLinkage: break;
case GlobalValue::GhostLinkage:
- Out << "GhostLinkage not allowed in AsmWriter!\n";
- abort();
+ llvm_report_error("GhostLinkage not allowed in AsmWriter!");
}
}
diff --git a/lib/VMCore/Globals.cpp b/lib/VMCore/Globals.cpp
index c31b7b5..f8c1071 100644
--- a/lib/VMCore/Globals.cpp
+++ b/lib/VMCore/Globals.cpp
@@ -19,6 +19,7 @@
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LeakDetector.h"
using namespace llvm;
@@ -77,8 +78,7 @@ void GlobalValue::removeDeadConstantUsers() const {
/// Override destroyConstant to make sure it doesn't get called on
/// GlobalValue's because they shouldn't be treated like other constants.
void GlobalValue::destroyConstant() {
- assert(0 && "You can't GV->destroyConstant()!");
- abort();
+ LLVM_UNREACHABLE("You can't GV->destroyConstant()!");
}
/// copyAttributesFrom - copy all additional attributes (those not needed to
@@ -247,7 +247,7 @@ const GlobalValue *GlobalAlias::getAliasedGlobal() const {
CE->getOpcode() == Instruction::GetElementPtr))
return dyn_cast<GlobalValue>(CE->getOperand(0));
else
- assert(0 && "Unsupported aliasee");
+ LLVM_UNREACHABLE("Unsupported aliasee");
}
}
return 0;
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 8d14766..6626930 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -16,6 +16,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/Instructions.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/ConstantRange.h"
#include "llvm/Support/MathExtras.h"
@@ -534,12 +535,11 @@ unsigned ReturnInst::getNumSuccessorsV() const {
/// Out-of-line ReturnInst method, put here so the C++ compiler can choose to
/// emit the vtable for the class in this translation unit.
void ReturnInst::setSuccessorV(unsigned idx, BasicBlock *NewSucc) {
- assert(0 && "ReturnInst has no successors!");
+ LLVM_UNREACHABLE("ReturnInst has no successors!");
}
BasicBlock *ReturnInst::getSuccessorV(unsigned idx) const {
- assert(0 && "ReturnInst has no successors!");
- abort();
+ LLVM_UNREACHABLE("ReturnInst has no successors!");
return 0;
}
@@ -563,12 +563,11 @@ unsigned UnwindInst::getNumSuccessorsV() const {
}
void UnwindInst::setSuccessorV(unsigned idx, BasicBlock *NewSucc) {
- assert(0 && "UnwindInst has no successors!");
+ LLVM_UNREACHABLE("UnwindInst has no successors!");
}
BasicBlock *UnwindInst::getSuccessorV(unsigned idx) const {
- assert(0 && "UnwindInst has no successors!");
- abort();
+ LLVM_UNREACHABLE("UnwindInst has no successors!");
return 0;
}
@@ -588,12 +587,11 @@ unsigned UnreachableInst::getNumSuccessorsV() const {
}
void UnreachableInst::setSuccessorV(unsigned idx, BasicBlock *NewSucc) {
- assert(0 && "UnwindInst has no successors!");
+ LLVM_UNREACHABLE("UnwindInst has no successors!");
}
BasicBlock *UnreachableInst::getSuccessorV(unsigned idx) const {
- assert(0 && "UnwindInst has no successors!");
- abort();
+ LLVM_UNREACHABLE("UnwindInst has no successors!");
return 0;
}
@@ -2295,7 +2293,7 @@ CastInst::getCastOpcode(
PTy = NULL;
return BitCast; // same size, no-op cast
} else {
- assert(0 && "Casting pointer or non-first class to float");
+ LLVM_UNREACHABLE("Casting pointer or non-first class to float");
}
} else if (const VectorType *DestPTy = dyn_cast<VectorType>(DestTy)) {
if (const VectorType *SrcPTy = dyn_cast<VectorType>(SrcTy)) {
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index 74c09fd..0878694 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -17,6 +17,7 @@
#include "llvm/Support/Timer.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Streams.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/raw_ostream.h"
@@ -1248,8 +1249,7 @@ void FunctionPassManager::add(Pass *P) {
bool FunctionPassManager::run(Function &F) {
std::string errstr;
if (MP->materializeFunction(&F, &errstr)) {
- cerr << "Error reading bitcode file: " << errstr << "\n";
- abort();
+ llvm_report_error("Error reading bitcode file: " + errstr);
}
return FPM->run(F);
}
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index b415251..432a1cc 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -20,6 +20,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
@@ -264,10 +265,10 @@ const Type *Type::getForwardedTypeInternal() const {
}
void Type::refineAbstractType(const DerivedType *OldTy, const Type *NewTy) {
- abort();
+ llvm_report_error("Attempting to refine a derived type!");
}
void Type::typeBecameConcrete(const DerivedType *AbsTy) {
- abort();
+ llvm_report_error("DerivedType is already a concrete type!");
}
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index e980a5d..8c5d551 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -19,6 +19,7 @@
#include "llvm/Module.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LeakDetector.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/ValueHandle.h"
@@ -514,8 +515,8 @@ void ValueHandleBase::ValueIsDeleted(Value *V) {
cerr << "While deleting: " << *V->getType() << " %" << V->getNameStr()
<< "\n";
#endif
- cerr << "An asserting value handle still pointed to this value!\n";
- abort();
+ llvm_report_error("An asserting value handle still pointed to this"
+ "value!");
case Weak:
// Weak just goes to null, which will unlink it from the list.
ThisNode->operator=(0);
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 10816e6..6674acb 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -62,6 +62,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <sstream>
@@ -93,7 +94,7 @@ namespace { // Anonymous namespace for class
}
if (Broken)
- abort();
+ llvm_report_error("Broken module, no Basic Block terminator!");
return false;
}
@@ -210,8 +211,7 @@ namespace {
default: assert(0 && "Unknown action");
case AbortProcessAction:
msgs << "compilation aborted!\n";
- cerr << msgs.str();
- abort();
+ llvm_report_error(msgs.str());
case PrintMessageAction:
msgs << "verification continues.\n";
cerr << msgs.str();