[llvm] r363024 - Symbolize: Replace the Options constructor with in-class initialization. NFCI.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 10 19:31:55 PDT 2019
Author: pcc
Date: Mon Jun 10 19:31:54 2019
New Revision: 363024
URL: http://llvm.org/viewvc/llvm-project?rev=363024&view=rev
Log:
Symbolize: Replace the Options constructor with in-class initialization. NFCI.
This is not only less code but also clearer at the use site.
Differential Revision: https://reviews.llvm.org/D63113
Modified:
llvm/trunk/include/llvm/DebugInfo/Symbolize/Symbolize.h
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
llvm/trunk/tools/llvm-xray/xray-account.cpp
llvm/trunk/tools/llvm-xray/xray-converter.cpp
llvm/trunk/tools/llvm-xray/xray-extract.cpp
llvm/trunk/tools/llvm-xray/xray-graph.cpp
llvm/trunk/tools/llvm-xray/xray-stacks.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/Symbolize/Symbolize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/Symbolize/Symbolize.h?rev=363024&r1=363023&r2=363024&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/Symbolize/Symbolize.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/Symbolize/Symbolize.h Mon Jun 10 19:31:54 2019
@@ -35,25 +35,17 @@ using FunctionNameKind = DILineInfoSpeci
class LLVMSymbolizer {
public:
struct Options {
- FunctionNameKind PrintFunctions;
- bool UseSymbolTable : 1;
- bool Demangle : 1;
- bool RelativeAddresses : 1;
+ FunctionNameKind PrintFunctions = FunctionNameKind::LinkageName;
+ bool UseSymbolTable = true;
+ bool Demangle = true;
+ bool RelativeAddresses = false;
std::string DefaultArch;
std::vector<std::string> DsymHints;
std::string FallbackDebugPath;
-
- Options(FunctionNameKind PrintFunctions = FunctionNameKind::LinkageName,
- bool UseSymbolTable = true, bool Demangle = true,
- bool RelativeAddresses = false, std::string DefaultArch = "",
- std::string FallbackDebugPath = "")
- : PrintFunctions(PrintFunctions), UseSymbolTable(UseSymbolTable),
- Demangle(Demangle), RelativeAddresses(RelativeAddresses),
- DefaultArch(std::move(DefaultArch)),
- FallbackDebugPath(std::move(FallbackDebugPath)) {}
};
- LLVMSymbolizer(const Options &Opts = Options()) : Opts(Opts) {}
+ LLVMSymbolizer() = default;
+ LLVMSymbolizer(const Options &Opts) : Opts(Opts) {}
~LLVMSymbolizer() {
flush();
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=363024&r1=363023&r2=363024&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Mon Jun 10 19:31:54 2019
@@ -529,9 +529,10 @@ private:
public:
SourcePrinter() = default;
SourcePrinter(const ObjectFile *Obj, StringRef DefaultArch) : Obj(Obj) {
- symbolize::LLVMSymbolizer::Options SymbolizerOpts(
- DILineInfoSpecifier::FunctionNameKind::None, true, false, false,
- DefaultArch);
+ symbolize::LLVMSymbolizer::Options SymbolizerOpts;
+ SymbolizerOpts.PrintFunctions = DILineInfoSpecifier::FunctionNameKind::None;
+ SymbolizerOpts.Demangle = false;
+ SymbolizerOpts.DefaultArch = DefaultArch;
Symbolizer.reset(new symbolize::LLVMSymbolizer(SymbolizerOpts));
}
virtual ~SourcePrinter() = default;
Modified: llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp?rev=363024&r1=363023&r2=363024&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp (original)
+++ llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp Mon Jun 10 19:31:54 2019
@@ -268,9 +268,13 @@ int main(int argc, char **argv) {
if (ClNoDemangle.getPosition() > ClDemangle.getPosition())
ClDemangle = !ClNoDemangle;
- LLVMSymbolizer::Options Opts(ClPrintFunctions, ClUseSymbolTable, ClDemangle,
- ClUseRelativeAddress, ClDefaultArch,
- ClFallbackDebugPath);
+ LLVMSymbolizer::Options Opts;
+ Opts.PrintFunctions = ClPrintFunctions;
+ Opts.UseSymbolTable = ClUseSymbolTable;
+ Opts.Demangle = ClDemangle;
+ Opts.RelativeAddresses = ClUseRelativeAddress;
+ Opts.DefaultArch = ClDefaultArch;
+ Opts.FallbackDebugPath = ClFallbackDebugPath;
for (const auto &hint : ClDsymHint) {
if (sys::path::extension(hint) == ".dSYM") {
Modified: llvm/trunk/tools/llvm-xray/xray-account.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-xray/xray-account.cpp?rev=363024&r1=363023&r2=363024&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-xray/xray-account.cpp (original)
+++ llvm/trunk/tools/llvm-xray/xray-account.cpp Mon Jun 10 19:31:54 2019
@@ -427,9 +427,7 @@ static CommandRegistration Unused(&Accou
Twine("Cannot open file '") + AccountOutput + "' for writing.", EC);
const auto &FunctionAddresses = Map.getFunctionAddresses();
- symbolize::LLVMSymbolizer::Options Opts(
- symbolize::FunctionNameKind::LinkageName, true, true, false, "");
- symbolize::LLVMSymbolizer Symbolizer(Opts);
+ symbolize::LLVMSymbolizer Symbolizer;
llvm::xray::FuncIdConversionHelper FuncIdHelper(AccountInstrMap, Symbolizer,
FunctionAddresses);
xray::LatencyAccountant FCA(FuncIdHelper, AccountDeduceSiblingCalls);
Modified: llvm/trunk/tools/llvm-xray/xray-converter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-xray/xray-converter.cpp?rev=363024&r1=363023&r2=363024&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-xray/xray-converter.cpp (original)
+++ llvm/trunk/tools/llvm-xray/xray-converter.cpp Mon Jun 10 19:31:54 2019
@@ -380,9 +380,7 @@ static CommandRegistration Unused(&Conve
}
const auto &FunctionAddresses = Map.getFunctionAddresses();
- symbolize::LLVMSymbolizer::Options Opts(
- symbolize::FunctionNameKind::LinkageName, true, true, false, "");
- symbolize::LLVMSymbolizer Symbolizer(Opts);
+ symbolize::LLVMSymbolizer Symbolizer;
llvm::xray::FuncIdConversionHelper FuncIdHelper(ConvertInstrMap, Symbolizer,
FunctionAddresses);
llvm::xray::TraceConverter TC(FuncIdHelper, ConvertSymbolize);
Modified: llvm/trunk/tools/llvm-xray/xray-extract.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-xray/xray-extract.cpp?rev=363024&r1=363023&r2=363024&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-xray/xray-extract.cpp (original)
+++ llvm/trunk/tools/llvm-xray/xray-extract.cpp Mon Jun 10 19:31:54 2019
@@ -86,9 +86,7 @@ static CommandRegistration Unused(&Extra
Twine("Cannot open file '") + ExtractOutput + "' for writing.", EC);
const auto &FunctionAddresses =
InstrumentationMapOrError->getFunctionAddresses();
- symbolize::LLVMSymbolizer::Options Opts(
- symbolize::FunctionNameKind::LinkageName, true, true, false, "");
- symbolize::LLVMSymbolizer Symbolizer(Opts);
+ symbolize::LLVMSymbolizer Symbolizer;
llvm::xray::FuncIdConversionHelper FuncIdHelper(ExtractInput, Symbolizer,
FunctionAddresses);
exportAsYAML(*InstrumentationMapOrError, OS, FuncIdHelper);
Modified: llvm/trunk/tools/llvm-xray/xray-graph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-xray/xray-graph.cpp?rev=363024&r1=363023&r2=363024&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-xray/xray-graph.cpp (original)
+++ llvm/trunk/tools/llvm-xray/xray-graph.cpp Mon Jun 10 19:31:54 2019
@@ -436,9 +436,7 @@ Expected<GraphRenderer> GraphRenderer::F
const auto &FunctionAddresses = Map.getFunctionAddresses();
- symbolize::LLVMSymbolizer::Options Opts(
- symbolize::FunctionNameKind::LinkageName, true, true, false, "");
- symbolize::LLVMSymbolizer Symbolizer(Opts);
+ symbolize::LLVMSymbolizer Symbolizer;
const auto &Header = Trace.getFileHeader();
llvm::xray::FuncIdConversionHelper FuncIdHelper(InstrMap, Symbolizer,
Modified: llvm/trunk/tools/llvm-xray/xray-stacks.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-xray/xray-stacks.cpp?rev=363024&r1=363023&r2=363024&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-xray/xray-stacks.cpp (original)
+++ llvm/trunk/tools/llvm-xray/xray-stacks.cpp Mon Jun 10 19:31:54 2019
@@ -720,9 +720,7 @@ static CommandRegistration Unused(&Stack
"-all-stacks."),
std::make_error_code(std::errc::invalid_argument));
- symbolize::LLVMSymbolizer::Options Opts(
- symbolize::FunctionNameKind::LinkageName, true, true, false, "");
- symbolize::LLVMSymbolizer Symbolizer(Opts);
+ symbolize::LLVMSymbolizer Symbolizer;
FuncIdConversionHelper FuncIdHelper(StacksInstrMap, Symbolizer,
Map.getFunctionAddresses());
// TODO: Someday, support output to files instead of just directly to
More information about the llvm-commits
mailing list