Skip to content

Clang-tidy invalid suggestion: llvm-twine-local #154810

@joker-eph

Description

@joker-eph

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions