1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 10:32:48 +02:00

Reformat files.

Differential Revision: https://reviews.llvm.org/D105982
This commit is contained in:
Simon Giesecke 2021-07-14 08:21:16 +00:00
parent 7d809bb14e
commit d4960d7c98
4 changed files with 34 additions and 48 deletions

View File

@ -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 <typename... Ts>
LoadedObjectInfoHelper(Ts &&... Args) : Base(std::forward<Ts>(Args)...) {}
LoadedObjectInfoHelper(Ts &&...Args) : Base(std::forward<Ts>(Args)...) {}
std::unique_ptr<llvm::LoadedObjectInfo> clone() const override {
return std::make_unique<Derived>(static_cast<const Derived &>(*this));

View File

@ -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 <inttypes.h>
#include <vector>
@ -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<SourceLocation>;
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

View File

@ -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 <algorithm>
#include <cstdint>
@ -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<DILineInfo> symbolizeCode(const ObjectFile &Obj,
@ -115,8 +113,7 @@ private:
Expected<SymbolizableModule *> getOrCreateModuleInfo(const ObjectFile &Obj);
Expected<SymbolizableModule *>
createModuleInfo(const ObjectFile *Obj,
std::unique_ptr<DIContext> Context,
createModuleInfo(const ObjectFile *Obj, std::unique_ptr<DIContext> Context,
StringRef ModuleName);
ObjectFile *lookUpDsymFile(const std::string &Path,
@ -131,13 +128,13 @@ private:
/// Returns pair of pointers to object and debug object.
Expected<ObjectPair> 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<ObjectFile *> getOrCreateObject(const std::string &Path,
const std::string &ArchName);
const std::string &ArchName);
std::map<std::string, std::unique_ptr<SymbolizableModule>, std::less<>>
Modules;

View File

@ -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<ArrayRef<uint8_t>> getBuildID(const ELFFile<ELFT> &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<ArrayRef<uint8_t>> getBuildID(const ELFObjectFileBase *Obj) {
}
bool findDebugBinary(const std::vector<std::string> &DebugFileDirectory,
const ArrayRef<uint8_t> BuildID,
std::string &Result) {
const ArrayRef<uint8_t> 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<std::string> &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<std::string> &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<std::string> 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;