From e48e1b6b88d75380b78301be891f9f6856e8571d Mon Sep 17 00:00:00 2001 From: Andrew Rogers Date: Mon, 9 Jun 2025 14:50:06 -0700 Subject: [PATCH 1/2] [llvm] IDS auto codemod for TextAPI library --- 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 ++++++----- 16 files changed, 106 insertions(+), 90 deletions(-) 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 #include @@ -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 getCPUTypeFromArchitecture(Architecture Arch); +LLVM_ABI std::pair 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 #include @@ -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 &Archs); + LLVM_ABI ArchitectureSet(const std::vector &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() const; - void print(raw_ostream &OS) const; + LLVM_ABI operator std::string() const; + LLVM_ABI operator std::vector() 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 readFile(MemoryBufferRef Buffer, const ParseOption &Opt); +LLVM_ABI Expected readFile(MemoryBufferRef Buffer, const ParseOption &Opt); /// Get TAPI file representation of binary dylib. /// /// \param Buffer Data that points to dylib. -Expected> get(MemoryBufferRef Buffer); +LLVM_ABI Expected> get(MemoryBufferRef Buffer); using SymbolToSourceLocMap = llvm::StringMap; /// 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 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>; using const_filtered_target_range = llvm::iterator_range; - 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 &&Document); + LLVM_ABI void addDocument(std::shared_ptr &&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> + LLVM_ABI llvm::Expected> extract(Architecture Arch) const; /// Remove architecture slice from Interface. /// /// \param Arch architecture to remove. /// \return New Interface File with removed architecture slice. - llvm::Expected> + LLVM_ABI llvm::Expected> 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> + LLVM_ABI llvm::Expected> 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 Library, + LLVM_ABI void inlineLibrary(std::shared_ptr 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 #include @@ -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 parse64(StringRef Str); + LLVM_ABI bool parse32(StringRef Str); + LLVM_ABI std::pair 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; using PlatformVersionSet = SmallSet, 3>; -PlatformType mapToPlatformType(PlatformType Platform, bool WantSim); -PlatformType mapToPlatformType(const Triple &Target); -PlatformSet mapToPlatformSet(ArrayRef 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 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 getObjCIVars() const; + LLVM_ABI ObjCIVarRecord *addObjCIVar(StringRef IVar, RecordLinkage Linkage); + LLVM_ABI ObjCIVarRecord *findObjCIVar(StringRef IVar) const; + LLVM_ABI std::vector 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 getObjCCategories() const; + LLVM_ABI bool addObjCCategory(ObjCCategoryRecord *Record); + LLVM_ABI std::vector 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 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, 4>; class InterfaceFile; -std::unique_ptr convertToInterfaceFile(const Records &Slices); +LLVM_ABI std::unique_ptr 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>; using const_filtered_target_range = llvm::iterator_range; - 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; 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 create(StringRef Target); + LLVM_ABI static llvm::Expected 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 Targets); -PlatformSet mapToPlatformSet(ArrayRef Targets); -ArchitectureSet mapToArchitectureSet(ArrayRef Targets); +LLVM_ABI PlatformVersionSet mapToPlatformVersionSet(ArrayRef Targets); +LLVM_ABI PlatformSet mapToPlatformSet(ArrayRef Targets); +LLVM_ABI ArchitectureSet mapToArchitectureSet(ArrayRef 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 { +class LLVM_ABI TextAPIError : public llvm::ErrorInfo { 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 canRead(MemoryBufferRef InputBuffer); + LLVM_ABI static Expected canRead(MemoryBufferRef InputBuffer); /// Parse and get an InterfaceFile that represents the full /// library. /// /// \param InputBuffer Buffer holding contents of TAPI text file. - static Expected> + LLVM_ABI static Expected> 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 &Path, const Twine &Extension); +LLVM_ABI void replace_extension(SmallVectorImpl &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 &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 createRegexFromGlob(llvm::StringRef Glob); +LLVM_ABI llvm::Expected createRegexFromGlob(llvm::StringRef Glob); using AliasEntry = std::pair; using AliasMap = std::map; @@ -87,13 +88,13 @@ using AliasMap = std::map; /// /// \param Buffer Data contents of file for the alias list. /// \return Lookup table of alias to their base symbol. -Expected parseAliasList(std::unique_ptr &Buffer); +LLVM_ABI Expected parseAliasList(std::unique_ptr &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 339cd0e55259299b3452dfaf3e4ea7adedaba267 Mon Sep 17 00:00:00 2001 From: Andrew Rogers Date: Mon, 9 Jun 2025 14:51:05 -0700 Subject: [PATCH 2/2] [llvm] clang-format changes to TextAPI library --- 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 +++++--- 10 files changed, 56 insertions(+), 42 deletions(-) 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 getCPUTypeFromArchitecture(Architecture Arch); +LLVM_ABI std::pair +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 readFile(MemoryBufferRef Buffer, const ParseOption &Opt); +LLVM_ABI Expected readFile(MemoryBufferRef Buffer, + const ParseOption &Opt); /// Get TAPI file representation of binary dylib. /// @@ -51,7 +52,7 @@ using SymbolToSourceLocMap = llvm::StringMap; /// \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 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 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 @@ -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 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, 4>; class InterfaceFile; -LLVM_ABI std::unique_ptr convertToInterfaceFile(const Records &Slices); +LLVM_ABI std::unique_ptr +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>; using const_filtered_target_range = llvm::iterator_range; - 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 &Path, const Twine &Extension); +LLVM_ABI void replace_extension(SmallVectorImpl &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 &RelativePath); + SmallVectorImpl &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; /// /// \param Buffer Data contents of file for the alias list. /// \return Lookup table of alias to their base symbol. -LLVM_ABI Expected parseAliasList(std::unique_ptr &Buffer); +LLVM_ABI Expected +parseAliasList(std::unique_ptr &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