diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-03-20 11:40:34 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2022-06-04 11:58:51 +0000 |
| commit | 4b6eb0e63c698094db5506763df44cc83c19f643 (patch) | |
| tree | f1d30b8c10bc6db323b91538745ae8ab8b593910 /contrib/llvm-project/llvm/lib/CodeGen/GCMetadata.cpp | |
| parent | 76886853f03395abb680824bcc74e98f83bd477a (diff) | |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/GCMetadata.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/GCMetadata.cpp | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/GCMetadata.cpp b/contrib/llvm-project/llvm/lib/CodeGen/GCMetadata.cpp index 8fae798b31d9..af5515cc6bfd 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/GCMetadata.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/GCMetadata.cpp @@ -145,24 +145,9 @@ GCStrategy *GCModuleInfo::getGCStrategy(const StringRef Name) { if (NMI != GCStrategyMap.end()) return NMI->getValue(); - for (auto& Entry : GCRegistry::entries()) { - if (Name == Entry.getName()) { - std::unique_ptr<GCStrategy> S = Entry.instantiate(); - S->Name = std::string(Name); - GCStrategyMap[Name] = S.get(); - GCStrategyList.push_back(std::move(S)); - return GCStrategyList.back().get(); - } - } - - 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); + std::unique_ptr<GCStrategy> S = llvm::getGCStrategy(Name); + S->Name = std::string(Name); + GCStrategyMap[Name] = S.get(); + GCStrategyList.push_back(std::move(S)); + return GCStrategyList.back().get(); } |
