summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2009-07-14 16:55:14 +0000
committerTorok Edwin <edwintorok@gmail.com>2009-07-14 16:55:14 +0000
commitc23197a26f34f559ea9797de51e187087c039c42 (patch)
treebf497ec9a02cd2fc0b64e3e58eff037a719a854d /include/llvm
parent1f316e321a8f2fa0e193c5444584a67a8aabe9a8 (diff)
downloadllvm-c23197a26f34f559ea9797de51e187087c039c42.tar.gz
llvm-c23197a26f34f559ea9797de51e187087c039c42.tar.bz2
llvm-c23197a26f34f559ea9797de51e187087c039c42.tar.xz
llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in !NDEBUG builds. In NDEBUG builds location info and the message is off (it only prints "UREACHABLE executed"). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpressions.h4
-rw-r--r--include/llvm/MDNode.h2
-rw-r--r--include/llvm/Support/ErrorHandling.h19
-rw-r--r--include/llvm/Support/InstVisitor.h2
-rw-r--r--include/llvm/Support/PassNameParser.h2
-rw-r--r--include/llvm/Target/TargetInstrInfo.h2
6 files changed, 16 insertions, 15 deletions
diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h
index 1c900cabfa..a7cea9dfb5 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -584,12 +584,12 @@ namespace llvm {
case scCouldNotCompute:
return ((SC*)this)->visitCouldNotCompute((const SCEVCouldNotCompute*)S);
default:
- LLVM_UNREACHABLE("Unknown SCEV type!");
+ llvm_unreachable("Unknown SCEV type!");
}
}
RetVal visitCouldNotCompute(const SCEVCouldNotCompute *S) {
- LLVM_UNREACHABLE("Invalid use of SCEVCouldNotCompute!");
+ llvm_unreachable("Invalid use of SCEVCouldNotCompute!");
return RetVal();
}
};
diff --git a/include/llvm/MDNode.h b/include/llvm/MDNode.h
index dcda5d05eb..6c8f7550a6 100644
--- a/include/llvm/MDNode.h
+++ b/include/llvm/MDNode.h
@@ -120,7 +120,7 @@ public:
virtual void destroyConstant();
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) {
- LLVM_UNREACHABLE("This should never be called because MDNodes have no ops");
+ llvm_unreachable("This should never be called because MDNodes have no ops");
}
/// Methods for support type inquiry through isa, cast, and dyn_cast:
diff --git a/include/llvm/Support/ErrorHandling.h b/include/llvm/Support/ErrorHandling.h
index c14eed9885..bdee5b1c24 100644
--- a/include/llvm/Support/ErrorHandling.h
+++ b/include/llvm/Support/ErrorHandling.h
@@ -47,19 +47,20 @@ namespace llvm {
void llvm_report_error(const std::string &reason) NORETURN;
/// This function calls abort(), and prints the optional message to stderr.
- /// Call this instead of assert(0), so that compiler knows the path is not
- /// reachable even for NDEBUG builds.
- /// Use the LLVM_UNREACHABLE macro instead that adds location info.
- void llvm_unreachable(const char *msg=0, const char *file=0,
- unsigned line=0) NORETURN;
+ /// Use the llvm_unreachable macro (that adds location info), instead of
+ /// calling this function directly.
+ void llvm_unreachable_internal(const char *msg=0, const char *file=0,
+ unsigned line=0) NORETURN;
}
-/// Macro that calls llvm_unreachable with location info and message in
-/// debug mode. In NDEBUG mode it calls llvm_unreachable with no message.
+/// Prints the message and location info to stderr in !NDEBUG builds.
+/// In NDEBUG mode it only prints "UNREACHABLE executed".
+/// Use this instead of assert(0), so that the compiler knows this path
+/// is not reachable even for NDEBUG builds.
#ifndef NDEBUG
-#define LLVM_UNREACHABLE(msg) llvm_unreachable(msg, __FILE__, __LINE__)
+#define llvm_unreachable(msg) llvm_unreachable_internal(msg, __FILE__, __LINE__)
#else
-#define LLVM_UNREACHABLE(msg) llvm_unreachable()
+#define llvm_unreachable(msg) llvm_unreachable_internal()
#endif
#endif
diff --git a/include/llvm/Support/InstVisitor.h b/include/llvm/Support/InstVisitor.h
index 2fa8c4793c..7c8f85a065 100644
--- a/include/llvm/Support/InstVisitor.h
+++ b/include/llvm/Support/InstVisitor.h
@@ -114,7 +114,7 @@ public:
//
RetTy visit(Instruction &I) {
switch (I.getOpcode()) {
- default: LLVM_UNREACHABLE("Unknown instruction type encountered!");
+ default: llvm_unreachable("Unknown instruction type encountered!");
// Build the switch statement using the Instruction.def file...
#define HANDLE_INST(NUM, OPCODE, CLASS) \
case Instruction::OPCODE: return \
diff --git a/include/llvm/Support/PassNameParser.h b/include/llvm/Support/PassNameParser.h
index 559dfd3e97..a437e2048e 100644
--- a/include/llvm/Support/PassNameParser.h
+++ b/include/llvm/Support/PassNameParser.h
@@ -68,7 +68,7 @@ public:
if (findOption(P->getPassArgument()) != getNumOptions()) {
cerr << "Two passes with the same argument (-"
<< P->getPassArgument() << ") attempted to be registered!\n";
- LLVM_UNREACHABLE(0);
+ llvm_unreachable(0);
}
addLiteralOption(P->getPassArgument(), P, P->getPassName());
}
diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h
index 242bbdcef4..00f9f5a522 100644
--- a/include/llvm/Target/TargetInstrInfo.h
+++ b/include/llvm/Target/TargetInstrInfo.h
@@ -429,7 +429,7 @@ public:
/// point.
virtual void insertNoop(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI) const {
- LLVM_UNREACHABLE("Target didn't implement insertNoop!");
+ llvm_unreachable("Target didn't implement insertNoop!");
}
/// isPredicated - Returns true if the instruction is already predicated.