<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/154810>154810</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang-tidy invalid suggestion: llvm-twine-local
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
joker-eph
</td>
</tr>
</table>
<pre>
With clang-tidy built at current head and applying it on MLIR:
```
$ clang-tidy -p build mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp --checks=-*,llvm-twine-local -fix -fix-errors
```
```
diff --git a/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp b/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
index 453b9bc1b58b..78402e5ea896 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
@@ -416,7 +416,7 @@ llvm::LaunchKernel::createKernelLaunch(mlir::gpu::LaunchFuncOp op,
// Load the kernel function.
StringRef moduleName = op.getKernelModuleName().getValue();
- Twine moduleIdentifier = getModuleIdentifier(moduleName);
+ std::string moduleIdentifier = (getModuleIdentifier(moduleName)).str();
Value *modulePtr = module.getGlobalVariable(moduleIdentifier.str(), true);
if (!modulePtr)
return op.emitError() << "Couldn't find the binary: " << moduleIdentifier;
```
```
mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp:420:64: error: no member named 'str' in 'std::basic_string<char>'
420 | Value *modulePtr = module.getGlobalVariable(moduleIdentifier.str(), true);
| ~~~~~~~~~~~~~~~~ ^
1 error generated.
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8VVFzozYQ_jXrlx0YIYTBDzwQ53yTadK7yV3Tx46ABZTIghEivbz0t3ck3MTn6UMfPPXINtoVH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