[llvm] [NFC] Separate high-level-dependent portions of DWARFExpression (PR #139175)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 16:51:44 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp llvm/lib/DebugInfo/DWARF/DWARFDie.cpp llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp llvm/tools/llvm-objdump/SourcePrinter.cpp llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
index 0549b71cb..ecfb545c8 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
@@ -174,32 +174,32 @@ inline bool operator==(const DWARFExpression::iterator &LHS,
 // allows DWARFExpression to be used from code which can't have dependencies on
 // those higher-level structures.
 
-  class DWARFUnit;
-  struct DIDumpOptions;
-  class raw_ostream;
+class DWARFUnit;
+struct DIDumpOptions;
+class raw_ostream;
 
 class DWARFExpressionPrinter {
- public:
-   /// Print a Dwarf expression/
-   /// \param E to be printed
-   /// \param OS to this stream
-   /// \param GetNameForDWARFReg callback to return dwarf register name
-   static void print(const DWARFExpression *E, raw_ostream &OS,
-                     DIDumpOptions DumpOpts, DWARFUnit *U, bool IsEH = false);
-
-   /// Print the expression in a format intended to be compact and useful to a
-   /// user, but not perfectly unambiguous, or capable of representing every
-   /// valid DWARF expression. Returns true if the expression was sucessfully
-   /// printed.
-   ///
-   /// \param E to be printed
-   /// \param OS to this stream
-   /// \param GetNameForDWARFReg callback to return dwarf register name
-   ///
-   /// \returns true if the expression was successfully printed
-   static bool printCompact(const DWARFExpression *E, raw_ostream &OS,
-                            std::function<StringRef(uint64_t RegNum, bool IsEH)>
-                                GetNameForDWARFReg = nullptr);
+public:
+  /// Print a Dwarf expression/
+  /// \param E to be printed
+  /// \param OS to this stream
+  /// \param GetNameForDWARFReg callback to return dwarf register name
+  static void print(const DWARFExpression *E, raw_ostream &OS,
+                    DIDumpOptions DumpOpts, DWARFUnit *U, bool IsEH = false);
+
+  /// Print the expression in a format intended to be compact and useful to a
+  /// user, but not perfectly unambiguous, or capable of representing every
+  /// valid DWARF expression. Returns true if the expression was sucessfully
+  /// printed.
+  ///
+  /// \param E to be printed
+  /// \param OS to this stream
+  /// \param GetNameForDWARFReg callback to return dwarf register name
+  ///
+  /// \returns true if the expression was successfully printed
+  static bool printCompact(const DWARFExpression *E, raw_ostream &OS,
+                           std::function<StringRef(uint64_t RegNum, bool IsEH)>
+                               GetNameForDWARFReg = nullptr);
 
   /// Pretty print a register opcode and operands.
   /// \param U within the context of this Dwarf unit, if any.
@@ -210,18 +210,18 @@ class DWARFExpressionPrinter {
   ///
   /// returns true if the Op was successfully printed
   static bool prettyPrintRegisterOp(DWARFUnit *U, raw_ostream &OS,
-                                     DIDumpOptions DumpOpts, uint8_t Opcode,
-                                     ArrayRef<uint64_t> Operands);
-
- private:
-   static bool printOp(const DWARFExpression::Operation *Op, raw_ostream &OS,
-                       DIDumpOptions DumpOpts, const DWARFExpression *Expr,
-                       DWARFUnit *U);
-
-   static void prettyPrintBaseTypeRef(DWARFUnit *U, raw_ostream &OS,
-                                      DIDumpOptions DumpOpts,
-                                      ArrayRef<uint64_t> Operands,
-                                      unsigned Operand);
+                                    DIDumpOptions DumpOpts, uint8_t Opcode,
+                                    ArrayRef<uint64_t> Operands);
+
+private:
+  static bool printOp(const DWARFExpression::Operation *Op, raw_ostream &OS,
+                      DIDumpOptions DumpOpts, const DWARFExpression *Expr,
+                      DWARFUnit *U);
+
+  static void prettyPrintBaseTypeRef(DWARFUnit *U, raw_ostream &OS,
+                                     DIDumpOptions DumpOpts,
+                                     ArrayRef<uint64_t> Operands,
+                                     unsigned Operand);
 };
 
 } // end namespace llvm
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
index dd1325d8f..6dda918bd 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
@@ -533,5 +533,4 @@ bool DWARFExpressionPrinter::printCompact(
   return printCompactDWARFExpr(OS, E->begin(), E->end(), GetNameForDWARFReg);
 }
 
-
 } // namespace llvm

``````````

</details>


https://github.com/llvm/llvm-project/pull/139175


More information about the llvm-commits mailing list