[llvm] 3e47f87 - [NFC][llvm-dwarfdump] Always use 'const Twine &'

Djordje Todorovic via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 04:59:16 PDT 2020


Author: Djordje Todorovic
Date: 2020-03-10T12:58:59+01:00
New Revision: 3e47f87e644991517f2746fd1cc4273f3fe5be70

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

LOG: [NFC][llvm-dwarfdump] Always use 'const Twine &'

According to the Twine.h comment, the Twines should only
be used as const references in arguments.

Differential Revision: https://reviews.llvm.org/D75727

Added: 
    

Modified: 
    llvm/tools/llvm-dwarfdump/Statistics.cpp
    llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-dwarfdump/Statistics.cpp b/llvm/tools/llvm-dwarfdump/Statistics.cpp
index ea9539a350a7..6ba6a7037136 100644
--- a/llvm/tools/llvm-dwarfdump/Statistics.cpp
+++ b/llvm/tools/llvm-dwarfdump/Statistics.cpp
@@ -502,7 +502,7 @@ static void printLocationStats(raw_ostream &OS,
 /// useful, only the delta between compiling the same program with 
diff erent
 /// compilers is.
 bool collectStatsForObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
-                               Twine Filename, raw_ostream &OS) {
+                               const Twine &Filename, raw_ostream &OS) {
   StringRef FormatName = Obj.getFileFormatName();
   GlobalStats GlobalStats;
   LocationStats LocStats;

diff  --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index 374bdd482a8d..28ede2ef5029 100644
--- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -278,8 +278,8 @@ static bool filterArch(ObjectFile &Obj) {
   return false;
 }
 
-using HandlerFn = std::function<bool(ObjectFile &, DWARFContext &DICtx, Twine,
-                                     raw_ostream &)>;
+using HandlerFn = std::function<bool(ObjectFile &, DWARFContext &DICtx,
+                                     const Twine &, raw_ostream &)>;
 
 /// Print only DIEs that have a certain name.
 static bool filterByName(const StringSet<> &Names, DWARFDie Die,
@@ -411,10 +411,10 @@ static bool lookup(ObjectFile &Obj, DWARFContext &DICtx, uint64_t Address,
 }
 
 bool collectStatsForObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
-                               Twine Filename, raw_ostream &OS);
+                               const Twine &Filename, raw_ostream &OS);
 
-static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx, Twine Filename,
-                           raw_ostream &OS) {
+static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
+                           const Twine &Filename, raw_ostream &OS) {
   logAllUnhandledErrors(DICtx.loadRegisterInfo(Obj), errs(),
                         Filename.str() + ": ");
   // The UUID dump already contains all the same information.
@@ -448,7 +448,7 @@ static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx, Twine Filename,
 }
 
 static bool verifyObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
-                             Twine Filename, raw_ostream &OS) {
+                             const Twine &Filename, raw_ostream &OS) {
   // Verify the DWARF and exit with non-zero exit status if verification
   // fails.
   raw_ostream &stream = Quiet ? nulls() : OS;


        


More information about the llvm-commits mailing list