http://llvm.org/bugs/show_bug.cgi?id=8973
Summary: remove llvm_unreachable
Product: libraries
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Support Libraries
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
llvm_reachable does two things: it prints an error message, and is marked
noreturn to silence compiler warnings. It was added as a replacement for
"assert(0 &&" for the second feature, but it has since pervaded the codebase.
It would be really nice to eradicate almost all (or all) uses of this function,
replacing them with proper assertions. We have lots of stuff like this:
int foo() {
switch (x) {
case 1: ..
case 2: ..
case 3: return 27;
default: llvm_unreachable("whatever");
}
}
This sort of thing should be turned into:
int foo() {
switch (x) {
default: assert(0 && "whatever");
case 1: ..
case 2: ..
case 3: return 27;
}
}
There are other similar patterns to remove uses of llvm_unreachable. One
benefit of this is to get rid of all the ErrorHandling.h includes.
In contrast to llvm_unreachable, report_fatal_error *is* useful. Those handle
possible, but erroneous cases in the backend, such as inline asm constraint
failures.
-Chris
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs