[clang] fdd0e74 - [clang] Remove redundant string initialization (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 30 12:33:16 PST 2022


Author: Kazu Hirata
Date: 2022-01-30T12:32:55-08:00
New Revision: fdd0e745c35dd9f8747d0aaa66488cfefc9634a6

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

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

Identified with readability-redundant-string-init.

Added: 
    

Modified: 
    clang/include/clang/Analysis/FlowSensitive/MapLattice.h
    clang/lib/Sema/SemaChecking.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Analysis/FlowSensitive/MapLattice.h b/clang/include/clang/Analysis/FlowSensitive/MapLattice.h
index ff403f68b7c5b..014cd60841ee7 100644
--- a/clang/include/clang/Analysis/FlowSensitive/MapLattice.h
+++ b/clang/include/clang/Analysis/FlowSensitive/MapLattice.h
@@ -112,7 +112,7 @@ template <typename Key, typename ElementLattice>
 std::ostream &
 operator<<(std::ostream &Os,
            const clang::dataflow::MapLattice<Key, ElementLattice> &M) {
-  std::string Separator = "";
+  std::string Separator;
   Os << "{";
   for (const auto &E : M) {
     Os << std::exchange(Separator, ", ") << E.first << " => " << E.second;
@@ -125,7 +125,7 @@ template <typename ElementLattice>
 std::ostream &
 operator<<(std::ostream &Os,
            const clang::dataflow::VarMapLattice<ElementLattice> &M) {
-  std::string Separator = "";
+  std::string Separator;
   Os << "{";
   for (const auto &E : M) {
     Os << std::exchange(Separator, ", ") << E.first->getName().str() << " => "

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index c8fb36b8311a4..dfbf4cdc89cb9 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3987,7 +3987,7 @@ bool Sema::CheckRISCVBuiltinFunctionCall(const TargetInfo &TI,
     }
 
     if (!HasFeature) {
-      std::string FeatureStrs = "";
+      std::string FeatureStrs;
       for (StringRef OF : ReqOpFeatures) {
         // If the feature is 64bit, alter the string so it will print better in
         // the diagnostic.


        


More information about the cfe-commits mailing list