diff --git a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h --- a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h +++ b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h @@ -35,25 +35,17 @@ 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 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(); diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -524,9 +524,10 @@ 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; diff --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp --- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp +++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp @@ -268,9 +268,13 @@ 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") { diff --git a/llvm/tools/llvm-xray/xray-account.cpp b/llvm/tools/llvm-xray/xray-account.cpp --- a/llvm/tools/llvm-xray/xray-account.cpp +++ b/llvm/tools/llvm-xray/xray-account.cpp @@ -427,9 +427,7 @@ 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); diff --git a/llvm/tools/llvm-xray/xray-converter.cpp b/llvm/tools/llvm-xray/xray-converter.cpp --- a/llvm/tools/llvm-xray/xray-converter.cpp +++ b/llvm/tools/llvm-xray/xray-converter.cpp @@ -380,9 +380,7 @@ } 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); diff --git a/llvm/tools/llvm-xray/xray-extract.cpp b/llvm/tools/llvm-xray/xray-extract.cpp --- a/llvm/tools/llvm-xray/xray-extract.cpp +++ b/llvm/tools/llvm-xray/xray-extract.cpp @@ -86,9 +86,7 @@ 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); diff --git a/llvm/tools/llvm-xray/xray-graph.cpp b/llvm/tools/llvm-xray/xray-graph.cpp --- a/llvm/tools/llvm-xray/xray-graph.cpp +++ b/llvm/tools/llvm-xray/xray-graph.cpp @@ -436,9 +436,7 @@ 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, diff --git a/llvm/tools/llvm-xray/xray-stacks.cpp b/llvm/tools/llvm-xray/xray-stacks.cpp --- a/llvm/tools/llvm-xray/xray-stacks.cpp +++ b/llvm/tools/llvm-xray/xray-stacks.cpp @@ -720,9 +720,7 @@ "-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