Skip to content

Commit 3217f06

Browse files
committed
fix string lifetime issue
1 parent e257a37 commit 3217f06

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

llvm/include/llvm/IR/DiagnosticInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class DiagnosticInfo {
139139
using DiagnosticHandlerFunction = std::function<void(const DiagnosticInfo &)>;
140140

141141
class DiagnosticInfoGeneric : public DiagnosticInfo {
142-
const Twine &MsgStr;
142+
const Twine MsgStr;
143143
const Instruction *Inst = nullptr;
144144

145145
public:

llvm/lib/Target/DirectX/DXILOpLowering.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,7 @@ class OpLowerer {
759759
std::string Msg =
760760
formatv("Unsupported intrinsic {0} for DXIL lowering", F.getName())
761761
.str();
762-
DiagnosticInfoGeneric Diag(Msg);
763-
M.getContext().diagnose(Diag);
762+
M.getContext().emitError(Msg);
764763
HasErrors |= true;
765764
break;
766765
}

0 commit comments

Comments
 (0)