[llvm] r371681 - Add some missing changes to GSYM that was addressing a gcc compilation error due to a type and variable with the same name
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 15:24:46 PDT 2019
Author: dblaikie
Date: Wed Sep 11 15:24:45 2019
New Revision: 371681
URL: http://llvm.org/viewvc/llvm-project?rev=371681&view=rev
Log:
Add some missing changes to GSYM that was addressing a gcc compilation error due to a type and variable with the same name
Modified:
llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h
llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp
llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h?rev=371681&r1=371680&r2=371681&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h Wed Sep 11 15:24:45 2019
@@ -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
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);
Modified: llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp?rev=371681&r1=371680&r2=371681&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp (original)
+++ llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp Wed Sep 11 15:24:45 2019
@@ -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;
}
Modified: llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp?rev=371681&r1=371680&r2=371681&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp Wed Sep 11 15:24:45 2019
@@ -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);
}
More information about the llvm-commits
mailing list