Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

defineMacro takes Twine, which can be constructed from
const std::string &.

Identified with readability-redundant-string-cstr.

defineMacro takes Twine, which can be constructed from
const std::string &.

Identified with readability-redundant-string-cstr.
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:SystemZ clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Nov 14, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 14, 2025

@llvm/pr-subscribers-backend-systemz

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

defineMacro takes Twine, which can be constructed from
const std::string &.

Identified with readability-redundant-string-cstr.


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

1 Files Affected:

  • (modified) clang/lib/Basic/Targets/SystemZ.cpp (+1-1)
diff --git a/clang/lib/Basic/Targets/SystemZ.cpp b/clang/lib/Basic/Targets/SystemZ.cpp
index 30f846cb900f8..ecd12ed34a20c 100644
--- a/clang/lib/Basic/Targets/SystemZ.cpp
+++ b/clang/lib/Basic/Targets/SystemZ.cpp
@@ -205,7 +205,7 @@ void SystemZTargetInfo::getTargetDefines(const LangOptions &Opts,
     Librel |= V.getSubminor().value_or(0);
     Str += llvm::utohexstr(Librel);
 
-    Builder.defineMacro("__TARGET_LIB__", Str.c_str());
+    Builder.defineMacro("__TARGET_LIB__", Str);
   }
 }
 

@kazutakahirata kazutakahirata merged commit 675bf80 into llvm:main Nov 14, 2025
14 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20251113_clang_tidy_readability-redundant-string-cstr branch November 14, 2025 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:SystemZ clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants