Skip to content

Commit dfe4d91

Browse files
authored
GCStrategy: Use Twine properly for error message (#132760)
1 parent ae3faea commit dfe4d91

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

llvm/lib/IR/GCStrategy.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ std::unique_ptr<GCStrategy> llvm::getGCStrategy(const StringRef Name) {
4141
// be the builtin GCs if nothing else. The most likely scenario here is
4242
// that we got here without running the initializers used by the Registry
4343
// itself and it's registration mechanism.
44-
const std::string error =
45-
std::string("unsupported GC: ") + Name.str() +
46-
" (did you remember to link and initialize the library?)";
47-
report_fatal_error(Twine(error));
44+
report_fatal_error(
45+
"unsupported GC: " + Name +
46+
" (did you remember to link and initialize the library?)");
4847
} else
49-
report_fatal_error(Twine(std::string("unsupported GC: ") + Name.str()));
48+
report_fatal_error(Twine("unsupported GC: ") + Name);
5049
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: not --crash opt -disable-output -passes=rewrite-statepoints-for-gc %s 2>&1 | FileCheck %s
3+
4+
; CHECK: LLVM ERROR: unsupported GC: unsupported-gc
5+
6+
declare void @g()
7+
declare i32 @h()
8+
9+
define ptr addrspace(1) @f0(ptr addrspace(1) %arg) gc "unsupported-gc" {
10+
call void @g() [ "deopt"(i32 100) ]
11+
ret ptr addrspace(1) %arg
12+
}

0 commit comments

Comments
 (0)