[llvm] [llvm] annotate interfaces in llvm/TextAPI for DLL export (PR #143447)
Andrew Rogers via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 14:52:52 PDT 2025
https://github.com/andrurogerz created https://github.com/llvm/llvm-project/pull/143447
## Purpose
This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm/TextAPI` 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).
These changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`.
## 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
>From d16fc305256cc28e24d146c78fd94be4995220d8 Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 9 Jun 2025 14:50:06 -0700
Subject: [PATCH 1/2] [llvm] IDS auto codemod for TextAPI library
---
llvm/include/llvm-c/Error.h | 15 +--
llvm/include/llvm/TargetParser/Triple.h | 105 ++++++++++----------
llvm/include/llvm/TextAPI/Architecture.h | 15 +--
llvm/include/llvm/TextAPI/ArchitectureSet.h | 13 +--
llvm/include/llvm/TextAPI/DylibReader.h | 7 +-
llvm/include/llvm/TextAPI/InterfaceFile.h | 29 +++---
llvm/include/llvm/TextAPI/PackedVersion.h | 9 +-
llvm/include/llvm/TextAPI/Platform.h | 15 +--
llvm/include/llvm/TextAPI/Record.h | 17 ++--
llvm/include/llvm/TextAPI/RecordVisitor.h | 5 +-
llvm/include/llvm/TextAPI/RecordsSlice.h | 29 +++---
llvm/include/llvm/TextAPI/Symbol.h | 7 +-
llvm/include/llvm/TextAPI/SymbolSet.h | 9 +-
llvm/include/llvm/TextAPI/Target.h | 15 +--
llvm/include/llvm/TextAPI/TextAPIError.h | 3 +-
llvm/include/llvm/TextAPI/TextAPIReader.h | 5 +-
llvm/include/llvm/TextAPI/TextAPIWriter.h | 3 +-
llvm/include/llvm/TextAPI/Utils.h | 15 +--
18 files changed, 167 insertions(+), 149 deletions(-)
diff --git a/llvm/include/llvm-c/Error.h b/llvm/include/llvm-c/Error.h
index 874bbcfe8f21a..31a991fe48418 100644
--- a/llvm/include/llvm-c/Error.h
+++ b/llvm/include/llvm-c/Error.h
@@ -14,6 +14,7 @@
#ifndef LLVM_C_ERROR_H
#define LLVM_C_ERROR_H
+#include "llvm/Support/Compiler.h"
#include "llvm-c/ExternC.h"
LLVM_C_EXTERN_C_BEGIN
@@ -41,7 +42,7 @@ typedef const void *LLVMErrorTypeId;
* Returns the type id for the given error instance, which must be a failure
* value (i.e. non-null).
*/
-LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err);
+LLVM_ABI LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err);
/**
* Dispose of the given error without handling it. This operation consumes the
@@ -49,7 +50,7 @@ LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err);
* Note: This method *only* needs to be called if the error is not being passed
* to some other consuming operation, e.g. LLVMGetErrorMessage.
*/
-void LLVMConsumeError(LLVMErrorRef Err);
+LLVM_ABI void LLVMConsumeError(LLVMErrorRef Err);
/**
* Report a fatal error if Err is a failure value.
@@ -57,7 +58,7 @@ void LLVMConsumeError(LLVMErrorRef Err);
* This function can be used to wrap calls to fallible functions ONLY when it is
* known that the Error will always be a success value.
*/
-void LLVMCantFail(LLVMErrorRef Err);
+LLVM_ABI void LLVMCantFail(LLVMErrorRef Err);
/**
* Returns the given string's error message. This operation consumes the error,
@@ -65,22 +66,22 @@ void LLVMCantFail(LLVMErrorRef Err);
* The caller is responsible for disposing of the string by calling
* LLVMDisposeErrorMessage.
*/
-char *LLVMGetErrorMessage(LLVMErrorRef Err);
+LLVM_ABI char *LLVMGetErrorMessage(LLVMErrorRef Err);
/**
* Dispose of the given error message.
*/
-void LLVMDisposeErrorMessage(char *ErrMsg);
+LLVM_ABI void LLVMDisposeErrorMessage(char *ErrMsg);
/**
* Returns the type id for llvm StringError.
*/
-LLVMErrorTypeId LLVMGetStringErrorTypeId(void);
+LLVM_ABI LLVMErrorTypeId LLVMGetStringErrorTypeId(void);
/**
* Create a StringError.
*/
-LLVMErrorRef LLVMCreateStringError(const char *ErrMsg);
+LLVM_ABI LLVMErrorRef LLVMCreateStringError(const char *ErrMsg);
/**
* @}
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index 7fd5278f1ed53..60b79abed47f7 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -9,6 +9,7 @@
#ifndef LLVM_TARGETPARSER_TRIPLE_H
#define LLVM_TARGETPARSER_TRIPLE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/VersionTuple.h"
@@ -348,9 +349,9 @@ class Triple {
/// triple fields unknown.
Triple() = default;
- explicit Triple(const Twine &Str);
- Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
- Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
+ LLVM_ABI explicit Triple(const Twine &Str);
+ LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
+ LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
const Twine &EnvironmentStr);
bool operator==(const Triple &Other) const {
@@ -381,7 +382,7 @@ class Triple {
/// reasonably be done). In particular, it handles the common case in which
/// otherwise valid components are in the wrong order. \p Form is used to
/// specify the output canonical form.
- static std::string normalize(StringRef Str,
+ LLVM_ABI static std::string normalize(StringRef Str,
CanonicalForm Form = CanonicalForm::ANY);
/// Return the normalized form of this triple's string.
@@ -417,7 +418,7 @@ class Triple {
/// triple, if present.
///
/// For example, "fooos1.2.3" would return (1, 2, 3).
- VersionTuple getEnvironmentVersion() const;
+ LLVM_ABI VersionTuple getEnvironmentVersion() const;
/// Get the object format for this triple.
ObjectFormatType getObjectFormat() const { return ObjectFormat; }
@@ -426,7 +427,7 @@ class Triple {
/// present.
///
/// For example, "fooos1.2.3" would return (1, 2, 3).
- VersionTuple getOSVersion() const;
+ LLVM_ABI VersionTuple getOSVersion() const;
/// Return just the major version number, this is specialized because it is a
/// common query.
@@ -436,26 +437,26 @@ class Triple {
/// "darwin" versions to the corresponding OS X versions. This may also be
/// called with IOS triples but the OS X version number is just set to a
/// constant 10.4.0 in that case. Returns true if successful.
- bool getMacOSXVersion(VersionTuple &Version) const;
+ LLVM_ABI bool getMacOSXVersion(VersionTuple &Version) const;
/// Parse the version number as with getOSVersion. This should only be called
/// with IOS or generic triples.
- VersionTuple getiOSVersion() const;
+ LLVM_ABI VersionTuple getiOSVersion() const;
/// Parse the version number as with getOSVersion. This should only be called
/// with WatchOS or generic triples.
- VersionTuple getWatchOSVersion() const;
+ LLVM_ABI VersionTuple getWatchOSVersion() const;
/// Parse the version number as with getOSVersion.
- VersionTuple getDriverKitVersion() const;
+ LLVM_ABI VersionTuple getDriverKitVersion() const;
/// Parse the Vulkan version number from the OSVersion and SPIR-V version
/// (SubArch). This should only be called with Vulkan SPIR-V triples.
- VersionTuple getVulkanVersion() const;
+ LLVM_ABI VersionTuple getVulkanVersion() const;
/// Parse the DXIL version number from the OSVersion and DXIL version
/// (SubArch). This should only be called with DXIL triples.
- VersionTuple getDXILVersion() const;
+ LLVM_ABI VersionTuple getDXILVersion() const;
/// @}
/// @name Direct Component Access
@@ -469,34 +470,34 @@ class Triple {
bool empty() const { return Data.empty(); }
/// Get the architecture (first) component of the triple.
- StringRef getArchName() const;
+ LLVM_ABI StringRef getArchName() const;
/// Get the vendor (second) component of the triple.
- StringRef getVendorName() const;
+ LLVM_ABI StringRef getVendorName() const;
/// Get the operating system (third) component of the triple.
- StringRef getOSName() const;
+ LLVM_ABI StringRef getOSName() const;
/// Get the optional environment (fourth) component of the triple, or "" if
/// empty.
- StringRef getEnvironmentName() const;
+ LLVM_ABI StringRef getEnvironmentName() const;
/// Get the operating system and optional environment components as a single
/// string (separated by a '-' if the environment component is present).
- StringRef getOSAndEnvironmentName() const;
+ LLVM_ABI StringRef getOSAndEnvironmentName() const;
/// Get the version component of the environment component as a single
/// string (the version after the environment).
///
/// For example, "fooos1.2.3" would return "1.2.3".
- StringRef getEnvironmentVersionString() const;
+ LLVM_ABI StringRef getEnvironmentVersionString() const;
/// @}
/// @name Convenience Predicates
/// @{
/// Returns the pointer width of this architecture.
- static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch);
+ LLVM_ABI static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch);
/// Returns the pointer width of this architecture.
unsigned getArchPointerBitWidth() const {
@@ -504,7 +505,7 @@ class Triple {
}
/// Returns the trampoline size in bytes for this configuration.
- unsigned getTrampolineSize() const;
+ LLVM_ABI unsigned getTrampolineSize() const;
/// Test whether the architecture is 64-bit
///
@@ -513,17 +514,17 @@ class Triple {
/// 16-bit. The inner details of pointer width for particular architectures
/// is not summed up in the triple, and so only a coarse grained predicate
/// system is provided.
- bool isArch64Bit() const;
+ LLVM_ABI bool isArch64Bit() const;
/// Test whether the architecture is 32-bit
///
/// Note that this tests for 32-bit pointer width, and nothing else.
- bool isArch32Bit() const;
+ LLVM_ABI bool isArch32Bit() const;
/// Test whether the architecture is 16-bit
///
/// Note that this tests for 16-bit pointer width, and nothing else.
- bool isArch16Bit() const;
+ LLVM_ABI bool isArch16Bit() const;
/// Helper function for doing comparisons against version numbers included in
/// the target triple.
@@ -544,7 +545,7 @@ class Triple {
/// Comparison function for checking OS X version compatibility, which handles
/// supporting skewed version numbering schemes used by the "darwin" triples.
- bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
+ LLVM_ABI bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
unsigned Micro = 0) const;
/// Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
@@ -1143,38 +1144,38 @@ class Triple {
/// @{
/// Set the architecture (first) component of the triple to a known type.
- void setArch(ArchType Kind, SubArchType SubArch = NoSubArch);
+ LLVM_ABI void setArch(ArchType Kind, SubArchType SubArch = NoSubArch);
/// Set the vendor (second) component of the triple to a known type.
- void setVendor(VendorType Kind);
+ LLVM_ABI void setVendor(VendorType Kind);
/// Set the operating system (third) component of the triple to a known type.
- void setOS(OSType Kind);
+ LLVM_ABI void setOS(OSType Kind);
/// Set the environment (fourth) component of the triple to a known type.
- void setEnvironment(EnvironmentType Kind);
+ LLVM_ABI void setEnvironment(EnvironmentType Kind);
/// Set the object file format.
- void setObjectFormat(ObjectFormatType Kind);
+ LLVM_ABI void setObjectFormat(ObjectFormatType Kind);
/// Set all components to the new triple \p Str.
- void setTriple(const Twine &Str);
+ LLVM_ABI void setTriple(const Twine &Str);
/// Set the architecture (first) component of the triple by name.
- void setArchName(StringRef Str);
+ LLVM_ABI void setArchName(StringRef Str);
/// Set the vendor (second) component of the triple by name.
- void setVendorName(StringRef Str);
+ LLVM_ABI void setVendorName(StringRef Str);
/// Set the operating system (third) component of the triple by name.
- void setOSName(StringRef Str);
+ LLVM_ABI void setOSName(StringRef Str);
/// Set the optional environment (fourth) component of the triple by name.
- void setEnvironmentName(StringRef Str);
+ LLVM_ABI void setEnvironmentName(StringRef Str);
/// Set the operating system and optional environment components with a single
/// string.
- void setOSAndEnvironmentName(StringRef Str);
+ LLVM_ABI void setOSAndEnvironmentName(StringRef Str);
/// @}
/// @name Helpers to build variants of a particular triple.
@@ -1186,7 +1187,7 @@ class Triple {
///
/// \returns A new triple with a 32-bit architecture or an unknown
/// architecture if no such variant can be found.
- llvm::Triple get32BitArchVariant() const;
+ LLVM_ABI llvm::Triple get32BitArchVariant() const;
/// Form a triple with a 64-bit variant of the current architecture.
///
@@ -1194,7 +1195,7 @@ class Triple {
///
/// \returns A new triple with a 64-bit architecture or an unknown
/// architecture if no such variant can be found.
- llvm::Triple get64BitArchVariant() const;
+ LLVM_ABI llvm::Triple get64BitArchVariant() const;
/// Form a triple with a big endian variant of the current architecture.
///
@@ -1202,7 +1203,7 @@ class Triple {
///
/// \returns A new triple with a big endian architecture or an unknown
/// architecture if no such variant can be found.
- llvm::Triple getBigEndianArchVariant() const;
+ LLVM_ABI llvm::Triple getBigEndianArchVariant() const;
/// Form a triple with a little endian variant of the current architecture.
///
@@ -1210,68 +1211,68 @@ class Triple {
///
/// \returns A new triple with a little endian architecture or an unknown
/// architecture if no such variant can be found.
- llvm::Triple getLittleEndianArchVariant() const;
+ LLVM_ABI llvm::Triple getLittleEndianArchVariant() const;
/// Tests whether the target triple is little endian.
///
/// \returns true if the triple is little endian, false otherwise.
- bool isLittleEndian() const;
+ LLVM_ABI bool isLittleEndian() const;
/// Test whether target triples are compatible.
- bool isCompatibleWith(const Triple &Other) const;
+ LLVM_ABI bool isCompatibleWith(const Triple &Other) const;
/// Test whether the target triple is for a GPU.
bool isGPU() const { return isSPIRV() || isNVPTX() || isAMDGPU(); }
/// Merge target triples.
- std::string merge(const Triple &Other) const;
+ LLVM_ABI std::string merge(const Triple &Other) const;
/// Some platforms have different minimum supported OS versions that
/// varies by the architecture specified in the triple. This function
/// returns the minimum supported OS version for this triple if one an exists,
/// or an invalid version tuple if this triple doesn't have one.
- VersionTuple getMinimumSupportedOSVersion() const;
+ LLVM_ABI VersionTuple getMinimumSupportedOSVersion() const;
/// @}
/// @name Static helpers for IDs.
/// @{
/// Get the canonical name for the \p Kind architecture.
- static StringRef getArchTypeName(ArchType Kind);
+ LLVM_ABI static StringRef getArchTypeName(ArchType Kind);
/// Get the architecture name based on \p Kind and \p SubArch.
- static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
+ LLVM_ABI static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
/// Get the "prefix" canonical name for the \p Kind architecture. This is the
/// prefix used by the architecture specific builtins, and is suitable for
/// passing to \see Intrinsic::getIntrinsicForClangBuiltin().
///
/// \return - The architecture prefix, or 0 if none is defined.
- static StringRef getArchTypePrefix(ArchType Kind);
+ LLVM_ABI static StringRef getArchTypePrefix(ArchType Kind);
/// Get the canonical name for the \p Kind vendor.
- static StringRef getVendorTypeName(VendorType Kind);
+ LLVM_ABI static StringRef getVendorTypeName(VendorType Kind);
/// Get the canonical name for the \p Kind operating system.
- static StringRef getOSTypeName(OSType Kind);
+ LLVM_ABI static StringRef getOSTypeName(OSType Kind);
/// Get the canonical name for the \p Kind environment.
- static StringRef getEnvironmentTypeName(EnvironmentType Kind);
+ LLVM_ABI static StringRef getEnvironmentTypeName(EnvironmentType Kind);
/// Get the name for the \p Object format.
- static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat);
+ LLVM_ABI static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat);
/// @}
/// @name Static helpers for converting alternate architecture names.
/// @{
/// The canonical type for the given LLVM architecture name (e.g., "x86").
- static ArchType getArchTypeForLLVMName(StringRef Str);
+ LLVM_ABI static ArchType getArchTypeForLLVMName(StringRef Str);
/// @}
/// Returns a canonicalized OS version number for the specified OS.
- static VersionTuple getCanonicalVersionForOS(OSType OSKind,
+ LLVM_ABI static VersionTuple getCanonicalVersionForOS(OSType OSKind,
const VersionTuple &Version);
};
diff --git a/llvm/include/llvm/TextAPI/Architecture.h b/llvm/include/llvm/TextAPI/Architecture.h
index 978359995074b..f9b9659c05ea3 100644
--- a/llvm/include/llvm/TextAPI/Architecture.h
+++ b/llvm/include/llvm/TextAPI/Architecture.h
@@ -13,6 +13,7 @@
#ifndef LLVM_TEXTAPI_ARCHITECTURE_H
#define LLVM_TEXTAPI_ARCHITECTURE_H
+#include "llvm/Support/Compiler.h"
#include <cstdint>
#include <utility>
@@ -32,24 +33,24 @@ enum Architecture : uint8_t {
};
/// Convert a CPU Type and Subtype pair to an architecture slice.
-Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType);
+LLVM_ABI Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType);
/// Convert a name to an architecture slice.
-Architecture getArchitectureFromName(StringRef Name);
+LLVM_ABI Architecture getArchitectureFromName(StringRef Name);
/// Convert an architecture slice to a string.
-StringRef getArchitectureName(Architecture Arch);
+LLVM_ABI StringRef getArchitectureName(Architecture Arch);
/// Convert an architecture slice to a CPU Type and Subtype pair.
-std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch);
+LLVM_ABI std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch);
/// Convert a target to an architecture slice.
-Architecture mapToArchitecture(const llvm::Triple &Target);
+LLVM_ABI Architecture mapToArchitecture(const llvm::Triple &Target);
/// Check if architecture is 64 bit.
-bool is64Bit(Architecture);
+LLVM_ABI bool is64Bit(Architecture);
-raw_ostream &operator<<(raw_ostream &OS, Architecture Arch);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, Architecture Arch);
} // end namespace MachO.
} // end namespace llvm.
diff --git a/llvm/include/llvm/TextAPI/ArchitectureSet.h b/llvm/include/llvm/TextAPI/ArchitectureSet.h
index 2cce9dbf0d80c..a7d3394c99821 100644
--- a/llvm/include/llvm/TextAPI/ArchitectureSet.h
+++ b/llvm/include/llvm/TextAPI/ArchitectureSet.h
@@ -13,6 +13,7 @@
#ifndef LLVM_TEXTAPI_ARCHITECTURESET_H
#define LLVM_TEXTAPI_ARCHITECTURESET_H
+#include "llvm/Support/Compiler.h"
#include "llvm/TextAPI/Architecture.h"
#include <cstddef>
#include <iterator>
@@ -38,7 +39,7 @@ class ArchitectureSet {
constexpr ArchitectureSet() = default;
constexpr ArchitectureSet(ArchSetType Raw) : ArchSet(Raw) {}
ArchitectureSet(Architecture Arch) : ArchitectureSet() { set(Arch); }
- ArchitectureSet(const std::vector<Architecture> &Archs);
+ LLVM_ABI ArchitectureSet(const std::vector<Architecture> &Archs);
static ArchitectureSet All() { return ArchitectureSet(EndIndexVal); }
@@ -61,7 +62,7 @@ class ArchitectureSet {
return (ArchSet & Archs.ArchSet) == Archs.ArchSet;
}
- size_t count() const;
+ LLVM_ABI size_t count() const;
bool empty() const { return ArchSet == 0; }
@@ -158,9 +159,9 @@ class ArchitectureSet {
const_iterator begin() const { return {&ArchSet}; }
const_iterator end() const { return {&ArchSet, EndIndexVal}; }
- operator std::string() const;
- operator std::vector<Architecture>() const;
- void print(raw_ostream &OS) const;
+ LLVM_ABI operator std::string() const;
+ LLVM_ABI operator std::vector<Architecture>() const;
+ LLVM_ABI void print(raw_ostream &OS) const;
};
inline ArchitectureSet operator|(const Architecture &lhs,
@@ -168,7 +169,7 @@ inline ArchitectureSet operator|(const Architecture &lhs,
return ArchitectureSet(lhs) | ArchitectureSet(rhs);
}
-raw_ostream &operator<<(raw_ostream &OS, ArchitectureSet Set);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, ArchitectureSet Set);
} // end namespace MachO.
} // end namespace llvm.
diff --git a/llvm/include/llvm/TextAPI/DylibReader.h b/llvm/include/llvm/TextAPI/DylibReader.h
index 6861d3cb1591b..5e37b06a5be0f 100644
--- a/llvm/include/llvm/TextAPI/DylibReader.h
+++ b/llvm/include/llvm/TextAPI/DylibReader.h
@@ -13,6 +13,7 @@
#ifndef LLVM_TEXTAPI_DYLIBREADER_H
#define LLVM_TEXTAPI_DYLIBREADER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -37,19 +38,19 @@ struct ParseOption {
/// \param Buffer Data that points to dylib.
/// \param Options Determines which attributes to extract.
/// \return List of record slices.
-Expected<Records> readFile(MemoryBufferRef Buffer, const ParseOption &Opt);
+LLVM_ABI Expected<Records> readFile(MemoryBufferRef Buffer, const ParseOption &Opt);
/// Get TAPI file representation of binary dylib.
///
/// \param Buffer Data that points to dylib.
-Expected<std::unique_ptr<InterfaceFile>> get(MemoryBufferRef Buffer);
+LLVM_ABI Expected<std::unique_ptr<InterfaceFile>> get(MemoryBufferRef Buffer);
using SymbolToSourceLocMap = llvm::StringMap<RecordLoc>;
/// Get the source location for each symbol from dylib.
///
/// \param DSYM Path to DSYM file.
/// \param T Requested target slice for dylib.
-SymbolToSourceLocMap accumulateSourceLocFromDSYM(const StringRef DSYM,
+LLVM_ABI SymbolToSourceLocMap accumulateSourceLocFromDSYM(const StringRef DSYM,
const Target &T);
} // namespace llvm::MachO::DylibReader
diff --git a/llvm/include/llvm/TextAPI/InterfaceFile.h b/llvm/include/llvm/TextAPI/InterfaceFile.h
index 23c27cb0f4745..94268236b6646 100644
--- a/llvm/include/llvm/TextAPI/InterfaceFile.h
+++ b/llvm/include/llvm/TextAPI/InterfaceFile.h
@@ -14,6 +14,7 @@
#ifndef LLVM_TEXTAPI_INTERFACEFILE_H
#define LLVM_TEXTAPI_INTERFACEFILE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
@@ -60,7 +61,7 @@ class InterfaceFileRef {
StringRef getInstallName() const { return InstallName; };
- void addTarget(const Target &Target);
+ LLVM_ABI void addTarget(const Target &Target);
template <typename RangeT> void addTargets(RangeT &&Targets) {
for (const auto &Target : Targets)
addTarget(Target(Target));
@@ -146,7 +147,7 @@ class InterfaceFile {
/// Set and add target.
///
/// \param Target the target to add into.
- void addTarget(const Target &Target);
+ LLVM_ABI void addTarget(const Target &Target);
/// Determine if target triple slice exists in file.
///
@@ -174,7 +175,7 @@ class InterfaceFile {
std::function<bool(const Target &)>>;
using const_filtered_target_range =
llvm::iterator_range<const_filtered_target_iterator>;
- const_filtered_target_range targets(ArchitectureSet Archs) const;
+ LLVM_ABI const_filtered_target_range targets(ArchitectureSet Archs) const;
/// Set the install name of the library.
void setInstallName(StringRef InstallName_) {
@@ -241,7 +242,7 @@ class InterfaceFile {
/// Set the parent umbrella frameworks.
/// \param Target_ The target applicable to Parent
/// \param Parent The name of Parent
- void addParentUmbrella(const Target &Target_, StringRef Parent);
+ LLVM_ABI void addParentUmbrella(const Target &Target_, StringRef Parent);
/// Get the list of Parent Umbrella frameworks.
///
@@ -261,7 +262,7 @@ class InterfaceFile {
/// \param InstallName The name of the client that is allowed to link this
/// library.
/// \param Target The target triple for which this applies.
- void addAllowableClient(StringRef InstallName, const Target &Target);
+ LLVM_ABI void addAllowableClient(StringRef InstallName, const Target &Target);
/// Get the list of allowable clients.
///
@@ -274,7 +275,7 @@ class InterfaceFile {
///
/// \param InstallName The name of the library to re-export.
/// \param Target The target triple for which this applies.
- void addReexportedLibrary(StringRef InstallName, const Target &Target);
+ LLVM_ABI void addReexportedLibrary(StringRef InstallName, const Target &Target);
/// Get the list of re-exported libraries.
///
@@ -286,7 +287,7 @@ class InterfaceFile {
/// Add a library for inlining to top level library.
///
///\param Document The library to inline with top level library.
- void addDocument(std::shared_ptr<InterfaceFile> &&Document);
+ LLVM_ABI void addDocument(std::shared_ptr<InterfaceFile> &&Document);
/// Returns the pointer to parent document if exists or nullptr otherwise.
InterfaceFile *getParent() const { return Parent; }
@@ -301,7 +302,7 @@ class InterfaceFile {
/// Set the runpath search paths.
/// \param RPath The name of runpath.
/// \param InputTarget The target applicable to runpath search path.
- void addRPath(StringRef RPath, const Target &InputTarget);
+ LLVM_ABI void addRPath(StringRef RPath, const Target &InputTarget);
/// Get the list of runpath search paths.
///
@@ -373,14 +374,14 @@ class InterfaceFile {
///
/// \param Arch architecture to extract from.
/// \return New InterfaceFile with extracted architecture slice.
- llvm::Expected<std::unique_ptr<InterfaceFile>>
+ LLVM_ABI llvm::Expected<std::unique_ptr<InterfaceFile>>
extract(Architecture Arch) const;
/// Remove architecture slice from Interface.
///
/// \param Arch architecture to remove.
/// \return New Interface File with removed architecture slice.
- llvm::Expected<std::unique_ptr<InterfaceFile>>
+ LLVM_ABI llvm::Expected<std::unique_ptr<InterfaceFile>>
remove(Architecture Arch) const;
/// Merge Interfaces for the same library. The following library attributes
@@ -390,14 +391,14 @@ class InterfaceFile {
///
/// \param O The Interface to merge.
/// \return New Interface File that was merged.
- llvm::Expected<std::unique_ptr<InterfaceFile>>
+ LLVM_ABI llvm::Expected<std::unique_ptr<InterfaceFile>>
merge(const InterfaceFile *O) const;
/// Inline reexported library into Interface.
///
/// \param Library Interface of reexported library.
/// \param Overwrite Whether to overwrite preexisting inlined library.
- void inlineLibrary(std::shared_ptr<InterfaceFile> Library,
+ LLVM_ABI void inlineLibrary(std::shared_ptr<InterfaceFile> Library,
bool Overwrite = false);
/// Set InterfaceFile properties from pre-gathered binary attributes,
@@ -405,14 +406,14 @@ class InterfaceFile {
///
/// \param BA Attributes typically represented in load commands.
/// \param Targ MachO Target slice to add attributes to.
- void setFromBinaryAttrs(const RecordsSlice::BinaryAttrs &BA,
+ LLVM_ABI void setFromBinaryAttrs(const RecordsSlice::BinaryAttrs &BA,
const Target &Targ);
/// The equality is determined by attributes that impact linking
/// compatibilities. Path, & FileKind are irrelevant since these by
/// itself should not impact linking.
/// This is an expensive operation.
- bool operator==(const InterfaceFile &O) const;
+ LLVM_ABI bool operator==(const InterfaceFile &O) const;
bool operator!=(const InterfaceFile &O) const { return !(*this == O); }
diff --git a/llvm/include/llvm/TextAPI/PackedVersion.h b/llvm/include/llvm/TextAPI/PackedVersion.h
index e680d40c71044..cabe365e6d97a 100644
--- a/llvm/include/llvm/TextAPI/PackedVersion.h
+++ b/llvm/include/llvm/TextAPI/PackedVersion.h
@@ -13,6 +13,7 @@
#ifndef LLVM_TEXTAPI_PACKEDVERSION_H
#define LLVM_TEXTAPI_PACKEDVERSION_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/VersionTuple.h"
#include <cstdint>
#include <string>
@@ -53,8 +54,8 @@ class PackedVersion {
/// Retrieve the subminor version number, if provided.
unsigned getSubminor() const { return Version & 0xff; }
- bool parse32(StringRef Str);
- std::pair<bool, bool> parse64(StringRef Str);
+ LLVM_ABI bool parse32(StringRef Str);
+ LLVM_ABI std::pair<bool, bool> parse64(StringRef Str);
bool operator<(const PackedVersion &O) const { return Version < O.Version; }
@@ -64,9 +65,9 @@ class PackedVersion {
uint32_t rawValue() const { return Version; }
- operator std::string() const;
+ LLVM_ABI operator std::string() const;
- void print(raw_ostream &OS) const;
+ LLVM_ABI void print(raw_ostream &OS) const;
};
inline raw_ostream &operator<<(raw_ostream &OS, const PackedVersion &Version) {
diff --git a/llvm/include/llvm/TextAPI/Platform.h b/llvm/include/llvm/TextAPI/Platform.h
index d828d9ac49f65..b2a00cba49986 100644
--- a/llvm/include/llvm/TextAPI/Platform.h
+++ b/llvm/include/llvm/TextAPI/Platform.h
@@ -12,6 +12,7 @@
#ifndef LLVM_TEXTAPI_PLATFORM_H
#define LLVM_TEXTAPI_PLATFORM_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Support/VersionTuple.h"
@@ -22,14 +23,14 @@ namespace MachO {
using PlatformSet = SmallSet<PlatformType, 3>;
using PlatformVersionSet = SmallSet<std::pair<PlatformType, VersionTuple>, 3>;
-PlatformType mapToPlatformType(PlatformType Platform, bool WantSim);
-PlatformType mapToPlatformType(const Triple &Target);
-PlatformSet mapToPlatformSet(ArrayRef<Triple> Targets);
-StringRef getPlatformName(PlatformType Platform);
-PlatformType getPlatformFromName(StringRef Name);
-std::string getOSAndEnvironmentName(PlatformType Platform,
+LLVM_ABI PlatformType mapToPlatformType(PlatformType Platform, bool WantSim);
+LLVM_ABI PlatformType mapToPlatformType(const Triple &Target);
+LLVM_ABI PlatformSet mapToPlatformSet(ArrayRef<Triple> Targets);
+LLVM_ABI StringRef getPlatformName(PlatformType Platform);
+LLVM_ABI PlatformType getPlatformFromName(StringRef Name);
+LLVM_ABI std::string getOSAndEnvironmentName(PlatformType Platform,
std::string Version = "");
-VersionTuple mapToSupportedOSVersion(const Triple &Triple);
+LLVM_ABI VersionTuple mapToSupportedOSVersion(const Triple &Triple);
} // end namespace MachO.
} // end namespace llvm.
diff --git a/llvm/include/llvm/TextAPI/Record.h b/llvm/include/llvm/TextAPI/Record.h
index 7d721988ec3da..0bd54a1dc1bd7 100644
--- a/llvm/include/llvm/TextAPI/Record.h
+++ b/llvm/include/llvm/TextAPI/Record.h
@@ -14,6 +14,7 @@
#ifndef LLVM_TEXTAPI_RECORD_H
#define LLVM_TEXTAPI_RECORD_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
@@ -104,7 +105,7 @@ class Record {
SymbolFlags getFlags() const { return Flags; }
private:
- SymbolFlags mergeFlags(SymbolFlags Flags, RecordLinkage Linkage);
+ LLVM_ABI SymbolFlags mergeFlags(SymbolFlags Flags, RecordLinkage Linkage);
protected:
StringRef Name;
@@ -164,9 +165,9 @@ class ObjCContainerRecord : public Record {
ObjCContainerRecord(StringRef Name, RecordLinkage Linkage)
: Record({Name, Linkage, SymbolFlags::Data}) {}
- ObjCIVarRecord *addObjCIVar(StringRef IVar, RecordLinkage Linkage);
- ObjCIVarRecord *findObjCIVar(StringRef IVar) const;
- std::vector<ObjCIVarRecord *> getObjCIVars() const;
+ LLVM_ABI ObjCIVarRecord *addObjCIVar(StringRef IVar, RecordLinkage Linkage);
+ LLVM_ABI ObjCIVarRecord *findObjCIVar(StringRef IVar) const;
+ LLVM_ABI std::vector<ObjCIVarRecord *> getObjCIVars() const;
RecordLinkage getLinkage() const { return Linkage; }
private:
@@ -207,11 +208,11 @@ class ObjCInterfaceRecord : public ObjCContainerRecord {
return getLinkageForSymbol(CurrType) >= RecordLinkage::Rexported;
}
- RecordLinkage getLinkageForSymbol(ObjCIFSymbolKind CurrType) const;
- void updateLinkageForSymbols(ObjCIFSymbolKind SymType, RecordLinkage Link);
+ LLVM_ABI RecordLinkage getLinkageForSymbol(ObjCIFSymbolKind CurrType) const;
+ LLVM_ABI void updateLinkageForSymbols(ObjCIFSymbolKind SymType, RecordLinkage Link);
- bool addObjCCategory(ObjCCategoryRecord *Record);
- std::vector<ObjCCategoryRecord *> getObjCCategories() const;
+ LLVM_ABI bool addObjCCategory(ObjCCategoryRecord *Record);
+ LLVM_ABI std::vector<ObjCCategoryRecord *> getObjCCategories() const;
private:
/// Linkage level for each symbol represented in ObjCInterfaceRecord.
diff --git a/llvm/include/llvm/TextAPI/RecordVisitor.h b/llvm/include/llvm/TextAPI/RecordVisitor.h
index 34e43f5b0027f..65bc96df244d7 100644
--- a/llvm/include/llvm/TextAPI/RecordVisitor.h
+++ b/llvm/include/llvm/TextAPI/RecordVisitor.h
@@ -13,6 +13,7 @@
#ifndef LLVM_TEXTAPI_RECORDVISITOR_H
#define LLVM_TEXTAPI_RECORDVISITOR_H
+#include "llvm/Support/Compiler.h"
#include "llvm/TextAPI/Record.h"
#include "llvm/TextAPI/SymbolSet.h"
@@ -20,7 +21,7 @@ namespace llvm {
namespace MachO {
/// Base class for any usage of traversing over collected Records.
-class RecordVisitor {
+class LLVM_ABI RecordVisitor {
public:
virtual ~RecordVisitor();
@@ -32,7 +33,7 @@ class RecordVisitor {
/// Specialized RecordVisitor for collecting exported symbols
/// and undefined symbols if RecordSlice being visited represents a
/// flat-namespaced library.
-class SymbolConverter : public RecordVisitor {
+class LLVM_ABI SymbolConverter : public RecordVisitor {
public:
SymbolConverter(SymbolSet *Symbols, const Target &T,
const bool RecordUndefs = false)
diff --git a/llvm/include/llvm/TextAPI/RecordsSlice.h b/llvm/include/llvm/TextAPI/RecordsSlice.h
index f934cf7607f1f..0f4d604f03f74 100644
--- a/llvm/include/llvm/TextAPI/RecordsSlice.h
+++ b/llvm/include/llvm/TextAPI/RecordsSlice.h
@@ -14,6 +14,7 @@
#ifndef LLVM_TEXTAPI_RECORDSLICE_H
#define LLVM_TEXTAPI_RECORDSLICE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Allocator.h"
#include "llvm/TextAPI/FileTypes.h"
#include "llvm/TextAPI/PackedVersion.h"
@@ -43,7 +44,7 @@ class RecordsSlice {
/// symbol.
/// \param Linkage The linkage of symbol.
/// \return The non-owning pointer to added record in slice.
- Record *addRecord(StringRef Name, SymbolFlags Flags,
+ LLVM_ABI Record *addRecord(StringRef Name, SymbolFlags Flags,
GlobalRecord::Kind GV = GlobalRecord::Kind::Unknown,
RecordLinkage Linkage = RecordLinkage::Unknown);
@@ -56,7 +57,7 @@ class RecordsSlice {
/// \param Inlined Whether declaration is inlined, only applicable to
/// functions.
/// \return The non-owning pointer to added record in slice.
- GlobalRecord *addGlobal(StringRef Name, RecordLinkage Linkage,
+ LLVM_ABI GlobalRecord *addGlobal(StringRef Name, RecordLinkage Linkage,
GlobalRecord::Kind GV,
SymbolFlags Flags = SymbolFlags::None,
bool Inlined = false);
@@ -67,7 +68,7 @@ class RecordsSlice {
/// \param Linkage The linkage of symbol.
/// \param SymType The symbols this class represents.
/// \return The non-owning pointer to added record in slice.
- ObjCInterfaceRecord *addObjCInterface(StringRef Name, RecordLinkage Linkage,
+ LLVM_ABI ObjCInterfaceRecord *addObjCInterface(StringRef Name, RecordLinkage Linkage,
ObjCIFSymbolKind SymType);
/// Add ObjC IVar record.
@@ -76,7 +77,7 @@ class RecordsSlice {
/// \param Name The name of ivar, not symbol.
/// \param Linkage The linkage of symbol.
/// \return The non-owning pointer to added record in slice.
- ObjCIVarRecord *addObjCIVar(ObjCContainerRecord *Container, StringRef Name,
+ LLVM_ABI ObjCIVarRecord *addObjCIVar(ObjCContainerRecord *Container, StringRef Name,
RecordLinkage Linkage);
/// Add ObjC Category record.
@@ -85,21 +86,21 @@ class RecordsSlice {
/// category, not symbol.
/// \param Category The name of category.
/// \return The non-owning pointer to added record in slice.
- ObjCCategoryRecord *addObjCCategory(StringRef ClassToExtend,
+ LLVM_ABI ObjCCategoryRecord *addObjCCategory(StringRef ClassToExtend,
StringRef Category);
/// Find ObjC Class.
///
/// \param Name name of class, not full symbol name.
/// \return The non-owning pointer to record in slice.
- ObjCInterfaceRecord *findObjCInterface(StringRef Name) const;
+ LLVM_ABI ObjCInterfaceRecord *findObjCInterface(StringRef Name) const;
/// Find ObjC Category.
///
/// \param ClassToExtend The name of class, not full symbol name.
/// \param Category The name of category.
/// \return The non-owning pointer to record in slice.
- ObjCCategoryRecord *findObjCCategory(StringRef ClassToExtend,
+ LLVM_ABI ObjCCategoryRecord *findObjCCategory(StringRef ClassToExtend,
StringRef Category) const;
/// Find ObjC Container. This is commonly used for assigning for looking up
@@ -110,21 +111,21 @@ class RecordsSlice {
/// \param Name Either the name of ivar or name of container.
/// \return The non-owning pointer to record in
/// slice.
- ObjCContainerRecord *findContainer(bool IsIVar, StringRef Name) const;
+ LLVM_ABI ObjCContainerRecord *findContainer(bool IsIVar, StringRef Name) const;
/// Find ObjC instance variable.
///
/// \param IsScopedName This is used to determine how to parse the name.
/// \param Name Either the full name of the symbol or just the ivar.
/// \return The non-owning pointer to record in slice.
- ObjCIVarRecord *findObjCIVar(bool IsScopedName, StringRef Name) const;
+ LLVM_ABI ObjCIVarRecord *findObjCIVar(bool IsScopedName, StringRef Name) const;
/// Find non-objc global.
///
/// \param Name The name of symbol.
/// \param GV The Kind of global to find.
/// \return The non-owning pointer to record in slice.
- GlobalRecord *
+ LLVM_ABI GlobalRecord *
findGlobal(StringRef Name,
GlobalRecord::Kind GV = GlobalRecord::Kind::Unknown) const;
@@ -138,7 +139,7 @@ class RecordsSlice {
}
// Visit all records known to RecordsSlice.
- void visit(RecordVisitor &V) const;
+ LLVM_ABI void visit(RecordVisitor &V) const;
struct BinaryAttrs {
std::vector<StringRef> AllowableClients;
@@ -158,11 +159,11 @@ class RecordsSlice {
};
/// Return reference to BinaryAttrs.
- BinaryAttrs &getBinaryAttrs();
+ LLVM_ABI BinaryAttrs &getBinaryAttrs();
/// Store any strings owned by RecordSlice into allocator and return back
/// reference to that.
- StringRef copyString(StringRef String);
+ LLVM_ABI StringRef copyString(StringRef String);
private:
const llvm::Triple TargetTriple;
@@ -196,7 +197,7 @@ class RecordsSlice {
using Records = llvm::SmallVector<std::shared_ptr<RecordsSlice>, 4>;
class InterfaceFile;
-std::unique_ptr<InterfaceFile> convertToInterfaceFile(const Records &Slices);
+LLVM_ABI std::unique_ptr<InterfaceFile> convertToInterfaceFile(const Records &Slices);
} // namespace MachO
} // namespace llvm
diff --git a/llvm/include/llvm/TextAPI/Symbol.h b/llvm/include/llvm/TextAPI/Symbol.h
index 5a5eb0eb48325..ff46d78a0d8d7 100644
--- a/llvm/include/llvm/TextAPI/Symbol.h
+++ b/llvm/include/llvm/TextAPI/Symbol.h
@@ -9,6 +9,7 @@
#ifndef LLVM_TEXTAPI_SYMBOL_H
#define LLVM_TEXTAPI_SYMBOL_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
@@ -152,14 +153,14 @@ class Symbol {
std::function<bool(const Target &)>>;
using const_filtered_target_range =
llvm::iterator_range<const_filtered_target_iterator>;
- const_filtered_target_range targets(ArchitectureSet architectures) const;
+ LLVM_ABI const_filtered_target_range targets(ArchitectureSet architectures) const;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void dump(raw_ostream &OS) const;
void dump() const { dump(llvm::errs()); }
#endif
- bool operator==(const Symbol &O) const;
+ LLVM_ABI bool operator==(const Symbol &O) const;
bool operator!=(const Symbol &O) const { return !(*this == O); }
@@ -189,7 +190,7 @@ struct SimpleSymbol {
/// Get symbol classification by parsing the name of a symbol.
///
/// \param SymName The name of symbol.
-SimpleSymbol parseSymbol(StringRef SymName);
+LLVM_ABI SimpleSymbol parseSymbol(StringRef SymName);
} // end namespace MachO.
} // end namespace llvm.
diff --git a/llvm/include/llvm/TextAPI/SymbolSet.h b/llvm/include/llvm/TextAPI/SymbolSet.h
index 6ccabb9077208..f1bbced4bdd71 100644
--- a/llvm/include/llvm/TextAPI/SymbolSet.h
+++ b/llvm/include/llvm/TextAPI/SymbolSet.h
@@ -9,6 +9,7 @@
#ifndef LLVM_TEXTAPI_SYMBOLSET_H
#define LLVM_TEXTAPI_SYMBOLSET_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringRef.h"
@@ -87,11 +88,11 @@ class SymbolSet {
using SymbolsMapType = llvm::DenseMap<SymbolsMapKey, Symbol *>;
SymbolsMapType Symbols;
- Symbol *addGlobalImpl(EncodeKind, StringRef Name, SymbolFlags Flags);
+ LLVM_ABI Symbol *addGlobalImpl(EncodeKind, StringRef Name, SymbolFlags Flags);
public:
SymbolSet() = default;
- Symbol *addGlobal(EncodeKind Kind, StringRef Name, SymbolFlags Flags,
+ LLVM_ABI Symbol *addGlobal(EncodeKind Kind, StringRef Name, SymbolFlags Flags,
const Target &Targ);
size_t size() const { return Symbols.size(); }
@@ -107,7 +108,7 @@ class SymbolSet {
return Global;
}
- const Symbol *
+ LLVM_ABI const Symbol *
findSymbol(EncodeKind Kind, StringRef Name,
ObjCIFSymbolKind ObjCIF = ObjCIFSymbolKind::None) const;
@@ -169,7 +170,7 @@ class SymbolSet {
fn);
}
- bool operator==(const SymbolSet &O) const;
+ LLVM_ABI bool operator==(const SymbolSet &O) const;
bool operator!=(const SymbolSet &O) const { return !(Symbols == O.Symbols); }
diff --git a/llvm/include/llvm/TextAPI/Target.h b/llvm/include/llvm/TextAPI/Target.h
index edcc0708d1478..5cc507fe21f78 100644
--- a/llvm/include/llvm/TextAPI/Target.h
+++ b/llvm/include/llvm/TextAPI/Target.h
@@ -9,6 +9,7 @@
#ifndef LLVM_TEXTAPI_TARGET_H
#define LLVM_TEXTAPI_TARGET_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/VersionTuple.h"
#include "llvm/TargetParser/Triple.h"
@@ -35,9 +36,9 @@ class Target {
: Arch(mapToArchitecture(Triple)), Platform(mapToPlatformType(Triple)),
MinDeployment(mapToSupportedOSVersion(Triple)) {}
- static llvm::Expected<Target> create(StringRef Target);
+ LLVM_ABI static llvm::Expected<Target> create(StringRef Target);
- operator std::string() const;
+ LLVM_ABI operator std::string() const;
Architecture Arch;
PlatformType Platform;
@@ -66,13 +67,13 @@ inline bool operator!=(const Target &LHS, const Architecture &RHS) {
return LHS.Arch != RHS;
}
-PlatformVersionSet mapToPlatformVersionSet(ArrayRef<Target> Targets);
-PlatformSet mapToPlatformSet(ArrayRef<Target> Targets);
-ArchitectureSet mapToArchitectureSet(ArrayRef<Target> Targets);
+LLVM_ABI PlatformVersionSet mapToPlatformVersionSet(ArrayRef<Target> Targets);
+LLVM_ABI PlatformSet mapToPlatformSet(ArrayRef<Target> Targets);
+LLVM_ABI ArchitectureSet mapToArchitectureSet(ArrayRef<Target> Targets);
-std::string getTargetTripleName(const Target &Targ);
+LLVM_ABI std::string getTargetTripleName(const Target &Targ);
-raw_ostream &operator<<(raw_ostream &OS, const Target &Target);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Target &Target);
} // namespace MachO
} // namespace llvm
diff --git a/llvm/include/llvm/TextAPI/TextAPIError.h b/llvm/include/llvm/TextAPI/TextAPIError.h
index f0578654697b8..7b2182edd6210 100644
--- a/llvm/include/llvm/TextAPI/TextAPIError.h
+++ b/llvm/include/llvm/TextAPI/TextAPIError.h
@@ -14,6 +14,7 @@
#ifndef LLVM_TEXTAPI_TEXTAPIERROR_H
#define LLVM_TEXTAPI_TEXTAPIERROR_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
namespace llvm::MachO {
@@ -25,7 +26,7 @@ enum class TextAPIErrorCode {
UnsupportedTarget
};
-class TextAPIError : public llvm::ErrorInfo<TextAPIError> {
+class LLVM_ABI TextAPIError : public llvm::ErrorInfo<TextAPIError> {
public:
static char ID;
TextAPIErrorCode EC;
diff --git a/llvm/include/llvm/TextAPI/TextAPIReader.h b/llvm/include/llvm/TextAPI/TextAPIReader.h
index 32af0e3601f18..603b24b47283d 100644
--- a/llvm/include/llvm/TextAPI/TextAPIReader.h
+++ b/llvm/include/llvm/TextAPI/TextAPIReader.h
@@ -9,6 +9,7 @@
#ifndef LLVM_TEXTAPI_TEXTAPIREADER_H
#define LLVM_TEXTAPI_TEXTAPIREADER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
namespace llvm {
@@ -29,13 +30,13 @@ class TextAPIReader {
///
/// \param InputBuffer Buffer holding contents of TAPI text file.
/// \return The file format version of TAPI text file.
- static Expected<FileType> canRead(MemoryBufferRef InputBuffer);
+ LLVM_ABI static Expected<FileType> canRead(MemoryBufferRef InputBuffer);
/// Parse and get an InterfaceFile that represents the full
/// library.
///
/// \param InputBuffer Buffer holding contents of TAPI text file.
- static Expected<std::unique_ptr<InterfaceFile>>
+ LLVM_ABI static Expected<std::unique_ptr<InterfaceFile>>
get(MemoryBufferRef InputBuffer);
TextAPIReader() = delete;
diff --git a/llvm/include/llvm/TextAPI/TextAPIWriter.h b/llvm/include/llvm/TextAPI/TextAPIWriter.h
index 7fd32c6fe2a9e..6a22014dfeb0e 100644
--- a/llvm/include/llvm/TextAPI/TextAPIWriter.h
+++ b/llvm/include/llvm/TextAPI/TextAPIWriter.h
@@ -9,6 +9,7 @@
#ifndef LLVM_TEXTAPI_TEXTAPIWRITER_H
#define LLVM_TEXTAPI_TEXTAPIWRITER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/TextAPI/InterfaceFile.h"
@@ -30,7 +31,7 @@ class TextAPIWriter {
/// \param FileKind File format to write text file as. If not specified, it
/// will read from File.
/// \param Compact Whether to limit whitespace in text file.
- static Error writeToStream(raw_ostream &OS, const InterfaceFile &File,
+ LLVM_ABI static Error writeToStream(raw_ostream &OS, const InterfaceFile &File,
const FileType FileKind = FileType::Invalid,
bool Compact = false);
diff --git a/llvm/include/llvm/TextAPI/Utils.h b/llvm/include/llvm/TextAPI/Utils.h
index 00dfd63e14f91..910fbb4b4b351 100644
--- a/llvm/include/llvm/TextAPI/Utils.h
+++ b/llvm/include/llvm/TextAPI/Utils.h
@@ -13,6 +13,7 @@
#ifndef LLVM_TEXTAPI_UTILS_H
#define LLVM_TEXTAPI_UTILS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
@@ -51,21 +52,21 @@ struct SymLink {
///
/// \param Path Location of file.
/// \param Extension File extension to update with.
-void replace_extension(SmallVectorImpl<char> &Path, const Twine &Extension);
+LLVM_ABI void replace_extension(SmallVectorImpl<char> &Path, const Twine &Extension);
/// Determine whether to skip over symlink due to either too many symlink levels
/// or is cyclic.
///
/// \param Path Location to symlink.
/// \param Result Holds whether to skip over Path.
-std::error_code shouldSkipSymLink(const Twine &Path, bool &Result);
+LLVM_ABI std::error_code shouldSkipSymLink(const Twine &Path, bool &Result);
/// Turn absolute symlink into relative.
///
/// \param From The symlink.
/// \param To What the symlink points to.
/// \param RelativePath Path location to update what the symlink points to.
-std::error_code make_relative(StringRef From, StringRef To,
+LLVM_ABI std::error_code make_relative(StringRef From, StringRef To,
SmallVectorImpl<char> &RelativePath);
/// Determine if library is private by parsing file path.
@@ -73,12 +74,12 @@ std::error_code make_relative(StringRef From, StringRef To,
///
/// \param Path File path for library.
/// \param IsSymLink Whether path points to a symlink.
-bool isPrivateLibrary(StringRef Path, bool IsSymLink = false);
+LLVM_ABI bool isPrivateLibrary(StringRef Path, bool IsSymLink = false);
/// Create a regex rule from provided glob string.
/// \param Glob String that represents glob input.
/// \return The equivalent regex rule.
-llvm::Expected<llvm::Regex> createRegexFromGlob(llvm::StringRef Glob);
+LLVM_ABI llvm::Expected<llvm::Regex> createRegexFromGlob(llvm::StringRef Glob);
using AliasEntry = std::pair<std::string, EncodeKind>;
using AliasMap = std::map<AliasEntry, AliasEntry>;
@@ -87,13 +88,13 @@ using AliasMap = std::map<AliasEntry, AliasEntry>;
///
/// \param Buffer Data contents of file for the alias list.
/// \return Lookup table of alias to their base symbol.
-Expected<AliasMap> parseAliasList(std::unique_ptr<llvm::MemoryBuffer> &Buffer);
+LLVM_ABI Expected<AliasMap> parseAliasList(std::unique_ptr<llvm::MemoryBuffer> &Buffer);
/// Pickup active paths for a given platform.
///
/// \param Paths File or search paths to pick up.
/// \param Platform Platform to collect paths for.
-PathSeq getPathsForPlatform(const PathToPlatformSeq &Paths,
+LLVM_ABI PathSeq getPathsForPlatform(const PathToPlatformSeq &Paths,
PlatformType Platform);
} // namespace llvm::MachO
>From 7e376f5cccf8e20b5ce6d52b5a135e0a1476ed52 Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 9 Jun 2025 14:51:05 -0700
Subject: [PATCH 2/2] [llvm] clang-format changes to TextAPI library
---
llvm/include/llvm-c/Error.h | 2 +-
llvm/include/llvm/TargetParser/Triple.h | 25 ++++++++-------
llvm/include/llvm/TextAPI/Architecture.h | 6 ++--
llvm/include/llvm/TextAPI/DylibReader.h | 7 +++--
llvm/include/llvm/TextAPI/InterfaceFile.h | 9 +++---
llvm/include/llvm/TextAPI/Platform.h | 4 +--
llvm/include/llvm/TextAPI/Record.h | 5 +--
llvm/include/llvm/TextAPI/RecordsSlice.h | 37 +++++++++++++----------
llvm/include/llvm/TextAPI/Symbol.h | 5 +--
llvm/include/llvm/TextAPI/SymbolSet.h | 4 +--
llvm/include/llvm/TextAPI/TextAPIWriter.h | 9 +++---
llvm/include/llvm/TextAPI/Utils.h | 12 +++++---
12 files changed, 71 insertions(+), 54 deletions(-)
diff --git a/llvm/include/llvm-c/Error.h b/llvm/include/llvm-c/Error.h
index 31a991fe48418..1a1fdedd44625 100644
--- a/llvm/include/llvm-c/Error.h
+++ b/llvm/include/llvm-c/Error.h
@@ -14,8 +14,8 @@
#ifndef LLVM_C_ERROR_H
#define LLVM_C_ERROR_H
-#include "llvm/Support/Compiler.h"
#include "llvm-c/ExternC.h"
+#include "llvm/Support/Compiler.h"
LLVM_C_EXTERN_C_BEGIN
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index 60b79abed47f7..1e735d4a07968 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -9,8 +9,8 @@
#ifndef LLVM_TARGETPARSER_TRIPLE_H
#define LLVM_TARGETPARSER_TRIPLE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/VersionTuple.h"
// Some system headers or GCC predefined macros conflict with identifiers in
@@ -350,9 +350,10 @@ class Triple {
Triple() = default;
LLVM_ABI explicit Triple(const Twine &Str);
- LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
- LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
- const Twine &EnvironmentStr);
+ LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr,
+ const Twine &OSStr);
+ LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr,
+ const Twine &OSStr, const Twine &EnvironmentStr);
bool operator==(const Triple &Other) const {
return Arch == Other.Arch && SubArch == Other.SubArch &&
@@ -382,8 +383,8 @@ class Triple {
/// reasonably be done). In particular, it handles the common case in which
/// otherwise valid components are in the wrong order. \p Form is used to
/// specify the output canonical form.
- LLVM_ABI static std::string normalize(StringRef Str,
- CanonicalForm Form = CanonicalForm::ANY);
+ LLVM_ABI static std::string
+ normalize(StringRef Str, CanonicalForm Form = CanonicalForm::ANY);
/// Return the normalized form of this triple's string.
std::string normalize(CanonicalForm Form = CanonicalForm::ANY) const {
@@ -546,7 +547,7 @@ class Triple {
/// Comparison function for checking OS X version compatibility, which handles
/// supporting skewed version numbering schemes used by the "darwin" triples.
LLVM_ABI bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
- unsigned Micro = 0) const;
+ unsigned Micro = 0) const;
/// Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
/// and "osx" as OS X triples.
@@ -1241,7 +1242,8 @@ class Triple {
LLVM_ABI static StringRef getArchTypeName(ArchType Kind);
/// Get the architecture name based on \p Kind and \p SubArch.
- LLVM_ABI static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
+ LLVM_ABI static StringRef getArchName(ArchType Kind,
+ SubArchType SubArch = NoSubArch);
/// Get the "prefix" canonical name for the \p Kind architecture. This is the
/// prefix used by the architecture specific builtins, and is suitable for
@@ -1260,7 +1262,8 @@ class Triple {
LLVM_ABI static StringRef getEnvironmentTypeName(EnvironmentType Kind);
/// Get the name for the \p Object format.
- LLVM_ABI static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat);
+ LLVM_ABI static StringRef
+ getObjectFormatTypeName(ObjectFormatType ObjectFormat);
/// @}
/// @name Static helpers for converting alternate architecture names.
@@ -1272,8 +1275,8 @@ class Triple {
/// @}
/// Returns a canonicalized OS version number for the specified OS.
- LLVM_ABI static VersionTuple getCanonicalVersionForOS(OSType OSKind,
- const VersionTuple &Version);
+ LLVM_ABI static VersionTuple
+ getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version);
};
} // End llvm namespace
diff --git a/llvm/include/llvm/TextAPI/Architecture.h b/llvm/include/llvm/TextAPI/Architecture.h
index f9b9659c05ea3..7a7f5416fe7c7 100644
--- a/llvm/include/llvm/TextAPI/Architecture.h
+++ b/llvm/include/llvm/TextAPI/Architecture.h
@@ -33,7 +33,8 @@ enum Architecture : uint8_t {
};
/// Convert a CPU Type and Subtype pair to an architecture slice.
-LLVM_ABI Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType);
+LLVM_ABI Architecture getArchitectureFromCpuType(uint32_t CPUType,
+ uint32_t CPUSubType);
/// Convert a name to an architecture slice.
LLVM_ABI Architecture getArchitectureFromName(StringRef Name);
@@ -42,7 +43,8 @@ LLVM_ABI Architecture getArchitectureFromName(StringRef Name);
LLVM_ABI StringRef getArchitectureName(Architecture Arch);
/// Convert an architecture slice to a CPU Type and Subtype pair.
-LLVM_ABI std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch);
+LLVM_ABI std::pair<uint32_t, uint32_t>
+getCPUTypeFromArchitecture(Architecture Arch);
/// Convert a target to an architecture slice.
LLVM_ABI Architecture mapToArchitecture(const llvm::Triple &Target);
diff --git a/llvm/include/llvm/TextAPI/DylibReader.h b/llvm/include/llvm/TextAPI/DylibReader.h
index 5e37b06a5be0f..f3a806d78df78 100644
--- a/llvm/include/llvm/TextAPI/DylibReader.h
+++ b/llvm/include/llvm/TextAPI/DylibReader.h
@@ -13,8 +13,8 @@
#ifndef LLVM_TEXTAPI_DYLIBREADER_H
#define LLVM_TEXTAPI_DYLIBREADER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/TextAPI/ArchitectureSet.h"
@@ -38,7 +38,8 @@ struct ParseOption {
/// \param Buffer Data that points to dylib.
/// \param Options Determines which attributes to extract.
/// \return List of record slices.
-LLVM_ABI Expected<Records> readFile(MemoryBufferRef Buffer, const ParseOption &Opt);
+LLVM_ABI Expected<Records> readFile(MemoryBufferRef Buffer,
+ const ParseOption &Opt);
/// Get TAPI file representation of binary dylib.
///
@@ -51,7 +52,7 @@ using SymbolToSourceLocMap = llvm::StringMap<RecordLoc>;
/// \param DSYM Path to DSYM file.
/// \param T Requested target slice for dylib.
LLVM_ABI SymbolToSourceLocMap accumulateSourceLocFromDSYM(const StringRef DSYM,
- const Target &T);
+ const Target &T);
} // namespace llvm::MachO::DylibReader
diff --git a/llvm/include/llvm/TextAPI/InterfaceFile.h b/llvm/include/llvm/TextAPI/InterfaceFile.h
index 94268236b6646..747c8d0a208c5 100644
--- a/llvm/include/llvm/TextAPI/InterfaceFile.h
+++ b/llvm/include/llvm/TextAPI/InterfaceFile.h
@@ -14,11 +14,11 @@
#ifndef LLVM_TEXTAPI_INTERFACEFILE_H
#define LLVM_TEXTAPI_INTERFACEFILE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/TextAPI/ArchitectureSet.h"
#include "llvm/TextAPI/FileTypes.h"
#include "llvm/TextAPI/PackedVersion.h"
@@ -275,7 +275,8 @@ class InterfaceFile {
///
/// \param InstallName The name of the library to re-export.
/// \param Target The target triple for which this applies.
- LLVM_ABI void addReexportedLibrary(StringRef InstallName, const Target &Target);
+ LLVM_ABI void addReexportedLibrary(StringRef InstallName,
+ const Target &Target);
/// Get the list of re-exported libraries.
///
@@ -399,7 +400,7 @@ class InterfaceFile {
/// \param Library Interface of reexported library.
/// \param Overwrite Whether to overwrite preexisting inlined library.
LLVM_ABI void inlineLibrary(std::shared_ptr<InterfaceFile> Library,
- bool Overwrite = false);
+ bool Overwrite = false);
/// Set InterfaceFile properties from pre-gathered binary attributes,
/// if they are not set already.
@@ -407,7 +408,7 @@ class InterfaceFile {
/// \param BA Attributes typically represented in load commands.
/// \param Targ MachO Target slice to add attributes to.
LLVM_ABI void setFromBinaryAttrs(const RecordsSlice::BinaryAttrs &BA,
- const Target &Targ);
+ const Target &Targ);
/// The equality is determined by attributes that impact linking
/// compatibilities. Path, & FileKind are irrelevant since these by
diff --git a/llvm/include/llvm/TextAPI/Platform.h b/llvm/include/llvm/TextAPI/Platform.h
index b2a00cba49986..8ea187acc02f9 100644
--- a/llvm/include/llvm/TextAPI/Platform.h
+++ b/llvm/include/llvm/TextAPI/Platform.h
@@ -12,9 +12,9 @@
#ifndef LLVM_TEXTAPI_PLATFORM_H
#define LLVM_TEXTAPI_PLATFORM_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/BinaryFormat/MachO.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/VersionTuple.h"
namespace llvm {
@@ -29,7 +29,7 @@ LLVM_ABI PlatformSet mapToPlatformSet(ArrayRef<Triple> Targets);
LLVM_ABI StringRef getPlatformName(PlatformType Platform);
LLVM_ABI PlatformType getPlatformFromName(StringRef Name);
LLVM_ABI std::string getOSAndEnvironmentName(PlatformType Platform,
- std::string Version = "");
+ std::string Version = "");
LLVM_ABI VersionTuple mapToSupportedOSVersion(const Triple &Triple);
} // end namespace MachO.
diff --git a/llvm/include/llvm/TextAPI/Record.h b/llvm/include/llvm/TextAPI/Record.h
index 0bd54a1dc1bd7..6e470d97325fd 100644
--- a/llvm/include/llvm/TextAPI/Record.h
+++ b/llvm/include/llvm/TextAPI/Record.h
@@ -14,10 +14,10 @@
#ifndef LLVM_TEXTAPI_RECORD_H
#define LLVM_TEXTAPI_RECORD_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/TextAPI/Symbol.h"
#include <string>
@@ -209,7 +209,8 @@ class ObjCInterfaceRecord : public ObjCContainerRecord {
}
LLVM_ABI RecordLinkage getLinkageForSymbol(ObjCIFSymbolKind CurrType) const;
- LLVM_ABI void updateLinkageForSymbols(ObjCIFSymbolKind SymType, RecordLinkage Link);
+ LLVM_ABI void updateLinkageForSymbols(ObjCIFSymbolKind SymType,
+ RecordLinkage Link);
LLVM_ABI bool addObjCCategory(ObjCCategoryRecord *Record);
LLVM_ABI std::vector<ObjCCategoryRecord *> getObjCCategories() const;
diff --git a/llvm/include/llvm/TextAPI/RecordsSlice.h b/llvm/include/llvm/TextAPI/RecordsSlice.h
index 0f4d604f03f74..6ecb79a115aea 100644
--- a/llvm/include/llvm/TextAPI/RecordsSlice.h
+++ b/llvm/include/llvm/TextAPI/RecordsSlice.h
@@ -14,8 +14,8 @@
#ifndef LLVM_TEXTAPI_RECORDSLICE_H
#define LLVM_TEXTAPI_RECORDSLICE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/TextAPI/FileTypes.h"
#include "llvm/TextAPI/PackedVersion.h"
#include "llvm/TextAPI/Record.h"
@@ -44,9 +44,10 @@ class RecordsSlice {
/// symbol.
/// \param Linkage The linkage of symbol.
/// \return The non-owning pointer to added record in slice.
- LLVM_ABI Record *addRecord(StringRef Name, SymbolFlags Flags,
- GlobalRecord::Kind GV = GlobalRecord::Kind::Unknown,
- RecordLinkage Linkage = RecordLinkage::Unknown);
+ LLVM_ABI Record *
+ addRecord(StringRef Name, SymbolFlags Flags,
+ GlobalRecord::Kind GV = GlobalRecord::Kind::Unknown,
+ RecordLinkage Linkage = RecordLinkage::Unknown);
/// Add non-ObjC global record.
///
@@ -58,9 +59,9 @@ class RecordsSlice {
/// functions.
/// \return The non-owning pointer to added record in slice.
LLVM_ABI GlobalRecord *addGlobal(StringRef Name, RecordLinkage Linkage,
- GlobalRecord::Kind GV,
- SymbolFlags Flags = SymbolFlags::None,
- bool Inlined = false);
+ GlobalRecord::Kind GV,
+ SymbolFlags Flags = SymbolFlags::None,
+ bool Inlined = false);
/// Add ObjC Class record.
///
@@ -68,8 +69,9 @@ class RecordsSlice {
/// \param Linkage The linkage of symbol.
/// \param SymType The symbols this class represents.
/// \return The non-owning pointer to added record in slice.
- LLVM_ABI ObjCInterfaceRecord *addObjCInterface(StringRef Name, RecordLinkage Linkage,
- ObjCIFSymbolKind SymType);
+ LLVM_ABI ObjCInterfaceRecord *addObjCInterface(StringRef Name,
+ RecordLinkage Linkage,
+ ObjCIFSymbolKind SymType);
/// Add ObjC IVar record.
///
@@ -77,8 +79,8 @@ class RecordsSlice {
/// \param Name The name of ivar, not symbol.
/// \param Linkage The linkage of symbol.
/// \return The non-owning pointer to added record in slice.
- LLVM_ABI ObjCIVarRecord *addObjCIVar(ObjCContainerRecord *Container, StringRef Name,
- RecordLinkage Linkage);
+ LLVM_ABI ObjCIVarRecord *addObjCIVar(ObjCContainerRecord *Container,
+ StringRef Name, RecordLinkage Linkage);
/// Add ObjC Category record.
///
@@ -87,7 +89,7 @@ class RecordsSlice {
/// \param Category The name of category.
/// \return The non-owning pointer to added record in slice.
LLVM_ABI ObjCCategoryRecord *addObjCCategory(StringRef ClassToExtend,
- StringRef Category);
+ StringRef Category);
/// Find ObjC Class.
///
@@ -101,7 +103,7 @@ class RecordsSlice {
/// \param Category The name of category.
/// \return The non-owning pointer to record in slice.
LLVM_ABI ObjCCategoryRecord *findObjCCategory(StringRef ClassToExtend,
- StringRef Category) const;
+ StringRef Category) const;
/// Find ObjC Container. This is commonly used for assigning for looking up
/// instance variables that are assigned to either a category or class.
@@ -111,14 +113,16 @@ class RecordsSlice {
/// \param Name Either the name of ivar or name of container.
/// \return The non-owning pointer to record in
/// slice.
- LLVM_ABI ObjCContainerRecord *findContainer(bool IsIVar, StringRef Name) const;
+ LLVM_ABI ObjCContainerRecord *findContainer(bool IsIVar,
+ StringRef Name) const;
/// Find ObjC instance variable.
///
/// \param IsScopedName This is used to determine how to parse the name.
/// \param Name Either the full name of the symbol or just the ivar.
/// \return The non-owning pointer to record in slice.
- LLVM_ABI ObjCIVarRecord *findObjCIVar(bool IsScopedName, StringRef Name) const;
+ LLVM_ABI ObjCIVarRecord *findObjCIVar(bool IsScopedName,
+ StringRef Name) const;
/// Find non-objc global.
///
@@ -197,7 +201,8 @@ class RecordsSlice {
using Records = llvm::SmallVector<std::shared_ptr<RecordsSlice>, 4>;
class InterfaceFile;
-LLVM_ABI std::unique_ptr<InterfaceFile> convertToInterfaceFile(const Records &Slices);
+LLVM_ABI std::unique_ptr<InterfaceFile>
+convertToInterfaceFile(const Records &Slices);
} // namespace MachO
} // namespace llvm
diff --git a/llvm/include/llvm/TextAPI/Symbol.h b/llvm/include/llvm/TextAPI/Symbol.h
index ff46d78a0d8d7..92ff0746f7995 100644
--- a/llvm/include/llvm/TextAPI/Symbol.h
+++ b/llvm/include/llvm/TextAPI/Symbol.h
@@ -9,9 +9,9 @@
#ifndef LLVM_TEXTAPI_SYMBOL_H
#define LLVM_TEXTAPI_SYMBOL_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TextAPI/ArchitectureSet.h"
#include "llvm/TextAPI/Target.h"
@@ -153,7 +153,8 @@ class Symbol {
std::function<bool(const Target &)>>;
using const_filtered_target_range =
llvm::iterator_range<const_filtered_target_iterator>;
- LLVM_ABI const_filtered_target_range targets(ArchitectureSet architectures) const;
+ LLVM_ABI const_filtered_target_range
+ targets(ArchitectureSet architectures) const;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void dump(raw_ostream &OS) const;
diff --git a/llvm/include/llvm/TextAPI/SymbolSet.h b/llvm/include/llvm/TextAPI/SymbolSet.h
index f1bbced4bdd71..cd3066317f3ae 100644
--- a/llvm/include/llvm/TextAPI/SymbolSet.h
+++ b/llvm/include/llvm/TextAPI/SymbolSet.h
@@ -9,13 +9,13 @@
#ifndef LLVM_TEXTAPI_SYMBOLSET_H
#define LLVM_TEXTAPI_SYMBOLSET_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/TextAPI/Architecture.h"
#include "llvm/TextAPI/ArchitectureSet.h"
#include "llvm/TextAPI/Symbol.h"
@@ -93,7 +93,7 @@ class SymbolSet {
public:
SymbolSet() = default;
LLVM_ABI Symbol *addGlobal(EncodeKind Kind, StringRef Name, SymbolFlags Flags,
- const Target &Targ);
+ const Target &Targ);
size_t size() const { return Symbols.size(); }
template <typename RangeT, typename ElT = std::remove_reference_t<
diff --git a/llvm/include/llvm/TextAPI/TextAPIWriter.h b/llvm/include/llvm/TextAPI/TextAPIWriter.h
index 6a22014dfeb0e..5f06c372fe852 100644
--- a/llvm/include/llvm/TextAPI/TextAPIWriter.h
+++ b/llvm/include/llvm/TextAPI/TextAPIWriter.h
@@ -9,8 +9,8 @@
#ifndef LLVM_TEXTAPI_TEXTAPIWRITER_H
#define LLVM_TEXTAPI_TEXTAPIWRITER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/TextAPI/InterfaceFile.h"
namespace llvm {
@@ -31,9 +31,10 @@ class TextAPIWriter {
/// \param FileKind File format to write text file as. If not specified, it
/// will read from File.
/// \param Compact Whether to limit whitespace in text file.
- LLVM_ABI static Error writeToStream(raw_ostream &OS, const InterfaceFile &File,
- const FileType FileKind = FileType::Invalid,
- bool Compact = false);
+ LLVM_ABI static Error
+ writeToStream(raw_ostream &OS, const InterfaceFile &File,
+ const FileType FileKind = FileType::Invalid,
+ bool Compact = false);
/// Get TAPI FileType from the input string.
///
diff --git a/llvm/include/llvm/TextAPI/Utils.h b/llvm/include/llvm/TextAPI/Utils.h
index 910fbb4b4b351..27db717f5a63b 100644
--- a/llvm/include/llvm/TextAPI/Utils.h
+++ b/llvm/include/llvm/TextAPI/Utils.h
@@ -13,8 +13,8 @@
#ifndef LLVM_TEXTAPI_UTILS_H
#define LLVM_TEXTAPI_UTILS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -52,7 +52,8 @@ struct SymLink {
///
/// \param Path Location of file.
/// \param Extension File extension to update with.
-LLVM_ABI void replace_extension(SmallVectorImpl<char> &Path, const Twine &Extension);
+LLVM_ABI void replace_extension(SmallVectorImpl<char> &Path,
+ const Twine &Extension);
/// Determine whether to skip over symlink due to either too many symlink levels
/// or is cyclic.
@@ -67,7 +68,7 @@ LLVM_ABI std::error_code shouldSkipSymLink(const Twine &Path, bool &Result);
/// \param To What the symlink points to.
/// \param RelativePath Path location to update what the symlink points to.
LLVM_ABI std::error_code make_relative(StringRef From, StringRef To,
- SmallVectorImpl<char> &RelativePath);
+ SmallVectorImpl<char> &RelativePath);
/// Determine if library is private by parsing file path.
/// It does not touch the file system.
@@ -88,14 +89,15 @@ using AliasMap = std::map<AliasEntry, AliasEntry>;
///
/// \param Buffer Data contents of file for the alias list.
/// \return Lookup table of alias to their base symbol.
-LLVM_ABI Expected<AliasMap> parseAliasList(std::unique_ptr<llvm::MemoryBuffer> &Buffer);
+LLVM_ABI Expected<AliasMap>
+parseAliasList(std::unique_ptr<llvm::MemoryBuffer> &Buffer);
/// Pickup active paths for a given platform.
///
/// \param Paths File or search paths to pick up.
/// \param Platform Platform to collect paths for.
LLVM_ABI PathSeq getPathsForPlatform(const PathToPlatformSeq &Paths,
- PlatformType Platform);
+ PlatformType Platform);
} // namespace llvm::MachO
#endif // LLVM_TEXTAPI_UTILS_H
More information about the llvm-commits
mailing list