Skip to content

GCStrategy: Use Twine properly for error message #132760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions llvm/lib/IR/GCStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ std::unique_ptr<GCStrategy> llvm::getGCStrategy(const StringRef Name) {
// 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 =
std::string("unsupported GC: ") + Name.str() +
" (did you remember to link and initialize the library?)";
report_fatal_error(Twine(error));
report_fatal_error(
"unsupported GC: " + Name +
" (did you remember to link and initialize the library?)");
} else
report_fatal_error(Twine(std::string("unsupported GC: ") + Name.str()));
report_fatal_error(Twine("unsupported GC: ") + Name);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: not --crash opt -disable-output -passes=rewrite-statepoints-for-gc %s 2>&1 | FileCheck %s

; CHECK: LLVM ERROR: unsupported GC: unsupported-gc

declare void @g()
declare i32 @h()

define ptr addrspace(1) @f0(ptr addrspace(1) %arg) gc "unsupported-gc" {
call void @g() [ "deopt"(i32 100) ]
ret ptr addrspace(1) %arg
}