Skip to content

Commit e7a83fc

Browse files
[NVPTX] Fix a warning
This patch fixes: llvm/lib/Target/NVPTX/NVVMReflect.cpp:225:18: error: object backing the pointer will be destroyed at the end of the full-expression [-Werror,-Wdangling-gsl]
1 parent 2ab447a commit e7a83fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Target/NVPTX/NVVMReflect.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ bool NVVMReflect::runOnFunction(Function &F) {
222222

223223
NVVMReflectPass::NVVMReflectPass() {
224224
// Get the CPU string from the command line if not provided.
225-
StringRef SM = codegen::getMCPU();
225+
std::string MCPU = codegen::getMCPU();
226+
StringRef SM = MCPU;
226227
if (!SM.consume_front("sm_") || SM.consumeInteger(10, SmVersion))
227228
SmVersion = 0;
228229
}

0 commit comments

Comments
 (0)