From d4960d7c984d92601d2326c182ee704571608b2e Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Wed, 14 Jul 2021 08:21:16 +0000 Subject: [PATCH] Reformat files. Differential Revision: https://reviews.llvm.org/D105982 --- include/llvm/DebugInfo/DIContext.h | 27 ++++++-------------- include/llvm/DebugInfo/GSYM/LookupResult.h | 18 ++++++------- include/llvm/DebugInfo/Symbolize/Symbolize.h | 13 ++++------ lib/DebugInfo/Symbolize/Symbolize.cpp | 24 +++++++++-------- 4 files changed, 34 insertions(+), 48 deletions(-) diff --git a/include/llvm/DebugInfo/DIContext.h b/include/llvm/DebugInfo/DIContext.h index fd225c3c10d..d029556c9d8 100644 --- a/include/llvm/DebugInfo/DIContext.h +++ b/include/llvm/DebugInfo/DIContext.h @@ -56,9 +56,7 @@ struct DILineInfo { Discriminator == RHS.Discriminator; } - bool operator!=(const DILineInfo &RHS) const { - return !(*this == RHS); - } + bool operator!=(const DILineInfo &RHS) const { return !(*this == RHS); } bool operator<(const DILineInfo &RHS) const { return std::tie(FileName, FunctionName, StartFileName, Line, Column, @@ -92,7 +90,7 @@ class DIInliningInfo { public: DIInliningInfo() = default; - const DILineInfo & getFrame(unsigned Index) const { + const DILineInfo &getFrame(unsigned Index) const { assert(Index < Frames.size()); return Frames[Index]; } @@ -102,17 +100,11 @@ public: return &Frames[Index]; } - uint32_t getNumberOfFrames() const { - return Frames.size(); - } + uint32_t getNumberOfFrames() const { return Frames.size(); } - void addFrame(const DILineInfo &Frame) { - Frames.push_back(Frame); - } + void addFrame(const DILineInfo &Frame) { Frames.push_back(Frame); } - void resize(unsigned i) { - Frames.resize(i); - } + void resize(unsigned i) { Frames.resize(i); } }; /// Container for description of a global variable. @@ -175,7 +167,7 @@ static_assert(DIDT_ID_Count <= 32, "section types overflow storage"); /// Selects which debug sections get dumped. enum DIDumpType : unsigned { DIDT_Null, - DIDT_All = ~0U, + DIDT_All = ~0U, #define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME, OPTION) \ DIDT_##ENUM_NAME = 1U << DIDT_ID_##ENUM_NAME, #include "llvm/BinaryFormat/Dwarf.def" @@ -224,10 +216,7 @@ struct DIDumpOptions { class DIContext { public: - enum DIContextKind { - CK_DWARF, - CK_PDB - }; + enum DIContextKind { CK_DWARF, CK_PDB }; DIContext(DIContextKind K) : Kind(K) {} virtual ~DIContext() = default; @@ -311,7 +300,7 @@ protected: public: template - LoadedObjectInfoHelper(Ts &&... Args) : Base(std::forward(Args)...) {} + LoadedObjectInfoHelper(Ts &&...Args) : Base(std::forward(Args)...) {} std::unique_ptr clone() const override { return std::make_unique(static_cast(*this)); diff --git a/include/llvm/DebugInfo/GSYM/LookupResult.h b/include/llvm/DebugInfo/GSYM/LookupResult.h index 79ef7b22111..211a352595f 100644 --- a/include/llvm/DebugInfo/GSYM/LookupResult.h +++ b/include/llvm/DebugInfo/GSYM/LookupResult.h @@ -9,8 +9,8 @@ #ifndef LLVM_DEBUGINFO_GSYM_LOOKUPRESULT_H #define LLVM_DEBUGINFO_GSYM_LOOKUPRESULT_H -#include "llvm/DebugInfo/GSYM/Range.h" #include "llvm/ADT/StringRef.h" +#include "llvm/DebugInfo/GSYM/Range.h" #include #include @@ -20,27 +20,25 @@ namespace gsym { struct FileEntry; struct SourceLocation { - StringRef Name; ///< Function or symbol name. - StringRef Dir; ///< Line entry source file directory path. - StringRef Base; ///< Line entry source file basename. - uint32_t Line = 0; ///< Source file line number. + StringRef Name; ///< Function or symbol name. + StringRef Dir; ///< Line entry source file directory path. + StringRef Base; ///< Line entry source file basename. + uint32_t Line = 0; ///< Source file line number. uint32_t Offset = 0; ///< Byte size offset within the named function. }; inline bool operator==(const SourceLocation &LHS, const SourceLocation &RHS) { - return LHS.Name == RHS.Name && LHS.Dir == RHS.Dir && - LHS.Base == RHS.Base && LHS.Line == RHS.Line && - LHS.Offset == RHS.Offset; + return LHS.Name == RHS.Name && LHS.Dir == RHS.Dir && LHS.Base == RHS.Base && + LHS.Line == RHS.Line && LHS.Offset == RHS.Offset; } raw_ostream &operator<<(raw_ostream &OS, const SourceLocation &R); using SourceLocations = std::vector; - struct LookupResult { uint64_t LookupAddr = 0; ///< The address that this lookup pertains to. - AddressRange FuncRange; ///< The concrete function address range. + AddressRange FuncRange; ///< The concrete function address range. StringRef FuncName; ///< The concrete function name that contains LookupAddr. /// The source locations that match this address. This information will only /// be filled in if the FunctionInfo contains a line table. If an address is diff --git a/include/llvm/DebugInfo/Symbolize/Symbolize.h b/include/llvm/DebugInfo/Symbolize/Symbolize.h index baff2fa7248..4ec333422c4 100644 --- a/include/llvm/DebugInfo/Symbolize/Symbolize.h +++ b/include/llvm/DebugInfo/Symbolize/Symbolize.h @@ -15,8 +15,8 @@ #include "llvm/DebugInfo/Symbolize/SymbolizableModule.h" #include "llvm/Object/Binary.h" -#include "llvm/Object/ObjectFile.h" #include "llvm/Object/ELFObjectFile.h" +#include "llvm/Object/ObjectFile.h" #include "llvm/Support/Error.h" #include #include @@ -54,9 +54,7 @@ public: LLVMSymbolizer() = default; LLVMSymbolizer(const Options &Opts) : Opts(Opts) {} - ~LLVMSymbolizer() { - flush(); - } + ~LLVMSymbolizer() { flush(); } // Overloads accepting ObjectFile does not support COFF currently Expected symbolizeCode(const ObjectFile &Obj, @@ -115,8 +113,7 @@ private: Expected getOrCreateModuleInfo(const ObjectFile &Obj); Expected - createModuleInfo(const ObjectFile *Obj, - std::unique_ptr Context, + createModuleInfo(const ObjectFile *Obj, std::unique_ptr Context, StringRef ModuleName); ObjectFile *lookUpDsymFile(const std::string &Path, @@ -131,13 +128,13 @@ private: /// Returns pair of pointers to object and debug object. Expected getOrCreateObjectPair(const std::string &Path, - const std::string &ArchName); + const std::string &ArchName); /// Return a pointer to object file at specified path, for a specified /// architecture (e.g. if path refers to a Mach-O universal binary, only one /// object file from it will be returned). Expected getOrCreateObject(const std::string &Path, - const std::string &ArchName); + const std::string &ArchName); std::map, std::less<>> Modules; diff --git a/lib/DebugInfo/Symbolize/Symbolize.cpp b/lib/DebugInfo/Symbolize/Symbolize.cpp index 33a25010d13..72ca7223050 100644 --- a/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -210,8 +210,8 @@ namespace { // /path/to/foo.dSYM/Contents/Resources/DWARF/foo. // For Path="/path/to/bar.dSYM" and Basename="foo" assume that debug info is in // /path/to/bar.dSYM/Contents/Resources/DWARF/foo. -std::string getDarwinDWARFResourceForPath( - const std::string &Path, const std::string &Basename) { +std::string getDarwinDWARFResourceForPath(const std::string &Path, + const std::string &Basename) { SmallString<16> ResourceName = StringRef(Path); if (sys::path::extension(Path) != ".dSYM") { ResourceName += ".dSYM"; @@ -330,7 +330,8 @@ Optional> getBuildID(const ELFFile &Obj) { continue; Error Err = Error::success(); for (auto N : Obj.notes(P, Err)) - if (N.getType() == ELF::NT_GNU_BUILD_ID && N.getName() == ELF::ELF_NOTE_GNU) + if (N.getType() == ELF::NT_GNU_BUILD_ID && + N.getName() == ELF::ELF_NOTE_GNU) return N.getDesc(); consumeError(std::move(Err)); } @@ -353,8 +354,7 @@ Optional> getBuildID(const ELFObjectFileBase *Obj) { } bool findDebugBinary(const std::vector &DebugFileDirectory, - const ArrayRef BuildID, - std::string &Result) { + const ArrayRef BuildID, std::string &Result) { auto getDebugPath = [&](StringRef Directory) { SmallString<128> Path{Directory}; sys::path::append(Path, ".build-id", @@ -366,11 +366,11 @@ bool findDebugBinary(const std::vector &DebugFileDirectory, if (DebugFileDirectory.empty()) { SmallString<128> Path = getDebugPath( #if defined(__NetBSD__) - // Try /usr/libdata/debug/.build-id/../... - "/usr/libdata/debug" + // Try /usr/libdata/debug/.build-id/../... + "/usr/libdata/debug" #else - // Try /usr/lib/debug/.build-id/../... - "/usr/lib/debug" + // Try /usr/lib/debug/.build-id/../... + "/usr/lib/debug" #endif ); if (llvm::sys::fs::exists(Path)) { @@ -393,7 +393,8 @@ bool findDebugBinary(const std::vector &DebugFileDirectory, } // end anonymous namespace ObjectFile *LLVMSymbolizer::lookUpDsymFile(const std::string &ExePath, - const MachOObjectFile *MachExeObj, const std::string &ArchName) { + const MachOObjectFile *MachExeObj, + const std::string &ArchName) { // On Darwin we may find DWARF in separate object file in // resource directory. std::vector DsymPaths; @@ -653,7 +654,8 @@ LLVMSymbolizer::DemangleName(const std::string &Name, // approach to check if the name should be demangled. if (Name.substr(0, 2) == "_Z") { int status = 0; - char *DemangledName = itaniumDemangle(Name.c_str(), nullptr, nullptr, &status); + char *DemangledName = + itaniumDemangle(Name.c_str(), nullptr, nullptr, &status); if (status != 0) return Name; std::string Result = DemangledName;