Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

maskedBitSetCase takes StringRef, so we can "implicitly cast"
std::string to StringRef.

Identified with readability-redundant-string-cstr.

maskedBitSetCase takes StringRef, so we can "implicitly cast"
std::string to StringRef.

Identified with readability-redundant-string-cstr.
@llvmbot
Copy link
Member

llvmbot commented Nov 8, 2025

@llvm/pr-subscribers-objectyaml

Author: Kazu Hirata (kazutakahirata)

Changes

maskedBitSetCase takes StringRef, so we can "implicitly cast"
std::string to StringRef.

Identified with readability-redundant-string-cstr.


Full diff: https://github.com/llvm/llvm-project/pull/167189.diff

1 Files Affected:

  • (modified) llvm/lib/ObjectYAML/ELFYAML.cpp (+1-1)
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index 29f291614ffc6..d07c37edad241 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -670,7 +670,7 @@ void ScalarBitSetTraits<ELFYAML::ELF_EF>::bitset(IO &IO,
       for (unsigned K = ELF::EF_AMDGPU_GENERIC_VERSION_MIN;
            K <= ELF::EF_AMDGPU_GENERIC_VERSION_MAX; ++K) {
         std::string Key = "EF_AMDGPU_GENERIC_VERSION_V" + std::to_string(K);
-        IO.maskedBitSetCase(Value, Key.c_str(),
+        IO.maskedBitSetCase(Value, Key,
                             K << ELF::EF_AMDGPU_GENERIC_VERSION_OFFSET,
                             ELF::EF_AMDGPU_GENERIC_VERSION);
       }

@kazutakahirata kazutakahirata merged commit 8628ff3 into llvm:main Nov 9, 2025
12 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20251108_clang_tidy_readability-redundant-string-cstr_ObjectYAML branch November 9, 2025 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants