[llvm] ad66e9b - [DebugInfo] Follow-up to D151001

Alex Langford via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 10:20:22 PDT 2023


Author: Alex Langford
Date: 2023-05-24T10:20:10-07:00
New Revision: ad66e9be6a751dc98219b4eec1e46254e5418daf

URL: https://github.com/llvm/llvm-project/commit/ad66e9be6a751dc98219b4eec1e46254e5418daf
DIFF: https://github.com/llvm/llvm-project/commit/ad66e9be6a751dc98219b4eec1e46254e5418daf.diff

LOG: [DebugInfo] Follow-up to D151001

I landed D151001 before it had gotten sign-off from all the reviewers.
This is a follow-up to address the additional feedback.

Differential Revision: https://reviews.llvm.org/D151233

Added: 
    

Modified: 
    llvm/unittests/DebugInfo/DWARF/DWARFDebugAbbrevTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugAbbrevTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugAbbrevTest.cpp
index 5f304e9329c3e..ad61ccbc22c95 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugAbbrevTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugAbbrevTest.cpp
@@ -18,10 +18,10 @@
 using namespace llvm;
 using namespace dwarf;
 
-enum Order : bool { InOrder, OutOfOrder };
+enum OrderKind : bool { InOrder, OutOfOrder };
 
-void WriteAbbreviationDeclarations(raw_ostream &OS, uint32_t FirstCode,
-                                   Order Ord) {
+void writeAbbreviationDeclarations(raw_ostream &OS, uint32_t FirstCode,
+                                   OrderKind Order) {
   encodeULEB128(FirstCode, OS);
   encodeULEB128(DW_TAG_compile_unit, OS);
   OS << static_cast<uint8_t>(DW_CHILDREN_yes);
@@ -30,7 +30,8 @@ void WriteAbbreviationDeclarations(raw_ostream &OS, uint32_t FirstCode,
   encodeULEB128(0, OS);
   encodeULEB128(0, OS);
 
-  uint32_t SecondCode = Ord == Order::InOrder ? FirstCode + 1 : FirstCode - 1;
+  uint32_t SecondCode =
+      Order == OrderKind::InOrder ? FirstCode + 1 : FirstCode - 1;
 
   encodeULEB128(SecondCode, OS);
   encodeULEB128(DW_TAG_subprogram, OS);
@@ -46,7 +47,7 @@ TEST(DWARFDebugAbbrevTest, DWARFAbbrevDeclSetExtractSuccess) {
   raw_svector_ostream OS(RawData);
   uint32_t FirstCode = 5;
 
-  WriteAbbreviationDeclarations(OS, FirstCode, InOrder);
+  writeAbbreviationDeclarations(OS, FirstCode, InOrder);
   encodeULEB128(0, OS);
 
   uint64_t Offset = 0;
@@ -55,19 +56,19 @@ TEST(DWARFDebugAbbrevTest, DWARFAbbrevDeclSetExtractSuccess) {
   const bool DataWasExtracted = AbbrevSet.extract(Data, &Offset);
   EXPECT_TRUE(DataWasExtracted);
   // The Abbreviation Declarations are in order and contiguous, so we want to
-  // make sure that FirstAbbrCode was correctly set
+  // make sure that FirstAbbrCode was correctly set.
   EXPECT_EQ(AbbrevSet.getFirstAbbrCode(), FirstCode);
 
   const DWARFAbbreviationDeclaration *Abbrev5 =
       AbbrevSet.getAbbreviationDeclaration(FirstCode);
-  EXPECT_TRUE(Abbrev5);
+  ASSERT_TRUE(Abbrev5);
   EXPECT_EQ(Abbrev5->getTag(), DW_TAG_compile_unit);
   EXPECT_TRUE(Abbrev5->hasChildren());
   EXPECT_EQ(Abbrev5->getNumAttributes(), 1u);
 
   const DWARFAbbreviationDeclaration *Abbrev6 =
       AbbrevSet.getAbbreviationDeclaration(FirstCode + 1);
-  EXPECT_TRUE(Abbrev6);
+  ASSERT_TRUE(Abbrev6);
   EXPECT_EQ(Abbrev6->getTag(), DW_TAG_subprogram);
   EXPECT_FALSE(Abbrev6->hasChildren());
   EXPECT_EQ(Abbrev6->getNumAttributes(), 1u);
@@ -78,7 +79,7 @@ TEST(DWARFDebugAbbrevTest, DWARFAbbrevDeclSetExtractSuccessOutOfOrder) {
   raw_svector_ostream OS(RawData);
   uint32_t FirstCode = 2;
 
-  WriteAbbreviationDeclarations(OS, FirstCode, OutOfOrder);
+  writeAbbreviationDeclarations(OS, FirstCode, OutOfOrder);
   encodeULEB128(0, OS);
 
   uint64_t Offset = 0;
@@ -86,19 +87,19 @@ TEST(DWARFDebugAbbrevTest, DWARFAbbrevDeclSetExtractSuccessOutOfOrder) {
   DWARFAbbreviationDeclarationSet AbbrevSet;
   const bool DataWasExtracted = AbbrevSet.extract(Data, &Offset);
   EXPECT_TRUE(DataWasExtracted);
-  // The declarations are out of order, ensure that FirstAbbrCode is UINT32_MAX
+  // The declarations are out of order, ensure that FirstAbbrCode is UINT32_MAX.
   EXPECT_EQ(AbbrevSet.getFirstAbbrCode(), UINT32_MAX);
 
   const DWARFAbbreviationDeclaration *Abbrev2 =
       AbbrevSet.getAbbreviationDeclaration(FirstCode);
-  EXPECT_TRUE(Abbrev2);
+  ASSERT_TRUE(Abbrev2);
   EXPECT_EQ(Abbrev2->getTag(), DW_TAG_compile_unit);
   EXPECT_TRUE(Abbrev2->hasChildren());
   EXPECT_EQ(Abbrev2->getNumAttributes(), 1u);
 
   const DWARFAbbreviationDeclaration *Abbrev1 =
       AbbrevSet.getAbbreviationDeclaration(FirstCode - 1);
-  EXPECT_TRUE(Abbrev1);
+  ASSERT_TRUE(Abbrev1);
   EXPECT_EQ(Abbrev1->getTag(), DW_TAG_subprogram);
   EXPECT_FALSE(Abbrev1->hasChildren());
   EXPECT_EQ(Abbrev1->getNumAttributes(), 1u);


        


More information about the llvm-commits mailing list