From ffe5466c791ea81f7703f047644642698a37840b Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 11 Sep 2019 22:24:45 +0000 Subject: [PATCH] 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 --- llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h | 12 ++++++------ llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp | 2 +- llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h b/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h index 419ee27..3a72b11 100644 --- a/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h +++ b/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h @@ -33,7 +33,7 @@ namespace gsym { struct FunctionInfo { AddressRange Range; uint32_t Name; ///< String table offset in the string table. - llvm::Optional LineTable; + llvm::Optional OptLineTable; llvm::Optional 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); diff --git a/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp b/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp index 19cfa40..5b8b7ea 100644 --- a/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp +++ b/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp @@ -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; } diff --git a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp index f20ccb7..203c12a 100644 --- a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp +++ b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp @@ -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); } -- 2.7.4