[llvm] Remove redundant .c_str calls (PR #99829)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 21 16:37:22 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-binary-utilities
Author: AtariDreams (AtariDreams)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/99829.diff
3 Files Affected:
- (modified) llvm/tools/llvm-itanium-demangle-fuzzer/llvm-itanium-demangle-fuzzer.cpp (+1-1)
- (modified) llvm/tools/llvm-microsoft-demangle-fuzzer/llvm-microsoft-demangle-fuzzer.cpp (+1-1)
- (modified) llvm/tools/llvm-readobj/ELFDumper.cpp (+3-3)
``````````diff
diff --git a/llvm/tools/llvm-itanium-demangle-fuzzer/llvm-itanium-demangle-fuzzer.cpp b/llvm/tools/llvm-itanium-demangle-fuzzer/llvm-itanium-demangle-fuzzer.cpp
index 6d2dc7d5774c9..fefae896fb43a 100644
--- a/llvm/tools/llvm-itanium-demangle-fuzzer/llvm-itanium-demangle-fuzzer.cpp
+++ b/llvm/tools/llvm-itanium-demangle-fuzzer/llvm-itanium-demangle-fuzzer.cpp
@@ -14,7 +14,7 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
std::string NullTerminatedString((const char *)Data, Size);
- if (char *demangle = llvm::itaniumDemangle(NullTerminatedString.c_str()))
+ if (char *demangle = llvm::itaniumDemangle(NullTerminatedString))
free(demangle);
return 0;
diff --git a/llvm/tools/llvm-microsoft-demangle-fuzzer/llvm-microsoft-demangle-fuzzer.cpp b/llvm/tools/llvm-microsoft-demangle-fuzzer/llvm-microsoft-demangle-fuzzer.cpp
index 12fb1e41d9de3..98c3374499129 100644
--- a/llvm/tools/llvm-microsoft-demangle-fuzzer/llvm-microsoft-demangle-fuzzer.cpp
+++ b/llvm/tools/llvm-microsoft-demangle-fuzzer/llvm-microsoft-demangle-fuzzer.cpp
@@ -14,6 +14,6 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
std::string NullTerminatedString((const char *)Data, Size);
- free(llvm::microsoftDemangle(NullTerminatedString.c_str(), nullptr, nullptr));
+ free(llvm::microsoftDemangle(NullTerminatedString, nullptr, nullptr));
return 0;
}
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index f0a22f1568bef..3bd1529335f4e 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -7596,7 +7596,7 @@ void LLVMELFDumper<ELFT>::printVersionDefinitionSection(const Elf_Shdr *Sec) {
W.printFlags("Flags", D.Flags, ArrayRef(SymVersionFlags));
W.printNumber("Index", D.Ndx);
W.printNumber("Hash", D.Hash);
- W.printString("Name", D.Name.c_str());
+ W.printString("Name", D.Name);
W.printList(
"Predecessors", D.AuxV,
[](raw_ostream &OS, const VerdAux &Aux) { OS << Aux.Name.c_str(); });
@@ -7620,7 +7620,7 @@ void LLVMELFDumper<ELFT>::printVersionDependencySection(const Elf_Shdr *Sec) {
DictScope Entry(W, "Dependency");
W.printNumber("Version", VN.Version);
W.printNumber("Count", VN.Cnt);
- W.printString("FileName", VN.File.c_str());
+ W.printString("FileName", VN.File);
ListScope L(W, "Entries");
for (const VernAux &Aux : VN.AuxV) {
@@ -7628,7 +7628,7 @@ void LLVMELFDumper<ELFT>::printVersionDependencySection(const Elf_Shdr *Sec) {
W.printNumber("Hash", Aux.Hash);
W.printFlags("Flags", Aux.Flags, ArrayRef(SymVersionFlags));
W.printNumber("Index", Aux.Other);
- W.printString("Name", Aux.Name.c_str());
+ W.printString("Name", Aux.Name);
}
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/99829
More information about the llvm-commits
mailing list