summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/GCMetadata.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2015-04-26 22:00:34 +0000
committerPhilip Reames <listmail@philipreames.com>2015-04-26 22:00:34 +0000
commit20c24f1da58fb50d99deb3d1fe77b67b39d1738e (patch)
tree5967cfbad9c75c626c884af2eb6c2230bde1cd63 /llvm/lib/CodeGen/GCMetadata.cpp
parent8f8af43fefd1d0a413e88df77d1bea42b07f373c (diff)
downloadbcm5719-llvm-20c24f1da58fb50d99deb3d1fe77b67b39d1738e.tar.gz
bcm5719-llvm-20c24f1da58fb50d99deb3d1fe77b67b39d1738e.zip
Make the message associated with a fatal error slightly more helpful
Looking into 23095, my best guess is that the CodeGen library itself isn't getting linked and initialized properly. To make this slightly more obvious to consumers of LLVM, emit a different error message if we can tell that the registry is empty vs you've simply happened to name a collector which hasn't been registered. llvm-svn: 235824
Diffstat (limited to 'llvm/lib/CodeGen/GCMetadata.cpp')
-rw-r--r--llvm/lib/CodeGen/GCMetadata.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/GCMetadata.cpp b/llvm/lib/CodeGen/GCMetadata.cpp
index 16cd9e83b4a..c8116a453d2 100644
--- a/llvm/lib/CodeGen/GCMetadata.cpp
+++ b/llvm/lib/CodeGen/GCMetadata.cpp
@@ -148,7 +148,6 @@ bool Printer::doFinalization(Module &M) {
return false;
}
-
GCStrategy *GCModuleInfo::getGCStrategy(const StringRef Name) {
// TODO: Arguably, just doing a linear search would be faster for small N
auto NMI = GCStrategyMap.find(Name);
@@ -165,5 +164,14 @@ GCStrategy *GCModuleInfo::getGCStrategy(const StringRef Name) {
}
}
- report_fatal_error(std::string("unsupported GC: ") + Name);
+ if (GCRegistry::begin() == GCRegistry::end()) {
+ // In normal operation, the registry should not be empty. There should
+ // be the builtin GCs if nothing else. The most likely scenario here is
+ // that we got here without running the initializers used by the Registry
+ // itself and it's registration mechanism.
+ const std::string error = ("unsupported GC: " + Name).str() +
+ " (did you remember to link and initialize the CodeGen library?)";
+ report_fatal_error(error);
+ } else
+ report_fatal_error(std::string("unsupported GC: ") + Name);
}
OpenPOWER on IntegriCloud