GCStrategy: Use Twine properly for error message (#132760)

This commit is contained in:
Matt Arsenault
2025-04-08 21:57:29 +07:00
committed by GitHub
parent ae3faea1f2
commit dfe4d9187c
2 changed files with 16 additions and 5 deletions

View File

@@ -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);
}

View File

@@ -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
}