[llvm] 282d114 - [llvm] Remove redundant string initialization (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 16 09:42:46 PDT 2023


Author: Kazu Hirata
Date: 2023-04-16T09:42:34-07:00
New Revision: 282d114c21bfe5292db659579a944403bec345a2

URL: https://github.com/llvm/llvm-project/commit/282d114c21bfe5292db659579a944403bec345a2
DIFF: https://github.com/llvm/llvm-project/commit/282d114c21bfe5292db659579a944403bec345a2.diff

LOG: [llvm] Remove redundant string initialization (NFC)

Identified with readability-redundant-string-init.

Added: 
    

Modified: 
    llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    llvm/lib/DebugInfo/LogicalView/Core/LVLocation.cpp
    llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index acf91a2d35c41..f9ccad0a1d18c 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -170,8 +170,7 @@ struct TargetRegionEntryInfo {
   unsigned Line;
   unsigned Count;
 
-  TargetRegionEntryInfo()
-      : ParentName(""), DeviceID(0), FileID(0), Line(0), Count(0) {}
+  TargetRegionEntryInfo() : DeviceID(0), FileID(0), Line(0), Count(0) {}
   TargetRegionEntryInfo(StringRef ParentName, unsigned DeviceID,
                         unsigned FileID, unsigned Line, unsigned Count = 0)
       : ParentName(ParentName), DeviceID(DeviceID), FileID(FileID), Line(Line),

diff  --git a/llvm/lib/DebugInfo/LogicalView/Core/LVLocation.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVLocation.cpp
index e11e56cd59760..954ac0436b6ca 100644
--- a/llvm/lib/DebugInfo/LogicalView/Core/LVLocation.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Core/LVLocation.cpp
@@ -659,7 +659,7 @@ void LVLocationSymbol::printExtra(raw_ostream &OS, bool Full) const {
   if (Full && Entries) {
     bool CodeViewLocation = getParentSymbol()->getHasCodeViewLocation();
     std::stringstream Stream;
-    std::string Leading = "";
+    std::string Leading;
     for (LVOperation *Operation : *Entries) {
       Stream << Leading
              << (CodeViewLocation ? Operation->getOperandsCodeViewInfo()

diff  --git a/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp b/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp
index 617ff7bff5424..eec1cc28f490b 100644
--- a/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp
+++ b/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp
@@ -23,8 +23,8 @@ namespace {
 
 std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
   auto TT(Triple::normalize("wasm32-unknown-unknown"));
-  std::string CPU("");
-  std::string FS("");
+  std::string CPU;
+  std::string FS;
 
   LLVMInitializeWebAssemblyTargetInfo();
   LLVMInitializeWebAssemblyTarget();


        


More information about the llvm-commits mailing list