[llvm] [llvm] annotate interfaces in llvm/DebugInfo for DLL export (PR #140778)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 17:37:05 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-debuginfo

Author: Andrew Rogers (andrurogerz)

<details>
<summary>Changes</summary>

## Purpose

This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm/DebugInfo` library. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build.

## Background

This effort is tracked in #<!-- -->109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst).  

The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`.

The following manual adjustments were also applied after running IDS on Linux:
- Add `#include "llvm/Support/Compiler.h"` to files where it was not auto-added by IDS due to no pre-existing block of include statements.
- Explicitly make classes non-copyable where needed to due IDS adding LLVM_ABI at the class level
- Add `LLVM_TEMPLATE_ABI` and `LLVM_EXPORT_TEMPLATE` to exported instantiated templates defined via X-macro

## Validation

Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:

- Windows with MSVC
- Windows with Clang
- Linux with GCC
- Linux with Clang
- Darwin with Clang

---

Patch is 348.18 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/140778.diff


168 Files Affected:

- (modified) llvm/include/llvm/DebugInfo/BTF/BTFContext.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/BTF/BTFParser.h (+10-8) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h (+9-7) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h (+23-18) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/CodeView.h (+4-2) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/CodeViewError.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h (+18-16) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h (+5-4) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h (+6-5) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h (+5-3) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h (+7-5) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h (+4-3) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h (+7-6) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h (+7-6) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h (+6-5) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugSubsection.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h (+14-9) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/EnumTables.h (+31-30) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/Formatters.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/GUID.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/Line.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/RecordName.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h (+10-9) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/StringsAndChecksums.h (+13-11) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/SymbolDumper.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h (+5-4) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/SymbolRecordMapping.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/SymbolSerializer.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/TypeDumpVisitor.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h (+10-8) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/TypeIndex.h (+4-3) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h (+15-14) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/TypeRecordHelpers.h (+5-4) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h (+29-26) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/TypeTableCollection.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h (+18-13) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h (+35-33) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h (+5-3) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFAttribute.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h (+8-6) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h (+10-9) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h (+6-5) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h (+42-39) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h (+4-3) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h (+58-56) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h (+10-8) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h (+4-3) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h (+6-5) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h (+6-6) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h (+51-45) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h (+20-16) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h (+46-40) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h (+5-4) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFLocationExpression.h (+3-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h (+18-14) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h (+15-11) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h (+26-20) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/CallSiteInfo.h (+11-8) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/DwarfTransformer.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/ExtractRanges.h (+13-11) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/FileWriter.h (+13-12) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h (+8-6) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/GsymCreator.h (+20-18) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/GsymReader.h (+29-25) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/Header.h (+6-5) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/InlineInfo.h (+10-9) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/LineTable.h (+7-6) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/LookupResult.h (+4-3) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/MergedFunctionsInfo.h (+8-6) 
- (modified) llvm/include/llvm/DebugInfo/GSYM/ObjectFileTransformer.h (+4-2) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVCompare.h (+6-5) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVElement.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVLine.h (+4-3) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h (+6-5) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h (+7-6) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h (+18-17) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVRange.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVReader.h (+5-4) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVScope.h (+14-13) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVSort.h (+11-9) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVSupport.h (+8-7) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/Core/LVType.h (+7-6) 
- (modified) llvm/include/llvm/DebugInfo/LogicalView/LVReaderHandler.h (+5-4) 
- (modified) llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h (+23-20) 
- (modified) llvm/include/llvm/DebugInfo/MSF/MSFCommon.h (+5-4) 
- (modified) llvm/include/llvm/DebugInfo/MSF/MSFError.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/PDB/GenericError.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/PDB/IPDBFrameData.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/IPDBInjectedSource.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/IPDBLineNumber.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h (+6-5) 
- (modified) llvm/include/llvm/DebugInfo/PDB/IPDBSession.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/IPDBSourceFile.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h (+16-14) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h (+19-18) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleList.h (+16-14) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/DbiStream.h (+37-34) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h (+29-25) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/FormatUtil.h (+12-10) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h (+11-9) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h (+7-5) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/Hash.h (+4-3) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h (+5-2) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/InfoStream.h (+16-15) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/InfoStreamBuilder.h (+13-11) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h (+41-40) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/LinePrinter.h (+26-24) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h (+16-15) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/NamedStreamMap.h (+16-15) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/NativeSourceFile.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/PDBFile.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h (+16-14) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/PDBStringTable.h (+11-9) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h (+11-10) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/PublicsStream.h (+7-6) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/RawError.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/SymbolCache.h (+21-17) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/SymbolStream.h (+7-6) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/TpiHashing.h (+3-2) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h (+30-26) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h (+13-9) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDB.h (+5-4) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBExtras.h (+24-20) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymDumper.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbol.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompiland.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolData.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolExe.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolLabel.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolThunk.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeArray.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypePointer.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolUnknown.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h (+2-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/UDTLayout.h (+23-17) 
- (modified) llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h (+5-5) 
- (modified) llvm/include/llvm/DebugInfo/Symbolize/Markup.h (+5-4) 
- (modified) llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h (+7-6) 
- (modified) llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h (+33-29) 
- (modified) llvm/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp (+2-1) 
- (modified) llvm/lib/DebugInfo/CodeView/SimpleTypeSerializer.cpp (+3-2) 


``````````diff
diff --git a/llvm/include/llvm/DebugInfo/BTF/BTFContext.h b/llvm/include/llvm/DebugInfo/BTF/BTFContext.h
index e3f7f57749ff1..ce2295a8711bd 100644
--- a/llvm/include/llvm/DebugInfo/BTF/BTFContext.h
+++ b/llvm/include/llvm/DebugInfo/BTF/BTFContext.h
@@ -16,10 +16,11 @@
 
 #include "llvm/DebugInfo/BTF/BTFParser.h"
 #include "llvm/DebugInfo/DIContext.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
-class BTFContext final : public DIContext {
+class LLVM_ABI BTFContext final : public DIContext {
   BTFParser BTF;
 
 public:
diff --git a/llvm/include/llvm/DebugInfo/BTF/BTFParser.h b/llvm/include/llvm/DebugInfo/BTF/BTFParser.h
index 53f39919950e5..f8b5b29738b3f 100644
--- a/llvm/include/llvm/DebugInfo/BTF/BTFParser.h
+++ b/llvm/include/llvm/DebugInfo/BTF/BTFParser.h
@@ -25,6 +25,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/DebugInfo/BTF/BTF.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/DataExtractor.h"
 
 namespace llvm {
@@ -74,32 +75,33 @@ class BTFParser {
 public:
   // Looks-up a string in the .BTF section's string table.
   // Offset is relative to string table start.
-  StringRef findString(uint32_t Offset) const;
+  LLVM_ABI StringRef findString(uint32_t Offset) const;
 
   // Search for line information for a specific address,
   // address match is exact (contrary to DWARFContext).
   // Return nullptr if no information found.
   // If information is present, return a pointer to object
   // owned by this class.
-  const BTF::BPFLineInfo *findLineInfo(SectionedAddress Address) const;
+  LLVM_ABI const BTF::BPFLineInfo *findLineInfo(SectionedAddress Address) const;
 
   // Search for CO-RE relocation information for a specific address.
   // Return nullptr if no information found.
   // If information is present, return a pointer to object
   // owned by this class.
-  const BTF::BPFFieldReloc *findFieldReloc(SectionedAddress Address) const;
+  LLVM_ABI const BTF::BPFFieldReloc *
+  findFieldReloc(SectionedAddress Address) const;
 
   // Return a human readable representation of the CO-RE relocation
   // record, this is for display purpose only.
   // See implementation for details.
-  void symbolize(const BTF::BPFFieldReloc *Reloc,
-                 SmallVectorImpl<char> &Result) const;
+  LLVM_ABI void symbolize(const BTF::BPFFieldReloc *Reloc,
+                          SmallVectorImpl<char> &Result) const;
 
   // Lookup BTF type definition with a specific index.
   // Return nullptr if no information found.
   // If information is present, return a pointer to object
   // owned by this class.
-  const BTF::CommonType *findType(uint32_t Id) const;
+  LLVM_ABI const BTF::CommonType *findType(uint32_t Id) const;
 
   // Return total number of known BTF types.
   size_t typesCount() const { return Types.size(); }
@@ -120,11 +122,11 @@ class BTFParser {
   // - state of the BTFParser might be incomplete but is not invalid,
   //   queries might be run against it, but some (or all) information
   //   might be unavailable;
-  Error parse(const ObjectFile &Obj, const ParseOptions &Opts);
+  LLVM_ABI Error parse(const ObjectFile &Obj, const ParseOptions &Opts);
   Error parse(const ObjectFile &Obj) { return parse(Obj, {true, true, true}); }
 
   // Return true if `Obj` has .BTF and .BTF.ext sections.
-  static bool hasBTFSections(const ObjectFile &Obj);
+  LLVM_ABI static bool hasBTFSections(const ObjectFile &Obj);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h b/llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
index fa2277343d5d4..3a36863ac7e32 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
@@ -16,6 +16,7 @@
 #include "llvm/DebugInfo/CodeView/TypeCollection.h"
 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 
 namespace llvm {
@@ -23,7 +24,7 @@ namespace codeview {
 
 class ContinuationRecordBuilder;
 
-class AppendingTypeTableBuilder : public TypeCollection {
+class LLVM_ABI AppendingTypeTableBuilder : public TypeCollection {
 
   BumpPtrAllocator &RecordStorage;
   SimpleTypeSerializer SimpleSerializer;
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h b/llvm/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h
index c629018fd109f..7b230efe695af 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h
@@ -10,6 +10,7 @@
 #define LLVM_DEBUGINFO_CODEVIEW_CVSYMBOLVISITOR_H
 
 #include "llvm/DebugInfo/CodeView/CVRecord.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
@@ -24,14 +25,15 @@ class CVSymbolVisitor {
     std::optional<uint32_t> ChildRecursiveDepth;
   };
 
-  CVSymbolVisitor(SymbolVisitorCallbacks &Callbacks);
+  LLVM_ABI CVSymbolVisitor(SymbolVisitorCallbacks &Callbacks);
 
-  Error visitSymbolRecord(CVSymbol &Record);
-  Error visitSymbolRecord(CVSymbol &Record, uint32_t Offset);
-  Error visitSymbolStream(const CVSymbolArray &Symbols);
-  Error visitSymbolStream(const CVSymbolArray &Symbols, uint32_t InitialOffset);
-  Error visitSymbolStreamFiltered(const CVSymbolArray &Symbols,
-                                  const FilterOptions &Filter);
+  LLVM_ABI Error visitSymbolRecord(CVSymbol &Record);
+  LLVM_ABI Error visitSymbolRecord(CVSymbol &Record, uint32_t Offset);
+  LLVM_ABI Error visitSymbolStream(const CVSymbolArray &Symbols);
+  LLVM_ABI Error visitSymbolStream(const CVSymbolArray &Symbols,
+                                   uint32_t InitialOffset);
+  LLVM_ABI Error visitSymbolStreamFiltered(const CVSymbolArray &Symbols,
+                                           const FilterOptions &Filter);
 
 private:
   SymbolVisitorCallbacks &Callbacks;
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h b/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
index 7780e233cab3b..c80cf2d6801a6 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
@@ -12,6 +12,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/DebugInfo/CodeView/CVRecord.h"
 #include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
@@ -30,24 +31,28 @@ enum VisitorDataSource {
                     // supply the bytes.
 };
 
-Error visitTypeRecord(CVType &Record, TypeIndex Index,
-                      TypeVisitorCallbacks &Callbacks,
-                      VisitorDataSource Source = VDS_BytesPresent);
-Error visitTypeRecord(CVType &Record, TypeVisitorCallbacks &Callbacks,
-                      VisitorDataSource Source = VDS_BytesPresent);
-
-Error visitMemberRecord(CVMemberRecord Record, TypeVisitorCallbacks &Callbacks,
-                        VisitorDataSource Source = VDS_BytesPresent);
-Error visitMemberRecord(TypeLeafKind Kind, ArrayRef<uint8_t> Record,
-                        TypeVisitorCallbacks &Callbacks);
-
-Error visitMemberRecordStream(ArrayRef<uint8_t> FieldList,
-                              TypeVisitorCallbacks &Callbacks);
-
-Error visitTypeStream(const CVTypeArray &Types, TypeVisitorCallbacks &Callbacks,
-                      VisitorDataSource Source = VDS_BytesPresent);
-Error visitTypeStream(CVTypeRange Types, TypeVisitorCallbacks &Callbacks);
-Error visitTypeStream(TypeCollection &Types, TypeVisitorCallbacks &Callbacks);
+LLVM_ABI Error visitTypeRecord(CVType &Record, TypeIndex Index,
+                               TypeVisitorCallbacks &Callbacks,
+                               VisitorDataSource Source = VDS_BytesPresent);
+LLVM_ABI Error visitTypeRecord(CVType &Record, TypeVisitorCallbacks &Callbacks,
+                               VisitorDataSource Source = VDS_BytesPresent);
+
+LLVM_ABI Error visitMemberRecord(CVMemberRecord Record,
+                                 TypeVisitorCallbacks &Callbacks,
+                                 VisitorDataSource Source = VDS_BytesPresent);
+LLVM_ABI Error visitMemberRecord(TypeLeafKind Kind, ArrayRef<uint8_t> Record,
+                                 TypeVisitorCallbacks &Callbacks);
+
+LLVM_ABI Error visitMemberRecordStream(ArrayRef<uint8_t> FieldList,
+                                       TypeVisitorCallbacks &Callbacks);
+
+LLVM_ABI Error visitTypeStream(const CVTypeArray &Types,
+                               TypeVisitorCallbacks &Callbacks,
+                               VisitorDataSource Source = VDS_BytesPresent);
+LLVM_ABI Error visitTypeStream(CVTypeRange Types,
+                               TypeVisitorCallbacks &Callbacks);
+LLVM_ABI Error visitTypeStream(TypeCollection &Types,
+                               TypeVisitorCallbacks &Callbacks);
 
 } // end namespace codeview
 } // end namespace llvm
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
index 5cdff5ff0e82f..cf253e70a6d56 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_DEBUGINFO_CODEVIEW_CODEVIEW_H
 #define LLVM_DEBUGINFO_CODEVIEW_CODEVIEW_H
 
+#include "llvm/Support/Compiler.h"
 #include <cinttypes>
 #include <type_traits>
 
@@ -555,9 +556,10 @@ enum class EncodedFramePtrReg : uint8_t {
   BasePtr = 3,
 };
 
-RegisterId decodeFramePtrReg(EncodedFramePtrReg EncodedReg, CPUType CPU);
+LLVM_ABI RegisterId decodeFramePtrReg(EncodedFramePtrReg EncodedReg,
+                                      CPUType CPU);
 
-EncodedFramePtrReg encodeFramePtrReg(RegisterId Reg, CPUType CPU);
+LLVM_ABI EncodedFramePtrReg encodeFramePtrReg(RegisterId Reg, CPUType CPU);
 
 /// These values correspond to the THUNK_ORDINAL enumeration.
 enum class ThunkOrdinal : uint8_t {
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeViewError.h b/llvm/include/llvm/DebugInfo/CodeView/CodeViewError.h
index 17eb06c242a95..bb73a95f9eadd 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CodeViewError.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CodeViewError.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_DEBUGINFO_CODEVIEW_CODEVIEWERROR_H
 #define LLVM_DEBUGINFO_CODEVIEW_CODEVIEWERROR_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
@@ -31,7 +32,7 @@ struct is_error_code_enum<llvm::codeview::cv_error_code> : std::true_type {};
 
 namespace llvm {
 namespace codeview {
-const std::error_category &CVErrorCategory();
+LLVM_ABI const std::error_category &CVErrorCategory();
 
 inline std::error_code make_error_code(cv_error_code E) {
   return std::error_code(static_cast<int>(E), CVErrorCategory());
@@ -43,7 +44,7 @@ class CodeViewError : public ErrorInfo<CodeViewError, StringError> {
   using ErrorInfo<CodeViewError,
                   StringError>::ErrorInfo; // inherit constructors
   CodeViewError(const Twine &S) : ErrorInfo(S, cv_error_code::unspecified) {}
-  static char ID;
+  LLVM_ABI static char ID;
 };
 
 } // namespace codeview
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h b/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
index 29ba0c3eb7850..668428e487e11 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
@@ -14,6 +14,7 @@
 #include "llvm/DebugInfo/CodeView/CodeViewError.h"
 #include "llvm/Support/BinaryStreamReader.h"
 #include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <cassert>
 #include <cstdint>
@@ -61,10 +62,10 @@ class CodeViewRecordIO {
   explicit CodeViewRecordIO(CodeViewRecordStreamer &Streamer)
       : Streamer(&Streamer) {}
 
-  Error beginRecord(std::optional<uint32_t> MaxLength);
-  Error endRecord();
+  LLVM_ABI Error beginRecord(std::optional<uint32_t> MaxLength);
+  LLVM_ABI Error endRecord();
 
-  Error mapInteger(TypeIndex &TypeInd, const Twine &Comment = "");
+  LLVM_ABI Error mapInteger(TypeIndex &TypeInd, const Twine &Comment = "");
 
   bool isStreaming() const {
     return (Streamer != nullptr) && (Reader == nullptr) && (Writer == nullptr);
@@ -76,7 +77,7 @@ class CodeViewRecordIO {
     return (Writer != nullptr) && (Streamer == nullptr) && (Reader == nullptr);
   }
 
-  uint32_t maxFieldLength() const;
+  LLVM_ABI uint32_t maxFieldLength() const;
 
   template <typename T> Error mapObject(T &Value) {
     if (isStreaming()) {
@@ -130,14 +131,14 @@ class CodeViewRecordIO {
     return Error::success();
   }
 
-  Error mapEncodedInteger(int64_t &Value, const Twine &Comment = "");
-  Error mapEncodedInteger(uint64_t &Value, const Twine &Comment = "");
-  Error mapEncodedInteger(APSInt &Value, const Twine &Comment = "");
-  Error mapStringZ(StringRef &Value, const Twine &Comment = "");
-  Error mapGuid(GUID &Guid, const Twine &Comment = "");
+  LLVM_ABI Error mapEncodedInteger(int64_t &Value, const Twine &Comment = "");
+  LLVM_ABI Error mapEncodedInteger(uint64_t &Value, const Twine &Comment = "");
+  LLVM_ABI Error mapEncodedInteger(APSInt &Value, const Twine &Comment = "");
+  LLVM_ABI Error mapStringZ(StringRef &Value, const Twine &Comment = "");
+  LLVM_ABI Error mapGuid(GUID &Guid, const Twine &Comment = "");
 
-  Error mapStringZVectorZ(std::vector<StringRef> &Value,
-                          const Twine &Comment = "");
+  LLVM_ABI Error mapStringZVectorZ(std::vector<StringRef> &Value,
+                                   const Twine &Comment = "");
 
   template <typename SizeType, typename T, typename ElementMapper>
   Error mapVectorN(T &Items, const ElementMapper &Mapper,
@@ -197,12 +198,13 @@ class CodeViewRecordIO {
     return Error::success();
   }
 
-  Error mapByteVectorTail(ArrayRef<uint8_t> &Bytes, const Twine &Comment = "");
-  Error mapByteVectorTail(std::vector<uint8_t> &Bytes,
-                          const Twine &Comment = "");
+  LLVM_ABI Error mapByteVectorTail(ArrayRef<uint8_t> &Bytes,
+                                   const Twine &Comment = "");
+  LLVM_ABI Error mapByteVectorTail(std::vector<uint8_t> &Bytes,
+                                   const Twine &Comment = "");
 
-  Error padToAlignment(uint32_t Align);
-  Error skipPadding();
+  LLVM_ABI Error padToAlignment(uint32_t Align);
+  LLVM_ABI Error skipPadding();
 
   uint64_t getStreamedLen() {
     if (isStreaming())
diff --git a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
index 84cef520a2f46..805cedf1a879e 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
@@ -15,6 +15,7 @@
 #include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
 #include "llvm/Support/BinaryByteStream.h"
 #include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <vector>
 
@@ -38,17 +39,17 @@ class ContinuationRecordBuilder {
                              std::optional<TypeIndex> RefersTo);
 
 public:
-  ContinuationRecordBuilder();
-  ~ContinuationRecordBuilder();
+  LLVM_ABI ContinuationRecordBuilder();
+  LLVM_ABI ~ContinuationRecordBuilder();
 
-  void begin(ContinuationRecordKind RecordKind);
+  LLVM_ABI void begin(ContinuationRecordKind RecordKind);
 
   // This template is explicitly instantiated in the implementation file for all
   // supported types.  The method itself is ugly, so inlining it into the header
   // file clutters an otherwise straightforward interface.
   template <typename RecordType> void writeMemberType(RecordType &Record);
 
-  std::vector<CVType> end(TypeIndex Index);
+  LLVM_ABI std::vector<CVType> end(TypeIndex Index);
 };
 } // namespace codeview
 } // namespace llvm
diff --git a/llvm/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h b/llvm/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
index 615fd216e6550..8f6b413ad8ae3 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
@@ -17,6 +17,7 @@
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/BinaryStreamArray.h"
 #include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <cstdint>
 #include <vector>
@@ -42,8 +43,8 @@ template <> struct VarStreamArrayExtractor<codeview::FileChecksumEntry> {
 public:
   using ContextType = void;
 
-  Error operator()(BinaryStreamRef Stream, uint32_t &Len,
-                   codeview::FileChecksumEntry &Item);
+  LLVM_ABI Error operator()(BinaryStreamRef Stream, uint32_t &Len,
+                            codeview::FileChecksumEntry &Item);
 };
 
 namespace codeview {
@@ -62,8 +63,8 @@ class DebugChecksumsSubsectionRef final : public DebugSubsectionRef {
 
   bool valid() const { return Checksums.valid(); }
 
-  Error initialize(BinaryStreamReader Reader);
-  Error initialize(BinaryStreamRef Stream);
+  LLVM_ABI Error initialize(BinaryStreamReader Reader);
+  LLVM_ABI Error initialize(BinaryStreamRef Stream);
 
   Iterator begin() const { return Checksums.begin(); }
   Iterator end() const { return Checksums.end(); }
@@ -74,7 +75,7 @@ class DebugChecksumsSubsectionRef final : public DebugSubsectionRef {
   FileChecksumArray Checksums;
 };
 
-class DebugChecksumsSubsection final : public DebugSubsection {
+class LLVM_ABI DebugChecksumsSubsection final : public DebugSubsection {
 public:
   explicit DebugChecksumsSubsection(DebugStringTableSubsection &Strings);
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h b/llvm/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h
index e21873a3af8f7..d0e391779abe0 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h
@@ -13,6 +13,7 @@
 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
 #include "llvm/Support/BinaryStreamArray.h"
 #include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <cstdint>
 #include <map>
@@ -34,8 +35,8 @@ class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef {
     return S->kind() == DebugSubsectionKind::CrossScopeExports;
   }
 
-  Error initialize(BinaryStreamReader Reader);
-  Error initialize(BinaryStreamRef Stream);
+  LLVM_ABI Error initialize(BinaryStreamReader Reader);
+  LLVM_ABI Error initialize(BinaryStreamRef Stream);
 
   Iterator begin() const { return References.begin(); }
   Iterator end() const { return References.end(); }
@@ -44,7 +45,8 @@ class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef {
   FixedStreamArray<CrossModuleExport> References;
 };
 
-class DebugCrossModuleExportsSubsection final : public DebugSubsection {
+class LLVM_ABI DebugCrossModuleExportsSubsection final
+    : public DebugSubsection {
 public:
   DebugCrossModuleExportsSubsection()
       : DebugSubsection(DebugSubsectionKind::CrossScopeExports) {}
diff --git a/llvm/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h b/llvm/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h
index 198ce4a8b4e4c..49ea04c4ecd69 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h
@@ -15,6 +15,7 @@
 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
 #include "llvm/Support/BinaryStreamArray.h"
 #include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Error.h"
 #include <cstdint>
@@ -37,8 +38,8 @@ template <> struct VarStreamArrayExtractor<codeview::CrossModuleImportItem> {
 public:
   using ContextType = void;
 
-  Error operator()(BinaryStreamRef Stream, uint32_t &Len,
-                   codeview::CrossModuleImportItem &Item);
+  LLVM_ABI Error operator()(BinaryStreamRef Stream, uint32_t &Len,
+                            codeview::CrossModuleImportItem &Item);
 };
 
 namespace codeview {
@@ -57,8 +58,8 @@ class DebugCrossModuleImportsSubsectionRef final : public DebugSubsectionRef {
     return S->kind() == DebugSubsectionKind::CrossScopeImports;
   }
 
-  Error initialize(BinaryStreamReader Reader);
-  Error initialize(BinaryStreamRef Stream);
+ ...
[truncated]

``````````

</details>


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


More information about the llvm-commits mailing list