1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

Add some missing changes to GSYM that was addressing a gcc compilation error due to a type and variable with the same name

llvm-svn: 371681
This commit is contained in:
David Blaikie 2019-09-11 22:24:45 +00:00
parent 7ede137a02
commit 4e82e0a032
3 changed files with 14 additions and 14 deletions

View File

@ -33,7 +33,7 @@ namespace gsym {
struct FunctionInfo { struct FunctionInfo {
AddressRange Range; AddressRange Range;
uint32_t Name; ///< String table offset in the string table. uint32_t Name; ///< String table offset in the string table.
llvm::Optional<LineTable> LineTable; llvm::Optional<LineTable> OptLineTable;
llvm::Optional<InlineInfo> Inline; llvm::Optional<InlineInfo> Inline;
FunctionInfo(uint64_t Addr = 0, uint64_t Size = 0, uint32_t N = 0) FunctionInfo(uint64_t Addr = 0, uint64_t Size = 0, uint32_t N = 0)
@ -44,7 +44,7 @@ struct FunctionInfo {
/// converting information from a symbol table and from debug info, we /// converting information from a symbol table and from debug info, we
/// might end up with multiple FunctionInfo objects for the same range /// might end up with multiple FunctionInfo objects for the same range
/// and we need to be able to tell which one is the better object to use. /// and we need to be able to tell which one is the better object to use.
return LineTable.hasValue() || Inline.hasValue(); return OptLineTable.hasValue() || Inline.hasValue();
} }
bool isValid() const { bool isValid() const {
@ -66,14 +66,14 @@ struct FunctionInfo {
void clear() { void clear() {
Range = {0, 0}; Range = {0, 0};
Name = 0; Name = 0;
LineTable = llvm::None; OptLineTable = None;
Inline = llvm::None; Inline = None;
} }
}; };
inline bool operator==(const FunctionInfo &LHS, const FunctionInfo &RHS) { inline bool operator==(const FunctionInfo &LHS, const FunctionInfo &RHS) {
return LHS.Range == RHS.Range && LHS.Name == RHS.Name && return LHS.Range == RHS.Range && LHS.Name == RHS.Name &&
LHS.LineTable == RHS.LineTable && LHS.Inline == RHS.Inline; LHS.OptLineTable == RHS.OptLineTable && LHS.Inline == RHS.Inline;
} }
inline bool operator!=(const FunctionInfo &LHS, const FunctionInfo &RHS) { inline bool operator!=(const FunctionInfo &LHS, const FunctionInfo &RHS) {
return !(LHS == RHS); return !(LHS == RHS);
@ -92,7 +92,7 @@ inline bool operator<(const FunctionInfo &LHS, const FunctionInfo &RHS) {
if (LHS.Inline.hasValue() != RHS.Inline.hasValue()) if (LHS.Inline.hasValue() != RHS.Inline.hasValue())
return RHS.Inline.hasValue(); return RHS.Inline.hasValue();
return LHS.LineTable < RHS.LineTable; return LHS.OptLineTable < RHS.OptLineTable;
} }
raw_ostream &operator<<(raw_ostream &OS, const FunctionInfo &R); raw_ostream &operator<<(raw_ostream &OS, const FunctionInfo &R);

View File

@ -14,6 +14,6 @@ using namespace gsym;
raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const FunctionInfo &FI) { raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const FunctionInfo &FI) {
OS << '[' << HEX64(FI.Range.Start) << '-' << HEX64(FI.Range.End) << "): " OS << '[' << HEX64(FI.Range.Start) << '-' << HEX64(FI.Range.End) << "): "
<< "Name=" << HEX32(FI.Name) << '\n' << FI.LineTable << FI.Inline; << "Name=" << HEX32(FI.Name) << '\n' << FI.OptLineTable << FI.Inline;
return OS; return OS;
} }

View File

@ -74,8 +74,8 @@ TEST(GSYMTest, TestFunctionInfo) {
EXPECT_EQ(FI.size(), Size); EXPECT_EQ(FI.size(), Size);
const uint32_t FileIdx = 1; const uint32_t FileIdx = 1;
const uint32_t Line = 12; const uint32_t Line = 12;
FI.LineTable = LineTable(); FI.OptLineTable = LineTable();
FI.LineTable->push(LineEntry(StartAddr,FileIdx,Line)); FI.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line));
EXPECT_TRUE(FI.hasRichInfo()); EXPECT_TRUE(FI.hasRichInfo());
FI.clear(); FI.clear();
EXPECT_FALSE(FI.isValid()); EXPECT_FALSE(FI.isValid());
@ -110,8 +110,8 @@ TEST(GSYMTest, TestFunctionInfo) {
// best version of a function info. // best version of a function info.
FunctionInfo FISymtab(StartAddr, Size, NameOffset); FunctionInfo FISymtab(StartAddr, Size, NameOffset);
FunctionInfo FIWithLines(StartAddr, Size, NameOffset); FunctionInfo FIWithLines(StartAddr, Size, NameOffset);
FIWithLines.LineTable = LineTable(); FIWithLines.OptLineTable = LineTable();
FIWithLines.LineTable->push(LineEntry(StartAddr,FileIdx,Line)); FIWithLines.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line));
// Test that a FunctionInfo with just a name and size is less than one // Test that a FunctionInfo with just a name and size is less than one
// that has name, size and any number of line table entries // that has name, size and any number of line table entries
EXPECT_LT(FISymtab, FIWithLines); EXPECT_LT(FISymtab, FIWithLines);
@ -127,13 +127,13 @@ TEST(GSYMTest, TestFunctionInfo) {
// Test if we have an entry with lines and one with more lines for the same // Test if we have an entry with lines and one with more lines for the same
// range, the ones with more lines is greater than the one with less. // range, the ones with more lines is greater than the one with less.
FunctionInfo FIWithMoreLines = FIWithLines; FunctionInfo FIWithMoreLines = FIWithLines;
FIWithMoreLines.LineTable->push(LineEntry(StartAddr,FileIdx,Line+5)); FIWithMoreLines.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line+5));
EXPECT_LT(FIWithLines, FIWithMoreLines); EXPECT_LT(FIWithLines, FIWithMoreLines);
// Test that if we have the same number of lines we compare the line entries // Test that if we have the same number of lines we compare the line entries
// in the FunctionInfo.LineTable.Lines vector. // in the FunctionInfo.OptLineTable.Lines vector.
FunctionInfo FIWithLinesWithHigherAddress = FIWithLines; FunctionInfo FIWithLinesWithHigherAddress = FIWithLines;
FIWithLinesWithHigherAddress.LineTable->get(0).Addr += 0x10; FIWithLinesWithHigherAddress.OptLineTable->get(0).Addr += 0x10;
EXPECT_LT(FIWithLines, FIWithLinesWithHigherAddress); EXPECT_LT(FIWithLines, FIWithLinesWithHigherAddress);
} }