EXPECT_EQ(FI, Decoded.get());
}
-
-TEST(GSYMTest, TestFunctionInfoEncoding) {
- constexpr uint64_t FuncAddr = 0x1000;
- constexpr uint64_t FuncSize = 0x100;
- constexpr uint32_t FuncName = 1;
- constexpr uint32_t FileIdx = 1;
- // Make sure that we can encode and decode a FunctionInfo with no line table
- // or inline info.
- FunctionInfo FI(FuncAddr, FuncSize, FuncName);
- TestFunctionInfoEncodeDecode(llvm::support::little, FI);
- TestFunctionInfoEncodeDecode(llvm::support::big, FI);
-
- auto AddLinesLambda = [FuncAddr, FileIdx](FunctionInfo &FI) {
+static void AddLines(uint64_t FuncAddr, uint32_t FileIdx, FunctionInfo &FI) {
FI.OptLineTable = LineTable();
LineEntry Line0(FuncAddr + 0x000, FileIdx, 10);
LineEntry Line1(FuncAddr + 0x010, FileIdx, 11);
FI.OptLineTable->push(Line0);
FI.OptLineTable->push(Line1);
FI.OptLineTable->push(Line2);
- };
+}
- auto AddInlineLambda = [FuncAddr, FuncSize](FunctionInfo &FI) {
+
+static void AddInline(uint64_t FuncAddr, uint64_t FuncSize, FunctionInfo &FI) {
FI.Inline = InlineInfo();
FI.Inline->Ranges.insert(AddressRange(FuncAddr, FuncAddr + FuncSize));
InlineInfo Inline1;
Inline1.CallFile = 1;
Inline1.CallLine = 11;
FI.Inline->Children.push_back(Inline1);
- };
+}
+
+TEST(GSYMTest, TestFunctionInfoEncoding) {
+ constexpr uint64_t FuncAddr = 0x1000;
+ constexpr uint64_t FuncSize = 0x100;
+ constexpr uint32_t FuncName = 1;
+ constexpr uint32_t FileIdx = 1;
+ // Make sure that we can encode and decode a FunctionInfo with no line table
+ // or inline info.
+ FunctionInfo FI(FuncAddr, FuncSize, FuncName);
+ TestFunctionInfoEncodeDecode(llvm::support::little, FI);
+ TestFunctionInfoEncodeDecode(llvm::support::big, FI);
// Make sure that we can encode and decode a FunctionInfo with a line table
// and no inline info.
FunctionInfo FILines(FuncAddr, FuncSize, FuncName);
- AddLinesLambda(FILines);
+ AddLines(FuncAddr, FileIdx, FILines);
TestFunctionInfoEncodeDecode(llvm::support::little, FILines);
TestFunctionInfoEncodeDecode(llvm::support::big, FILines);
// Make sure that we can encode and decode a FunctionInfo with no line table
// and with inline info.
FunctionInfo FIInline(FuncAddr, FuncSize, FuncName);
- AddInlineLambda(FIInline);
+ AddInline(FuncAddr, FuncSize, FIInline);
TestFunctionInfoEncodeDecode(llvm::support::little, FIInline);
TestFunctionInfoEncodeDecode(llvm::support::big, FIInline);
// Make sure that we can encode and decode a FunctionInfo with no line table
// and with inline info.
FunctionInfo FIBoth(FuncAddr, FuncSize, FuncName);
- AddLinesLambda(FIBoth);
- AddInlineLambda(FIBoth);
+ AddLines(FuncAddr, FileIdx, FIBoth);
+ AddInline(FuncAddr, FuncSize, FIBoth);
TestFunctionInfoEncodeDecode(llvm::support::little, FIBoth);
TestFunctionInfoEncodeDecode(llvm::support::big, FIBoth);
}