From: Greg Clayton Date: Tue, 17 Sep 2019 20:31:01 +0000 (+0000) Subject: Fix buildbots. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=44810bc17f5a0ba28eb219ebd215ed6d1a0d3c24;p=llvm Fix buildbots. MSVC doesn't correctly capture constexpr in lambdas, and other builds warn if you do, others will error out if you do. Avoid lambdas. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372179 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/unittests/DebugInfo/GSYM/GSYMTest.cpp b/unittests/DebugInfo/GSYM/GSYMTest.cpp index ba543e02735..421544ee1d4 100644 --- a/unittests/DebugInfo/GSYM/GSYMTest.cpp +++ b/unittests/DebugInfo/GSYM/GSYMTest.cpp @@ -255,19 +255,7 @@ static void TestFunctionInfoEncodeDecode(llvm::support::endianness ByteOrder, 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); @@ -275,9 +263,10 @@ TEST(GSYMTest, TestFunctionInfoEncoding) { 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; @@ -286,27 +275,38 @@ TEST(GSYMTest, TestFunctionInfoEncoding) { 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); }