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)
/// 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 {
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);
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);
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());
// 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);
// 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);
}