1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +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 {
AddressRange Range;
uint32_t Name; ///< String table offset in the string table.
llvm::Optional<LineTable> LineTable;
llvm::Optional<LineTable> OptLineTable;
llvm::Optional<InlineInfo> Inline;
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
/// 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.
return LineTable.hasValue() || Inline.hasValue();
return OptLineTable.hasValue() || Inline.hasValue();
}
bool isValid() const {
@ -66,14 +66,14 @@ struct FunctionInfo {
void clear() {
Range = {0, 0};
Name = 0;
LineTable = llvm::None;
Inline = llvm::None;
OptLineTable = None;
Inline = None;
}
};
inline bool operator==(const FunctionInfo &LHS, const FunctionInfo &RHS) {
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) {
return !(LHS == RHS);
@ -92,7 +92,7 @@ inline bool operator<(const FunctionInfo &LHS, const FunctionInfo &RHS) {
if (LHS.Inline.hasValue() != 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);

View File

@ -14,6 +14,6 @@ using namespace gsym;
raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const FunctionInfo &FI) {
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;
}

View File

@ -74,8 +74,8 @@ TEST(GSYMTest, TestFunctionInfo) {
EXPECT_EQ(FI.size(), Size);
const uint32_t FileIdx = 1;
const uint32_t Line = 12;
FI.LineTable = LineTable();
FI.LineTable->push(LineEntry(StartAddr,FileIdx,Line));
FI.OptLineTable = LineTable();
FI.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line));
EXPECT_TRUE(FI.hasRichInfo());
FI.clear();
EXPECT_FALSE(FI.isValid());
@ -110,8 +110,8 @@ TEST(GSYMTest, TestFunctionInfo) {
// best version of a function info.
FunctionInfo FISymtab(StartAddr, Size, NameOffset);
FunctionInfo FIWithLines(StartAddr, Size, NameOffset);
FIWithLines.LineTable = LineTable();
FIWithLines.LineTable->push(LineEntry(StartAddr,FileIdx,Line));
FIWithLines.OptLineTable = LineTable();
FIWithLines.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line));
// 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
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
// range, the ones with more lines is greater than the one with less.
FunctionInfo FIWithMoreLines = FIWithLines;
FIWithMoreLines.LineTable->push(LineEntry(StartAddr,FileIdx,Line+5));
FIWithMoreLines.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line+5));
EXPECT_LT(FIWithLines, FIWithMoreLines);
// 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;
FIWithLinesWithHigherAddress.LineTable->get(0).Addr += 0x10;
FIWithLinesWithHigherAddress.OptLineTable->get(0).Addr += 0x10;
EXPECT_LT(FIWithLines, FIWithLinesWithHigherAddress);
}