[PATCH] D75727: [NFC][llvm-dwarfdump] Always use 'const Twine &'
Djordje Todorovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 6 01:39:57 PST 2020
djtodoro created this revision.
djtodoro added reviewers: jhenderson, aprantl, vsk.
djtodoro added a project: debug-info.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
djtodoro added a parent revision: D74205: [llvm-dwarfdump] Add the --show-sections-sizes option.
According to the Twine.h comment, the `Twine`s should only be used as `const` references in arguments.
https://reviews.llvm.org/D75727
Files:
llvm/tools/llvm-dwarfdump/SectionSizes.cpp
llvm/tools/llvm-dwarfdump/Statistics.cpp
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
Index: llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
===================================================================
--- llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -282,8 +282,8 @@
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,
@@ -415,13 +415,13 @@
}
bool collectStatsForObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
- Twine Filename, raw_ostream &OS);
+ const Twine &Filename, raw_ostream &OS);
bool collectObjectSectionSizes(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.
@@ -455,7 +455,7 @@
}
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;
Index: llvm/tools/llvm-dwarfdump/Statistics.cpp
===================================================================
--- llvm/tools/llvm-dwarfdump/Statistics.cpp
+++ llvm/tools/llvm-dwarfdump/Statistics.cpp
@@ -502,7 +502,7 @@
/// useful, only the delta between compiling the same program with different
/// 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;
Index: llvm/tools/llvm-dwarfdump/SectionSizes.cpp
===================================================================
--- llvm/tools/llvm-dwarfdump/SectionSizes.cpp
+++ llvm/tools/llvm-dwarfdump/SectionSizes.cpp
@@ -86,7 +86,7 @@
}
bool collectObjectSectionSizes(ObjectFile &Obj, DWARFContext &DICtx,
- Twine Filename, raw_ostream &OS) {
+ const Twine &Filename, raw_ostream &OS) {
// Unused, but we want to keep using the llvm-dwarfdump function handler
// interface.
(void)DICtx;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75727.248657.patch
Type: text/x-patch
Size: 3100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200306/3d7312e6/attachment.bin>
More information about the llvm-commits
mailing list