[llvm] [llvm] annotate interfaces in llvm/DWARFLinker, llvm/DWP, and llvm/Demangle for DLL export (PR #140782)

Andrew Rogers via llvm-commits llvm-commits at lists.llvm.org
Tue May 27 08:20:05 PDT 2025


https://github.com/andrurogerz updated https://github.com/llvm/llvm-project/pull/140782

>From 6345e3e74765cc75c2db7e9920b6fb20885ea5fa Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Tue, 20 May 2025 11:34:09 -0700
Subject: [PATCH 1/2] [llvm] IDS auto codemod for DWARFLinker, DWP, and
 Demangle libraries

---
 .../llvm/DWARFLinker/Classic/DWARFLinker.h    | 11 ++--
 .../Classic/DWARFLinkerCompileUnit.h          | 31 +++++-----
 .../llvm/DWARFLinker/Classic/DWARFStreamer.h  |  3 +-
 .../llvm/DWARFLinker/DWARFLinkerBase.h        |  3 +-
 .../llvm/DWARFLinker/Parallel/DWARFLinker.h   |  3 +-
 llvm/include/llvm/DWP/DWP.h                   | 15 ++---
 llvm/include/llvm/DWP/DWPError.h              |  3 +-
 llvm/include/llvm/Demangle/Demangle.h         | 49 +++++++--------
 llvm/include/llvm/Demangle/ItaniumDemangle.h  |  3 +-
 .../include/llvm/Demangle/MicrosoftDemangle.h |  7 ++-
 .../llvm/Demangle/MicrosoftDemangleNodes.h    | 59 ++++++++++---------
 11 files changed, 99 insertions(+), 88 deletions(-)

diff --git a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h
index 3608e7821bbc4..45c8e2a08358a 100644
--- a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_DWARFLINKER_CLASSIC_DWARFLINKER_H
 #define LLVM_DWARFLINKER_CLASSIC_DWARFLINKER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/AddressRanges.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/CodeGen/AccelTable.h"
@@ -211,7 +212,7 @@ using UnitListTy = std::vector<std::unique_ptr<CompileUnit>>;
 /// a variable). These relocations are called ValidRelocs in the
 /// AddressesInfo and are gathered as a very first step when we start
 /// processing a object file.
-class DWARFLinker : public DWARFLinkerBase {
+class LLVM_ABI DWARFLinker : public DWARFLinkerBase {
 public:
   DWARFLinker(MessageHandlerTy ErrorHandler, MessageHandlerTy WarningHandler,
               std::function<StringRef(StringRef)> StringsTranslator)
@@ -586,18 +587,18 @@ class DWARFLinker : public DWARFLinkerBase {
     /// applied to the entry point of the function to get the linked address.
     /// \param Die the output DIE to use, pass NULL to create one.
     /// \returns the root of the cloned tree or null if nothing was selected.
-    DIE *cloneDIE(const DWARFDie &InputDIE, const DWARFFile &File,
+    LLVM_ABI DIE *cloneDIE(const DWARFDie &InputDIE, const DWARFFile &File,
                   CompileUnit &U, int64_t PCOffset, uint32_t OutOffset,
                   unsigned Flags, bool IsLittleEndian, DIE *Die = nullptr);
 
     /// Construct the output DIE tree by cloning the DIEs we
     /// chose to keep above. If there are no valid relocs, then there's
     /// nothing to clone/emit.
-    uint64_t cloneAllCompileUnits(DWARFContext &DwarfContext,
+    LLVM_ABI uint64_t cloneAllCompileUnits(DWARFContext &DwarfContext,
                                   const DWARFFile &File, bool IsLittleEndian);
 
     /// Emit the .debug_addr section for the \p Unit.
-    void emitDebugAddrSection(CompileUnit &Unit,
+    LLVM_ABI void emitDebugAddrSection(CompileUnit &Unit,
                               const uint16_t DwarfVersion) const;
 
     using ExpressionHandlerRef = function_ref<void(
@@ -606,7 +607,7 @@ class DWARFLinker : public DWARFLinkerBase {
 
     /// Compute and emit debug locations (.debug_loc, .debug_loclists)
     /// for \p Unit, patch the attributes referencing it.
-    void generateUnitLocations(CompileUnit &Unit, const DWARFFile &File,
+    LLVM_ABI void generateUnitLocations(CompileUnit &Unit, const DWARFFile &File,
                                ExpressionHandlerRef ExprHandler);
 
   private:
diff --git a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h
index 7106889d8ec76..ce4bfe7c0f903 100644
--- a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h
+++ b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_DWARFLINKER_CLASSIC_DWARFLINKERCOMPILEUNIT_H
 #define LLVM_DWARFLINKER_CLASSIC_DWARFLINKERCOMPILEUNIT_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/AddressRanges.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/CodeGen/DIE.h"
@@ -142,9 +143,9 @@ class CompileUnit {
 
   bool hasODR() const { return HasODR; }
   bool isClangModule() const { return !ClangModuleName.empty(); }
-  uint16_t getLanguage();
+  LLVM_ABI uint16_t getLanguage();
   /// Return the DW_AT_LLVM_sysroot of the compile unit or an empty StringRef.
-  StringRef getSysRoot();
+  LLVM_ABI StringRef getSysRoot();
 
   const std::string &getClangModuleName() const { return ClangModuleName; }
 
@@ -185,58 +186,58 @@ class CompileUnit {
   /// Mark every DIE in this unit as kept. This function also
   /// marks variables as InDebugMap so that they appear in the
   /// reconstructed accelerator tables.
-  void markEverythingAsKept();
+  LLVM_ABI void markEverythingAsKept();
 
   /// Compute the end offset for this unit. Must be called after the CU's DIEs
   /// have been cloned.  \returns the next unit offset (which is also the
   /// current debug_info section size).
-  uint64_t computeNextUnitOffset(uint16_t DwarfVersion);
+  LLVM_ABI uint64_t computeNextUnitOffset(uint16_t DwarfVersion);
 
   /// Keep track of a forward reference to DIE \p Die in \p RefUnit by \p
   /// Attr. The attribute should be fixed up later to point to the absolute
   /// offset of \p Die in the debug_info section or to the canonical offset of
   /// \p Ctxt if it is non-null.
-  void noteForwardReference(DIE *Die, const CompileUnit *RefUnit,
+  LLVM_ABI void noteForwardReference(DIE *Die, const CompileUnit *RefUnit,
                             DeclContext *Ctxt, PatchLocation Attr);
 
   /// Apply all fixups recorded by noteForwardReference().
-  void fixupForwardReferences();
+  LLVM_ABI void fixupForwardReferences();
 
   /// Add the low_pc of a label that is relocated by applying
   /// offset \p PCOffset.
-  void addLabelLowPc(uint64_t LabelLowPc, int64_t PcOffset);
+  LLVM_ABI void addLabelLowPc(uint64_t LabelLowPc, int64_t PcOffset);
 
   /// Add a function range [\p LowPC, \p HighPC) that is relocated by applying
   /// offset \p PCOffset.
-  void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset);
+  LLVM_ABI void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset);
 
   /// Keep track of a DW_AT_range attribute that we will need to patch up later.
-  void noteRangeAttribute(const DIE &Die, PatchLocation Attr);
+  LLVM_ABI void noteRangeAttribute(const DIE &Die, PatchLocation Attr);
 
   /// Keep track of a location attribute pointing to a location list in the
   /// debug_loc section.
-  void noteLocationAttribute(PatchLocation Attr);
+  LLVM_ABI void noteLocationAttribute(PatchLocation Attr);
 
   // Record that the given DW_AT_LLVM_stmt_sequence attribute may need to be
   // patched later.
-  void noteStmtSeqListAttribute(PatchLocation Attr);
+  LLVM_ABI void noteStmtSeqListAttribute(PatchLocation Attr);
 
   /// Add a name accelerator entry for \a Die with \a Name.
-  void addNamespaceAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name);
+  LLVM_ABI void addNamespaceAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name);
 
   /// Add a name accelerator entry for \a Die with \a Name.
-  void addNameAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
+  LLVM_ABI void addNameAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
                           bool SkipPubnamesSection = false);
 
   /// Add various accelerator entries for \p Die with \p Name which is stored
   /// in the string table at \p Offset. \p Name must be an Objective-C
   /// selector.
-  void addObjCAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
+  LLVM_ABI void addObjCAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
                           bool SkipPubnamesSection = false);
 
   /// Add a type accelerator entry for \p Die with \p Name which is stored in
   /// the string table at \p Offset.
-  void addTypeAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
+  LLVM_ABI void addTypeAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
                           bool ObjcClassImplementation,
                           uint32_t QualifiedNameHash);
 
diff --git a/llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h b/llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h
index f0d658ffbef94..0ad7d44ac9fa7 100644
--- a/llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h
+++ b/llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_DWARFLINKER_CLASSIC_DWARFSTREAMER_H
 #define LLVM_DWARFLINKER_CLASSIC_DWARFSTREAMER_H
 
+#include "llvm/Support/Compiler.h"
 #include "DWARFLinker.h"
 #include "llvm/BinaryFormat/Swift.h"
 #include "llvm/CodeGen/AsmPrinter.h"
@@ -41,7 +42,7 @@ namespace classic {
 ///
 /// All interactions with the MC layer that is used to build the debug
 /// information binary representation are handled in this class.
-class DwarfStreamer : public DwarfEmitter {
+class LLVM_ABI DwarfStreamer : public DwarfEmitter {
 public:
   DwarfStreamer(DWARFLinkerBase::OutputFileType OutFileType,
                 raw_pwrite_stream &OutFile,
diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h b/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h
index 70b25cf02df7f..dd87012eb20de 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h
@@ -8,6 +8,7 @@
 
 #ifndef LLVM_DWARFLINKER_DWARFLINKERBASE_H
 #define LLVM_DWARFLINKER_DWARFLINKERBASE_H
+#include "llvm/Support/Compiler.h"
 #include "AddressesMap.h"
 #include "DWARFFile.h"
 #include "llvm/ADT/AddressRanges.h"
@@ -68,7 +69,7 @@ getSectionName(DebugSectionKind SectionKind) {
 }
 
 /// Recognise the table name and match it with the DebugSectionKind.
-std::optional<DebugSectionKind> parseDebugTableName(StringRef Name);
+LLVM_ABI std::optional<DebugSectionKind> parseDebugTableName(StringRef Name);
 
 /// The base interface for DWARFLinker implementations.
 class DWARFLinkerBase {
diff --git a/llvm/include/llvm/DWARFLinker/Parallel/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/Parallel/DWARFLinker.h
index 8acc046d07249..fb13dc2296f94 100644
--- a/llvm/include/llvm/DWARFLinker/Parallel/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/Parallel/DWARFLinker.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_DWARFLINKER_PARALLEL_DWARFLINKER_H
 #define LLVM_DWARFLINKER_PARALLEL_DWARFLINKER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/DWARFLinker/DWARFFile.h"
 #include "llvm/DWARFLinker/DWARFLinkerBase.h"
@@ -122,7 +123,7 @@ class DWARFLinker : public DWARFLinkerBase {
   virtual ~DWARFLinker() = default;
 
   /// Creates dwarf linker instance.
-  static std::unique_ptr<DWARFLinker>
+  LLVM_ABI static std::unique_ptr<DWARFLinker>
   createLinker(MessageHandlerTy ErrorHandler, MessageHandlerTy WarningHandler);
 
   /// Set output DWARF handler. Result of linking DWARF is set of sections
diff --git a/llvm/include/llvm/DWP/DWP.h b/llvm/include/llvm/DWP/DWP.h
index 9925deaa636b3..913441b80f896 100644
--- a/llvm/include/llvm/DWP/DWP.h
+++ b/llvm/include/llvm/DWP/DWP.h
@@ -1,6 +1,7 @@
 #ifndef LLVM_DWP_DWP_H
 #define LLVM_DWP_DWP_H
 
+#include "llvm/Support/Compiler.h"
 #include "DWPStringPool.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/MapVector.h"
@@ -66,12 +67,12 @@ struct CompileUnitIdentifiers {
   const char *DWOName = "";
 };
 
-Error write(MCStreamer &Out, ArrayRef<std::string> Inputs,
+LLVM_ABI Error write(MCStreamer &Out, ArrayRef<std::string> Inputs,
             OnCuIndexOverflow OverflowOptValue);
 
-unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion);
+LLVM_ABI unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion);
 
-Error handleSection(
+LLVM_ABI Error handleSection(
     const StringMap<std::pair<MCSection *, DWARFSectionKind>> &KnownSections,
     const MCSection *StrSection, const MCSection *StrOffsetSection,
     const MCSection *TypesSection, const MCSection *CUIndexSection,
@@ -85,17 +86,17 @@ Error handleSection(
     StringRef &CurCUIndexSection, StringRef &CurTUIndexSection,
     std::vector<std::pair<DWARFSectionKind, uint32_t>> &SectionLength);
 
-Expected<InfoSectionUnitHeader> parseInfoSectionUnitHeader(StringRef Info);
+LLVM_ABI Expected<InfoSectionUnitHeader> parseInfoSectionUnitHeader(StringRef Info);
 
-void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
+LLVM_ABI void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
                             MCSection *StrOffsetSection,
                             StringRef CurStrSection,
                             StringRef CurStrOffsetSection, uint16_t Version);
 
-Error buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
+LLVM_ABI Error buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
                           const CompileUnitIdentifiers &ID, StringRef DWPName);
 
-void writeIndex(MCStreamer &Out, MCSection *Section,
+LLVM_ABI void writeIndex(MCStreamer &Out, MCSection *Section,
                 ArrayRef<unsigned> ContributionOffsets,
                 const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
                 uint32_t IndexVersion);
diff --git a/llvm/include/llvm/DWP/DWPError.h b/llvm/include/llvm/DWP/DWPError.h
index a690ef3109bbf..e226e3d7b4054 100644
--- a/llvm/include/llvm/DWP/DWPError.h
+++ b/llvm/include/llvm/DWP/DWPError.h
@@ -1,6 +1,7 @@
 #ifndef LLVM_DWP_DWPERROR_H
 #define LLVM_DWP_DWPERROR_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <string>
@@ -13,7 +14,7 @@ class DWPError : public ErrorInfo<DWPError> {
   std::error_code convertToErrorCode() const override {
     llvm_unreachable("Not implemented");
   }
-  static char ID;
+  LLVM_ABI static char ID;
 
 private:
   std::string Info;
diff --git a/llvm/include/llvm/Demangle/Demangle.h b/llvm/include/llvm/Demangle/Demangle.h
index 21e7457b6336f..f0646d16101be 100644
--- a/llvm/include/llvm/Demangle/Demangle.h
+++ b/llvm/include/llvm/Demangle/Demangle.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_DEMANGLE_DEMANGLE_H
 #define LLVM_DEMANGLE_DEMANGLE_H
 
+#include "llvm/Support/Compiler.h"
 #include <cstddef>
 #include <optional>
 #include <string>
@@ -33,7 +34,7 @@ enum : int {
 /// Returns a non-NULL pointer to a NUL-terminated C style string
 /// that should be explicitly freed, if successful. Otherwise, may return
 /// nullptr if mangled_name is not a valid mangling or is nullptr.
-char *itaniumDemangle(std::string_view mangled_name, bool ParseParams = true);
+LLVM_ABI char *itaniumDemangle(std::string_view mangled_name, bool ParseParams = true);
 
 enum MSDemangleFlags {
   MSDF_None = 0,
@@ -52,26 +53,26 @@ enum MSDemangleFlags {
 /// bytes of the input string were consumed.
 /// status receives one of the demangle_ enum entries above if it's not nullptr.
 /// Flags controls various details of the demangled representation.
-char *microsoftDemangle(std::string_view mangled_name, size_t *n_read,
+LLVM_ABI char *microsoftDemangle(std::string_view mangled_name, size_t *n_read,
                         int *status, MSDemangleFlags Flags = MSDF_None);
 
-std::optional<size_t>
+LLVM_ABI std::optional<size_t>
 getArm64ECInsertionPointInMangledName(std::string_view MangledName);
 
 // Demangles a Rust v0 mangled symbol.
-char *rustDemangle(std::string_view MangledName);
+LLVM_ABI char *rustDemangle(std::string_view MangledName);
 
 // Demangles a D mangled symbol.
-char *dlangDemangle(std::string_view MangledName);
+LLVM_ABI char *dlangDemangle(std::string_view MangledName);
 
 /// Attempt to demangle a string using different demangling schemes.
 /// The function uses heuristics to determine which demangling scheme to use.
 /// \param MangledName - reference to string to demangle.
 /// \returns - the demangled string, or a copy of the input string if no
 /// demangling occurred.
-std::string demangle(std::string_view MangledName);
+LLVM_ABI std::string demangle(std::string_view MangledName);
 
-bool nonMicrosoftDemangle(std::string_view MangledName, std::string &Result,
+LLVM_ABI bool nonMicrosoftDemangle(std::string_view MangledName, std::string &Result,
                           bool CanHaveLeadingDot = true,
                           bool ParseParams = true);
 
@@ -79,60 +80,60 @@ bool nonMicrosoftDemangle(std::string_view MangledName, std::string &Result,
 /// (typically an intermediate stage in itaniumDemangle) and querying certain
 /// properties or partially printing the demangled name.
 struct ItaniumPartialDemangler {
-  ItaniumPartialDemangler();
+  LLVM_ABI ItaniumPartialDemangler();
 
-  ItaniumPartialDemangler(ItaniumPartialDemangler &&Other);
-  ItaniumPartialDemangler &operator=(ItaniumPartialDemangler &&Other);
+  LLVM_ABI ItaniumPartialDemangler(ItaniumPartialDemangler &&Other);
+  LLVM_ABI ItaniumPartialDemangler &operator=(ItaniumPartialDemangler &&Other);
 
   /// Demangle into an AST. Subsequent calls to the rest of the member functions
   /// implicitly operate on the AST this produces.
   /// \return true on error, false otherwise
-  bool partialDemangle(const char *MangledName);
+  LLVM_ABI bool partialDemangle(const char *MangledName);
 
   /// Just print the entire mangled name into Buf. Buf and N behave like the
   /// second and third parameters to __cxa_demangle.
-  char *finishDemangle(char *Buf, size_t *N) const;
+  LLVM_ABI char *finishDemangle(char *Buf, size_t *N) const;
 
   /// See \ref finishDemangle
   ///
   /// \param[in] OB A llvm::itanium_demangle::OutputBuffer that the demangled
   /// name will be printed into.
   ///
-  char *finishDemangle(void *OB) const;
+  LLVM_ABI char *finishDemangle(void *OB) const;
 
   /// Get the base name of a function. This doesn't include trailing template
   /// arguments, ie for "a::b<int>" this function returns "b".
-  char *getFunctionBaseName(char *Buf, size_t *N) const;
+  LLVM_ABI char *getFunctionBaseName(char *Buf, size_t *N) const;
 
   /// Get the context name for a function. For "a::b::c", this function returns
   /// "a::b".
-  char *getFunctionDeclContextName(char *Buf, size_t *N) const;
+  LLVM_ABI char *getFunctionDeclContextName(char *Buf, size_t *N) const;
 
   /// Get the entire name of this function.
-  char *getFunctionName(char *Buf, size_t *N) const;
+  LLVM_ABI char *getFunctionName(char *Buf, size_t *N) const;
 
   /// Get the parameters for this function.
-  char *getFunctionParameters(char *Buf, size_t *N) const;
-  char *getFunctionReturnType(char *Buf, size_t *N) const;
+  LLVM_ABI char *getFunctionParameters(char *Buf, size_t *N) const;
+  LLVM_ABI char *getFunctionReturnType(char *Buf, size_t *N) const;
 
   /// If this function has any cv or reference qualifiers. These imply that
   /// the function is a non-static member function.
-  bool hasFunctionQualifiers() const;
+  LLVM_ABI bool hasFunctionQualifiers() const;
 
   /// If this symbol describes a constructor or destructor.
-  bool isCtorOrDtor() const;
+  LLVM_ABI bool isCtorOrDtor() const;
 
   /// If this symbol describes a function.
-  bool isFunction() const;
+  LLVM_ABI bool isFunction() const;
 
   /// If this symbol describes a variable.
-  bool isData() const;
+  LLVM_ABI bool isData() const;
 
   /// If this symbol is a <special-name>. These are generally implicitly
   /// generated by the implementation, such as vtables and typeinfo names.
-  bool isSpecialName() const;
+  LLVM_ABI bool isSpecialName() const;
 
-  ~ItaniumPartialDemangler();
+  LLVM_ABI ~ItaniumPartialDemangler();
 
 private:
   void *RootNode;
diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index f4569850b093c..bb3f08f0c4ffb 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -16,6 +16,7 @@
 #ifndef DEMANGLE_ITANIUMDEMANGLE_H
 #define DEMANGLE_ITANIUMDEMANGLE_H
 
+#include "llvm/Support/Compiler.h"
 #include "DemangleConfig.h"
 #include "StringViewExtras.h"
 #include "Utility.h"
@@ -3049,7 +3050,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
   Node *parse(bool ParseParams = true);
 };
 
-const char* parse_discriminator(const char* first, const char* last);
+LLVM_ABI const char* parse_discriminator(const char* first, const char* last);
 
 // <name> ::= <nested-name> // N
 //        ::= <local-name> # See Scope Encoding below  // Z
diff --git a/llvm/include/llvm/Demangle/MicrosoftDemangle.h b/llvm/include/llvm/Demangle/MicrosoftDemangle.h
index b9a25e361eec0..8c088538498f2 100644
--- a/llvm/include/llvm/Demangle/MicrosoftDemangle.h
+++ b/llvm/include/llvm/Demangle/MicrosoftDemangle.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_DEMANGLE_MICROSOFTDEMANGLE_H
 #define LLVM_DEMANGLE_MICROSOFTDEMANGLE_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Demangle/Demangle.h"
 #include "llvm/Demangle/MicrosoftDemangleNodes.h"
 
@@ -151,14 +152,14 @@ class Demangler {
 
   // You are supposed to call parse() first and then check if error is true.  If
   // it is false, call output() to write the formatted name to the given stream.
-  SymbolNode *parse(std::string_view &MangledName);
+  LLVM_ABI SymbolNode *parse(std::string_view &MangledName);
 
-  TagTypeNode *parseTagUniqueName(std::string_view &MangledName);
+  LLVM_ABI TagTypeNode *parseTagUniqueName(std::string_view &MangledName);
 
   // True if an error occurred.
   bool Error = false;
 
-  void dumpBackReferences();
+  LLVM_ABI void dumpBackReferences();
 
 private:
   SymbolNode *demangleEncodedSymbol(std::string_view &MangledName,
diff --git a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
index d72fb47cd9b04..71a534b5afa4e 100644
--- a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
+++ b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_DEMANGLE_MICROSOFTDEMANGLENODES_H
 #define LLVM_DEMANGLE_MICROSOFTDEMANGLENODES_H
 
+#include "llvm/Support/Compiler.h"
 #include <array>
 #include <cstdint>
 #include <string>
@@ -265,7 +266,7 @@ struct Node {
 
   virtual void output(OutputBuffer &OB, OutputFlags Flags) const = 0;
 
-  std::string toString(OutputFlags Flags = OF_Default) const;
+  LLVM_ABI std::string toString(OutputFlags Flags = OF_Default) const;
 
 private:
   NodeKind Kind;
@@ -312,7 +313,7 @@ struct TypeNode : public Node {
   Qualifiers Quals = Q_None;
 };
 
-struct PrimitiveTypeNode : public TypeNode {
+struct LLVM_ABI PrimitiveTypeNode : public TypeNode {
   explicit PrimitiveTypeNode(PrimitiveKind K)
       : TypeNode(NodeKind::PrimitiveType), PrimKind(K) {}
 
@@ -322,7 +323,7 @@ struct PrimitiveTypeNode : public TypeNode {
   PrimitiveKind PrimKind;
 };
 
-struct FunctionSignatureNode : public TypeNode {
+struct LLVM_ABI FunctionSignatureNode : public TypeNode {
   explicit FunctionSignatureNode(NodeKind K) : TypeNode(K) {}
   FunctionSignatureNode() : TypeNode(NodeKind::FunctionSignature) {}
 
@@ -360,10 +361,10 @@ struct IdentifierNode : public Node {
   NodeArrayNode *TemplateParams = nullptr;
 
 protected:
-  void outputTemplateParameters(OutputBuffer &OB, OutputFlags Flags) const;
+  LLVM_ABI void outputTemplateParameters(OutputBuffer &OB, OutputFlags Flags) const;
 };
 
-struct VcallThunkIdentifierNode : public IdentifierNode {
+struct LLVM_ABI VcallThunkIdentifierNode : public IdentifierNode {
   VcallThunkIdentifierNode() : IdentifierNode(NodeKind::VcallThunkIdentifier) {}
 
   void output(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -371,7 +372,7 @@ struct VcallThunkIdentifierNode : public IdentifierNode {
   uint64_t OffsetInVTable = 0;
 };
 
-struct DynamicStructorIdentifierNode : public IdentifierNode {
+struct LLVM_ABI DynamicStructorIdentifierNode : public IdentifierNode {
   DynamicStructorIdentifierNode()
       : IdentifierNode(NodeKind::DynamicStructorIdentifier) {}
 
@@ -382,7 +383,7 @@ struct DynamicStructorIdentifierNode : public IdentifierNode {
   bool IsDestructor = false;
 };
 
-struct NamedIdentifierNode : public IdentifierNode {
+struct LLVM_ABI NamedIdentifierNode : public IdentifierNode {
   NamedIdentifierNode() : IdentifierNode(NodeKind::NamedIdentifier) {}
 
   void output(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -390,7 +391,7 @@ struct NamedIdentifierNode : public IdentifierNode {
   std::string_view Name;
 };
 
-struct IntrinsicFunctionIdentifierNode : public IdentifierNode {
+struct LLVM_ABI IntrinsicFunctionIdentifierNode : public IdentifierNode {
   explicit IntrinsicFunctionIdentifierNode(IntrinsicFunctionKind Operator)
       : IdentifierNode(NodeKind::IntrinsicFunctionIdentifier),
         Operator(Operator) {}
@@ -400,7 +401,7 @@ struct IntrinsicFunctionIdentifierNode : public IdentifierNode {
   IntrinsicFunctionKind Operator;
 };
 
-struct LiteralOperatorIdentifierNode : public IdentifierNode {
+struct LLVM_ABI LiteralOperatorIdentifierNode : public IdentifierNode {
   LiteralOperatorIdentifierNode()
       : IdentifierNode(NodeKind::LiteralOperatorIdentifier) {}
 
@@ -409,7 +410,7 @@ struct LiteralOperatorIdentifierNode : public IdentifierNode {
   std::string_view Name;
 };
 
-struct LocalStaticGuardIdentifierNode : public IdentifierNode {
+struct LLVM_ABI LocalStaticGuardIdentifierNode : public IdentifierNode {
   LocalStaticGuardIdentifierNode()
       : IdentifierNode(NodeKind::LocalStaticGuardIdentifier) {}
 
@@ -419,7 +420,7 @@ struct LocalStaticGuardIdentifierNode : public IdentifierNode {
   uint32_t ScopeIndex = 0;
 };
 
-struct ConversionOperatorIdentifierNode : public IdentifierNode {
+struct LLVM_ABI ConversionOperatorIdentifierNode : public IdentifierNode {
   ConversionOperatorIdentifierNode()
       : IdentifierNode(NodeKind::ConversionOperatorIdentifier) {}
 
@@ -429,7 +430,7 @@ struct ConversionOperatorIdentifierNode : public IdentifierNode {
   TypeNode *TargetType = nullptr;
 };
 
-struct StructorIdentifierNode : public IdentifierNode {
+struct LLVM_ABI StructorIdentifierNode : public IdentifierNode {
   StructorIdentifierNode() : IdentifierNode(NodeKind::StructorIdentifier) {}
   explicit StructorIdentifierNode(bool IsDestructor)
       : IdentifierNode(NodeKind::StructorIdentifier),
@@ -442,7 +443,7 @@ struct StructorIdentifierNode : public IdentifierNode {
   bool IsDestructor = false;
 };
 
-struct ThunkSignatureNode : public FunctionSignatureNode {
+struct LLVM_ABI ThunkSignatureNode : public FunctionSignatureNode {
   ThunkSignatureNode() : FunctionSignatureNode(NodeKind::ThunkSignature) {}
 
   void outputPre(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -458,7 +459,7 @@ struct ThunkSignatureNode : public FunctionSignatureNode {
   ThisAdjustor ThisAdjust;
 };
 
-struct PointerTypeNode : public TypeNode {
+struct LLVM_ABI PointerTypeNode : public TypeNode {
   PointerTypeNode() : TypeNode(NodeKind::PointerType) {}
   void outputPre(OutputBuffer &OB, OutputFlags Flags) const override;
   void outputPost(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -476,7 +477,7 @@ struct PointerTypeNode : public TypeNode {
   TypeNode *Pointee = nullptr;
 };
 
-struct TagTypeNode : public TypeNode {
+struct LLVM_ABI TagTypeNode : public TypeNode {
   explicit TagTypeNode(TagKind Tag) : TypeNode(NodeKind::TagType), Tag(Tag) {}
 
   void outputPre(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -486,7 +487,7 @@ struct TagTypeNode : public TypeNode {
   TagKind Tag;
 };
 
-struct ArrayTypeNode : public TypeNode {
+struct LLVM_ABI ArrayTypeNode : public TypeNode {
   ArrayTypeNode() : TypeNode(NodeKind::ArrayType) {}
 
   void outputPre(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -507,7 +508,7 @@ struct IntrinsicNode : public TypeNode {
   void output(OutputBuffer &OB, OutputFlags Flags) const override {}
 };
 
-struct CustomTypeNode : public TypeNode {
+struct LLVM_ABI CustomTypeNode : public TypeNode {
   CustomTypeNode() : TypeNode(NodeKind::Custom) {}
 
   void outputPre(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -516,7 +517,7 @@ struct CustomTypeNode : public TypeNode {
   IdentifierNode *Identifier = nullptr;
 };
 
-struct NodeArrayNode : public Node {
+struct LLVM_ABI NodeArrayNode : public Node {
   NodeArrayNode() : Node(NodeKind::NodeArray) {}
 
   void output(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -528,7 +529,7 @@ struct NodeArrayNode : public Node {
   size_t Count = 0;
 };
 
-struct QualifiedNameNode : public Node {
+struct LLVM_ABI QualifiedNameNode : public Node {
   QualifiedNameNode() : Node(NodeKind::QualifiedName) {}
 
   void output(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -541,7 +542,7 @@ struct QualifiedNameNode : public Node {
   }
 };
 
-struct TemplateParameterReferenceNode : public Node {
+struct LLVM_ABI TemplateParameterReferenceNode : public Node {
   TemplateParameterReferenceNode()
       : Node(NodeKind::TemplateParameterReference) {}
 
@@ -555,7 +556,7 @@ struct TemplateParameterReferenceNode : public Node {
   bool IsMemberPointer = false;
 };
 
-struct IntegerLiteralNode : public Node {
+struct LLVM_ABI IntegerLiteralNode : public Node {
   IntegerLiteralNode() : Node(NodeKind::IntegerLiteral) {}
   IntegerLiteralNode(uint64_t Value, bool IsNegative)
       : Node(NodeKind::IntegerLiteral), Value(Value), IsNegative(IsNegative) {}
@@ -566,7 +567,7 @@ struct IntegerLiteralNode : public Node {
   bool IsNegative = false;
 };
 
-struct RttiBaseClassDescriptorNode : public IdentifierNode {
+struct LLVM_ABI RttiBaseClassDescriptorNode : public IdentifierNode {
   RttiBaseClassDescriptorNode()
       : IdentifierNode(NodeKind::RttiBaseClassDescriptor) {}
 
@@ -578,13 +579,13 @@ struct RttiBaseClassDescriptorNode : public IdentifierNode {
   uint32_t Flags = 0;
 };
 
-struct SymbolNode : public Node {
+struct LLVM_ABI SymbolNode : public Node {
   explicit SymbolNode(NodeKind K) : Node(K) {}
   void output(OutputBuffer &OB, OutputFlags Flags) const override;
   QualifiedNameNode *Name = nullptr;
 };
 
-struct SpecialTableSymbolNode : public SymbolNode {
+struct LLVM_ABI SpecialTableSymbolNode : public SymbolNode {
   explicit SpecialTableSymbolNode()
       : SymbolNode(NodeKind::SpecialTableSymbol) {}
 
@@ -593,7 +594,7 @@ struct SpecialTableSymbolNode : public SymbolNode {
   Qualifiers Quals = Qualifiers::Q_None;
 };
 
-struct LocalStaticGuardVariableNode : public SymbolNode {
+struct LLVM_ABI LocalStaticGuardVariableNode : public SymbolNode {
   LocalStaticGuardVariableNode()
       : SymbolNode(NodeKind::LocalStaticGuardVariable) {}
 
@@ -602,7 +603,7 @@ struct LocalStaticGuardVariableNode : public SymbolNode {
   bool IsVisible = false;
 };
 
-struct EncodedStringLiteralNode : public SymbolNode {
+struct LLVM_ABI EncodedStringLiteralNode : public SymbolNode {
   EncodedStringLiteralNode() : SymbolNode(NodeKind::EncodedStringLiteral) {}
 
   void output(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -612,7 +613,7 @@ struct EncodedStringLiteralNode : public SymbolNode {
   CharKind Char = CharKind::Char;
 };
 
-struct VariableSymbolNode : public SymbolNode {
+struct LLVM_ABI VariableSymbolNode : public SymbolNode {
   VariableSymbolNode() : SymbolNode(NodeKind::VariableSymbol) {}
 
   void output(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -621,7 +622,7 @@ struct VariableSymbolNode : public SymbolNode {
   TypeNode *Type = nullptr;
 };
 
-struct FunctionSymbolNode : public SymbolNode {
+struct LLVM_ABI FunctionSymbolNode : public SymbolNode {
   FunctionSymbolNode() : SymbolNode(NodeKind::FunctionSymbol) {}
 
   void output(OutputBuffer &OB, OutputFlags Flags) const override;
@@ -629,7 +630,7 @@ struct FunctionSymbolNode : public SymbolNode {
   FunctionSignatureNode *Signature = nullptr;
 };
 
-struct PointerAuthQualifierNode : public Node {
+struct LLVM_ABI PointerAuthQualifierNode : public Node {
   PointerAuthQualifierNode() : Node(NodeKind::PointerAuthQualifier) {}
 
   // __ptrauth takes three arguments:

>From 9f1db789b3d76ded3989f1a13e18c403c3915e7f Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Tue, 20 May 2025 11:35:49 -0700
Subject: [PATCH 2/2] [llvm] clang-format changes to DWARFLinker, DWP, and
 Demangle libraries

---
 .../llvm/DWARFLinker/Classic/DWARFLinker.h    | 17 +++++----
 .../Classic/DWARFLinkerCompileUnit.h          | 18 +++++-----
 .../llvm/DWARFLinker/Classic/DWARFStreamer.h  |  2 +-
 .../llvm/DWARFLinker/DWARFLinkerBase.h        |  2 +-
 .../llvm/DWARFLinker/Parallel/DWARFLinker.h   |  2 +-
 llvm/include/llvm/DWP/DWP.h                   | 35 +++++++++++--------
 llvm/include/llvm/Demangle/Demangle.h         | 13 ++++---
 llvm/include/llvm/Demangle/ItaniumDemangle.h  |  4 +--
 .../include/llvm/Demangle/MicrosoftDemangle.h |  2 +-
 .../llvm/Demangle/MicrosoftDemangleNodes.h    |  3 +-
 10 files changed, 56 insertions(+), 42 deletions(-)

diff --git a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h
index 45c8e2a08358a..b12d96812108e 100644
--- a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h
@@ -9,7 +9,6 @@
 #ifndef LLVM_DWARFLINKER_CLASSIC_DWARFLINKER_H
 #define LLVM_DWARFLINKER_CLASSIC_DWARFLINKER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/AddressRanges.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/CodeGen/AccelTable.h"
@@ -22,6 +21,7 @@
 #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
 #include "llvm/DebugInfo/DWARF/DWARFDie.h"
 #include "llvm/DebugInfo/DWARF/DWARFExpression.h"
+#include "llvm/Support/Compiler.h"
 #include <map>
 
 namespace llvm {
@@ -588,18 +588,20 @@ class LLVM_ABI DWARFLinker : public DWARFLinkerBase {
     /// \param Die the output DIE to use, pass NULL to create one.
     /// \returns the root of the cloned tree or null if nothing was selected.
     LLVM_ABI DIE *cloneDIE(const DWARFDie &InputDIE, const DWARFFile &File,
-                  CompileUnit &U, int64_t PCOffset, uint32_t OutOffset,
-                  unsigned Flags, bool IsLittleEndian, DIE *Die = nullptr);
+                           CompileUnit &U, int64_t PCOffset, uint32_t OutOffset,
+                           unsigned Flags, bool IsLittleEndian,
+                           DIE *Die = nullptr);
 
     /// Construct the output DIE tree by cloning the DIEs we
     /// chose to keep above. If there are no valid relocs, then there's
     /// nothing to clone/emit.
     LLVM_ABI uint64_t cloneAllCompileUnits(DWARFContext &DwarfContext,
-                                  const DWARFFile &File, bool IsLittleEndian);
+                                           const DWARFFile &File,
+                                           bool IsLittleEndian);
 
     /// Emit the .debug_addr section for the \p Unit.
     LLVM_ABI void emitDebugAddrSection(CompileUnit &Unit,
-                              const uint16_t DwarfVersion) const;
+                                       const uint16_t DwarfVersion) const;
 
     using ExpressionHandlerRef = function_ref<void(
         SmallVectorImpl<uint8_t> &, SmallVectorImpl<uint8_t> &,
@@ -607,8 +609,9 @@ class LLVM_ABI DWARFLinker : public DWARFLinkerBase {
 
     /// Compute and emit debug locations (.debug_loc, .debug_loclists)
     /// for \p Unit, patch the attributes referencing it.
-    LLVM_ABI void generateUnitLocations(CompileUnit &Unit, const DWARFFile &File,
-                               ExpressionHandlerRef ExprHandler);
+    LLVM_ABI void generateUnitLocations(CompileUnit &Unit,
+                                        const DWARFFile &File,
+                                        ExpressionHandlerRef ExprHandler);
 
   private:
     using AttributeSpec = DWARFAbbreviationDeclaration::AttributeSpec;
diff --git a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h
index ce4bfe7c0f903..714badfabf89c 100644
--- a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h
+++ b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h
@@ -9,11 +9,11 @@
 #ifndef LLVM_DWARFLINKER_CLASSIC_DWARFLINKERCOMPILEUNIT_H
 #define LLVM_DWARFLINKER_CLASSIC_DWARFLINKERCOMPILEUNIT_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/AddressRanges.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/CodeGen/DIE.h"
 #include "llvm/DebugInfo/DWARF/DWARFUnit.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 
 namespace llvm {
@@ -198,7 +198,7 @@ class CompileUnit {
   /// offset of \p Die in the debug_info section or to the canonical offset of
   /// \p Ctxt if it is non-null.
   LLVM_ABI void noteForwardReference(DIE *Die, const CompileUnit *RefUnit,
-                            DeclContext *Ctxt, PatchLocation Attr);
+                                     DeclContext *Ctxt, PatchLocation Attr);
 
   /// Apply all fixups recorded by noteForwardReference().
   LLVM_ABI void fixupForwardReferences();
@@ -209,7 +209,8 @@ class CompileUnit {
 
   /// Add a function range [\p LowPC, \p HighPC) that is relocated by applying
   /// offset \p PCOffset.
-  LLVM_ABI void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset);
+  LLVM_ABI void addFunctionRange(uint64_t LowPC, uint64_t HighPC,
+                                 int64_t PCOffset);
 
   /// Keep track of a DW_AT_range attribute that we will need to patch up later.
   LLVM_ABI void noteRangeAttribute(const DIE &Die, PatchLocation Attr);
@@ -223,23 +224,24 @@ class CompileUnit {
   LLVM_ABI void noteStmtSeqListAttribute(PatchLocation Attr);
 
   /// Add a name accelerator entry for \a Die with \a Name.
-  LLVM_ABI void addNamespaceAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name);
+  LLVM_ABI void addNamespaceAccelerator(const DIE *Die,
+                                        DwarfStringPoolEntryRef Name);
 
   /// Add a name accelerator entry for \a Die with \a Name.
   LLVM_ABI void addNameAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
-                          bool SkipPubnamesSection = false);
+                                   bool SkipPubnamesSection = false);
 
   /// Add various accelerator entries for \p Die with \p Name which is stored
   /// in the string table at \p Offset. \p Name must be an Objective-C
   /// selector.
   LLVM_ABI void addObjCAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
-                          bool SkipPubnamesSection = false);
+                                   bool SkipPubnamesSection = false);
 
   /// Add a type accelerator entry for \p Die with \p Name which is stored in
   /// the string table at \p Offset.
   LLVM_ABI void addTypeAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
-                          bool ObjcClassImplementation,
-                          uint32_t QualifiedNameHash);
+                                   bool ObjcClassImplementation,
+                                   uint32_t QualifiedNameHash);
 
   struct AccelInfo {
     /// Name of the entry.
diff --git a/llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h b/llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h
index 0ad7d44ac9fa7..03fc7290aacca 100644
--- a/llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h
+++ b/llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h
@@ -9,7 +9,6 @@
 #ifndef LLVM_DWARFLINKER_CLASSIC_DWARFSTREAMER_H
 #define LLVM_DWARFLINKER_CLASSIC_DWARFSTREAMER_H
 
-#include "llvm/Support/Compiler.h"
 #include "DWARFLinker.h"
 #include "llvm/BinaryFormat/Swift.h"
 #include "llvm/CodeGen/AsmPrinter.h"
@@ -19,6 +18,7 @@
 #include "llvm/MC/MCObjectFileInfo.h"
 #include "llvm/MC/MCRegisterInfo.h"
 #include "llvm/MC/MCSubtargetInfo.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Target/TargetMachine.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h b/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h
index dd87012eb20de..17a18c4b029f4 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h
@@ -8,7 +8,6 @@
 
 #ifndef LLVM_DWARFLINKER_DWARFLINKERBASE_H
 #define LLVM_DWARFLINKER_DWARFLINKERBASE_H
-#include "llvm/Support/Compiler.h"
 #include "AddressesMap.h"
 #include "DWARFFile.h"
 #include "llvm/ADT/AddressRanges.h"
@@ -18,6 +17,7 @@
 #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
 #include "llvm/DebugInfo/DWARF/DWARFDie.h"
 #include "llvm/DebugInfo/DWARF/DWARFExpression.h"
+#include "llvm/Support/Compiler.h"
 #include <map>
 namespace llvm {
 class DWARFUnit;
diff --git a/llvm/include/llvm/DWARFLinker/Parallel/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/Parallel/DWARFLinker.h
index fb13dc2296f94..80465136dd286 100644
--- a/llvm/include/llvm/DWARFLinker/Parallel/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/Parallel/DWARFLinker.h
@@ -9,13 +9,13 @@
 #ifndef LLVM_DWARFLINKER_PARALLEL_DWARFLINKER_H
 #define LLVM_DWARFLINKER_PARALLEL_DWARFLINKER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/DWARFLinker/DWARFFile.h"
 #include "llvm/DWARFLinker/DWARFLinkerBase.h"
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
 #include "llvm/DebugInfo/DWARF/DWARFDie.h"
 #include "llvm/MC/MCDwarf.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/TargetParser/Triple.h"
 
 /// ------------------------------------------------------------------
diff --git a/llvm/include/llvm/DWP/DWP.h b/llvm/include/llvm/DWP/DWP.h
index 913441b80f896..37d2d27af5b6b 100644
--- a/llvm/include/llvm/DWP/DWP.h
+++ b/llvm/include/llvm/DWP/DWP.h
@@ -1,7 +1,6 @@
 #ifndef LLVM_DWP_DWP_H
 #define LLVM_DWP_DWP_H
 
-#include "llvm/Support/Compiler.h"
 #include "DWPStringPool.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/MapVector.h"
@@ -11,6 +10,7 @@
 #include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <deque>
 #include <vector>
@@ -68,9 +68,10 @@ struct CompileUnitIdentifiers {
 };
 
 LLVM_ABI Error write(MCStreamer &Out, ArrayRef<std::string> Inputs,
-            OnCuIndexOverflow OverflowOptValue);
+                     OnCuIndexOverflow OverflowOptValue);
 
-LLVM_ABI unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion);
+LLVM_ABI unsigned getContributionIndex(DWARFSectionKind Kind,
+                                       uint32_t IndexVersion);
 
 LLVM_ABI Error handleSection(
     const StringMap<std::pair<MCSection *, DWARFSectionKind>> &KnownSections,
@@ -86,20 +87,24 @@ LLVM_ABI Error handleSection(
     StringRef &CurCUIndexSection, StringRef &CurTUIndexSection,
     std::vector<std::pair<DWARFSectionKind, uint32_t>> &SectionLength);
 
-LLVM_ABI Expected<InfoSectionUnitHeader> parseInfoSectionUnitHeader(StringRef Info);
+LLVM_ABI Expected<InfoSectionUnitHeader>
+parseInfoSectionUnitHeader(StringRef Info);
 
 LLVM_ABI void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
-                            MCSection *StrOffsetSection,
-                            StringRef CurStrSection,
-                            StringRef CurStrOffsetSection, uint16_t Version);
-
-LLVM_ABI Error buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
-                          const CompileUnitIdentifiers &ID, StringRef DWPName);
-
-LLVM_ABI void writeIndex(MCStreamer &Out, MCSection *Section,
-                ArrayRef<unsigned> ContributionOffsets,
-                const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
-                uint32_t IndexVersion);
+                                     MCSection *StrOffsetSection,
+                                     StringRef CurStrSection,
+                                     StringRef CurStrOffsetSection,
+                                     uint16_t Version);
+
+LLVM_ABI Error
+buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
+                    const CompileUnitIdentifiers &ID, StringRef DWPName);
+
+LLVM_ABI void
+writeIndex(MCStreamer &Out, MCSection *Section,
+           ArrayRef<unsigned> ContributionOffsets,
+           const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
+           uint32_t IndexVersion);
 
 } // namespace llvm
 #endif // LLVM_DWP_DWP_H
diff --git a/llvm/include/llvm/Demangle/Demangle.h b/llvm/include/llvm/Demangle/Demangle.h
index f0646d16101be..2c8f96751f7b5 100644
--- a/llvm/include/llvm/Demangle/Demangle.h
+++ b/llvm/include/llvm/Demangle/Demangle.h
@@ -34,7 +34,8 @@ enum : int {
 /// Returns a non-NULL pointer to a NUL-terminated C style string
 /// that should be explicitly freed, if successful. Otherwise, may return
 /// nullptr if mangled_name is not a valid mangling or is nullptr.
-LLVM_ABI char *itaniumDemangle(std::string_view mangled_name, bool ParseParams = true);
+LLVM_ABI char *itaniumDemangle(std::string_view mangled_name,
+                               bool ParseParams = true);
 
 enum MSDemangleFlags {
   MSDF_None = 0,
@@ -54,7 +55,8 @@ enum MSDemangleFlags {
 /// status receives one of the demangle_ enum entries above if it's not nullptr.
 /// Flags controls various details of the demangled representation.
 LLVM_ABI char *microsoftDemangle(std::string_view mangled_name, size_t *n_read,
-                        int *status, MSDemangleFlags Flags = MSDF_None);
+                                 int *status,
+                                 MSDemangleFlags Flags = MSDF_None);
 
 LLVM_ABI std::optional<size_t>
 getArm64ECInsertionPointInMangledName(std::string_view MangledName);
@@ -72,9 +74,10 @@ LLVM_ABI char *dlangDemangle(std::string_view MangledName);
 /// demangling occurred.
 LLVM_ABI std::string demangle(std::string_view MangledName);
 
-LLVM_ABI bool nonMicrosoftDemangle(std::string_view MangledName, std::string &Result,
-                          bool CanHaveLeadingDot = true,
-                          bool ParseParams = true);
+LLVM_ABI bool nonMicrosoftDemangle(std::string_view MangledName,
+                                   std::string &Result,
+                                   bool CanHaveLeadingDot = true,
+                                   bool ParseParams = true);
 
 /// "Partial" demangler. This supports demangling a string into an AST
 /// (typically an intermediate stage in itaniumDemangle) and querying certain
diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index bb3f08f0c4ffb..d61a008bdbf9e 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -16,10 +16,10 @@
 #ifndef DEMANGLE_ITANIUMDEMANGLE_H
 #define DEMANGLE_ITANIUMDEMANGLE_H
 
-#include "llvm/Support/Compiler.h"
 #include "DemangleConfig.h"
 #include "StringViewExtras.h"
 #include "Utility.h"
+#include "llvm/Support/Compiler.h"
 #include <algorithm>
 #include <cctype>
 #include <cstdint>
@@ -3050,7 +3050,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
   Node *parse(bool ParseParams = true);
 };
 
-LLVM_ABI const char* parse_discriminator(const char* first, const char* last);
+LLVM_ABI const char *parse_discriminator(const char *first, const char *last);
 
 // <name> ::= <nested-name> // N
 //        ::= <local-name> # See Scope Encoding below  // Z
diff --git a/llvm/include/llvm/Demangle/MicrosoftDemangle.h b/llvm/include/llvm/Demangle/MicrosoftDemangle.h
index 8c088538498f2..0a87f1e87f111 100644
--- a/llvm/include/llvm/Demangle/MicrosoftDemangle.h
+++ b/llvm/include/llvm/Demangle/MicrosoftDemangle.h
@@ -9,9 +9,9 @@
 #ifndef LLVM_DEMANGLE_MICROSOFTDEMANGLE_H
 #define LLVM_DEMANGLE_MICROSOFTDEMANGLE_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/Demangle/Demangle.h"
 #include "llvm/Demangle/MicrosoftDemangleNodes.h"
+#include "llvm/Support/Compiler.h"
 
 #include <cassert>
 #include <string_view>
diff --git a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
index 71a534b5afa4e..a2ec4a2208389 100644
--- a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
+++ b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
@@ -361,7 +361,8 @@ struct IdentifierNode : public Node {
   NodeArrayNode *TemplateParams = nullptr;
 
 protected:
-  LLVM_ABI void outputTemplateParameters(OutputBuffer &OB, OutputFlags Flags) const;
+  LLVM_ABI void outputTemplateParameters(OutputBuffer &OB,
+                                         OutputFlags Flags) const;
 };
 
 struct LLVM_ABI VcallThunkIdentifierNode : public IdentifierNode {



More information about the llvm-commits mailing list