Skip to content

Commit ffe5466

Browse files
committed
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
1 parent 92002bd commit ffe5466

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace gsym {
3333
struct FunctionInfo {
3434
AddressRange Range;
3535
uint32_t Name; ///< String table offset in the string table.
36-
llvm::Optional<LineTable> LineTable;
36+
llvm::Optional<LineTable> OptLineTable;
3737
llvm::Optional<InlineInfo> Inline;
3838

3939
FunctionInfo(uint64_t Addr = 0, uint64_t Size = 0, uint32_t N = 0)
@@ -44,7 +44,7 @@ struct FunctionInfo {
4444
/// converting information from a symbol table and from debug info, we
4545
/// might end up with multiple FunctionInfo objects for the same range
4646
/// and we need to be able to tell which one is the better object to use.
47-
return LineTable.hasValue() || Inline.hasValue();
47+
return OptLineTable.hasValue() || Inline.hasValue();
4848
}
4949

5050
bool isValid() const {
@@ -66,14 +66,14 @@ struct FunctionInfo {
6666
void clear() {
6767
Range = {0, 0};
6868
Name = 0;
69-
LineTable = llvm::None;
70-
Inline = llvm::None;
69+
OptLineTable = None;
70+
Inline = None;
7171
}
7272
};
7373

7474
inline bool operator==(const FunctionInfo &LHS, const FunctionInfo &RHS) {
7575
return LHS.Range == RHS.Range && LHS.Name == RHS.Name &&
76-
LHS.LineTable == RHS.LineTable && LHS.Inline == RHS.Inline;
76+
LHS.OptLineTable == RHS.OptLineTable && LHS.Inline == RHS.Inline;
7777
}
7878
inline bool operator!=(const FunctionInfo &LHS, const FunctionInfo &RHS) {
7979
return !(LHS == RHS);
@@ -92,7 +92,7 @@ inline bool operator<(const FunctionInfo &LHS, const FunctionInfo &RHS) {
9292
if (LHS.Inline.hasValue() != RHS.Inline.hasValue())
9393
return RHS.Inline.hasValue();
9494

95-
return LHS.LineTable < RHS.LineTable;
95+
return LHS.OptLineTable < RHS.OptLineTable;
9696
}
9797

9898
raw_ostream &operator<<(raw_ostream &OS, const FunctionInfo &R);

llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ using namespace gsym;
1414

1515
raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const FunctionInfo &FI) {
1616
OS << '[' << HEX64(FI.Range.Start) << '-' << HEX64(FI.Range.End) << "): "
17-
<< "Name=" << HEX32(FI.Name) << '\n' << FI.LineTable << FI.Inline;
17+
<< "Name=" << HEX32(FI.Name) << '\n' << FI.OptLineTable << FI.Inline;
1818
return OS;
1919
}

llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ TEST(GSYMTest, TestFunctionInfo) {
7474
EXPECT_EQ(FI.size(), Size);
7575
const uint32_t FileIdx = 1;
7676
const uint32_t Line = 12;
77-
FI.LineTable = LineTable();
78-
FI.LineTable->push(LineEntry(StartAddr,FileIdx,Line));
77+
FI.OptLineTable = LineTable();
78+
FI.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line));
7979
EXPECT_TRUE(FI.hasRichInfo());
8080
FI.clear();
8181
EXPECT_FALSE(FI.isValid());
@@ -110,8 +110,8 @@ TEST(GSYMTest, TestFunctionInfo) {
110110
// best version of a function info.
111111
FunctionInfo FISymtab(StartAddr, Size, NameOffset);
112112
FunctionInfo FIWithLines(StartAddr, Size, NameOffset);
113-
FIWithLines.LineTable = LineTable();
114-
FIWithLines.LineTable->push(LineEntry(StartAddr,FileIdx,Line));
113+
FIWithLines.OptLineTable = LineTable();
114+
FIWithLines.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line));
115115
// Test that a FunctionInfo with just a name and size is less than one
116116
// that has name, size and any number of line table entries
117117
EXPECT_LT(FISymtab, FIWithLines);
@@ -127,13 +127,13 @@ TEST(GSYMTest, TestFunctionInfo) {
127127
// Test if we have an entry with lines and one with more lines for the same
128128
// range, the ones with more lines is greater than the one with less.
129129
FunctionInfo FIWithMoreLines = FIWithLines;
130-
FIWithMoreLines.LineTable->push(LineEntry(StartAddr,FileIdx,Line+5));
130+
FIWithMoreLines.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line+5));
131131
EXPECT_LT(FIWithLines, FIWithMoreLines);
132132

133133
// Test that if we have the same number of lines we compare the line entries
134-
// in the FunctionInfo.LineTable.Lines vector.
134+
// in the FunctionInfo.OptLineTable.Lines vector.
135135
FunctionInfo FIWithLinesWithHigherAddress = FIWithLines;
136-
FIWithLinesWithHigherAddress.LineTable->get(0).Addr += 0x10;
136+
FIWithLinesWithHigherAddress.OptLineTable->get(0).Addr += 0x10;
137137
EXPECT_LT(FIWithLines, FIWithLinesWithHigherAddress);
138138
}
139139

0 commit comments

Comments
 (0)