From 38f4db7adb553b51967ef0d47a5ca1eb869e0eea Mon Sep 17 00:00:00 2001 From: Andrew Rogers Date: Mon, 28 Apr 2025 10:17:36 -0700 Subject: [PATCH 1/3] [llvm] IDS auto-annotation of llvm/Support library interface --- .../llvm/Support/AArch64AttributeParser.h | 3 +- llvm/include/llvm/Support/AMDGPUMetadata.h | 5 +- .../include/llvm/Support/ARMAttributeParser.h | 3 +- .../include/llvm/Support/ARMBuildAttributes.h | 3 +- llvm/include/llvm/Support/ARMWinEH.h | 3 +- llvm/include/llvm/Support/Allocator.h | 2 +- .../llvm/Support/BalancedPartitioning.h | 11 +- llvm/include/llvm/Support/Base64.h | 3 +- llvm/include/llvm/Support/BinaryStreamError.h | 3 +- .../include/llvm/Support/BinaryStreamReader.h | 37 ++-- llvm/include/llvm/Support/BinaryStreamRef.h | 25 +-- .../include/llvm/Support/BinaryStreamWriter.h | 25 +-- llvm/include/llvm/Support/BlockFrequency.h | 13 +- llvm/include/llvm/Support/BranchProbability.h | 13 +- llvm/include/llvm/Support/BuryPointer.h | 3 +- llvm/include/llvm/Support/COM.h | 4 +- llvm/include/llvm/Support/CRC.h | 7 +- .../llvm/Support/CSKYAttributeParser.h | 3 +- llvm/include/llvm/Support/CSKYAttributes.h | 3 +- llvm/include/llvm/Support/CachePruning.h | 5 +- llvm/include/llvm/Support/Caching.h | 3 +- llvm/include/llvm/Support/Chrono.h | 20 +- llvm/include/llvm/Support/CommandLine.h | 113 ++++++----- llvm/include/llvm/Support/Compression.h | 27 +-- llvm/include/llvm/Support/ConvertEBCDIC.h | 5 +- llvm/include/llvm/Support/ConvertUTF.h | 45 +++-- .../llvm/Support/CrashRecoveryContext.h | 31 +-- llvm/include/llvm/Support/DJB.h | 3 +- llvm/include/llvm/Support/DataExtractor.h | 37 ++-- llvm/include/llvm/Support/Debug.h | 6 +- llvm/include/llvm/Support/DebugCounter.h | 17 +- .../llvm/Support/DivisionByConstantInfo.h | 5 +- llvm/include/llvm/Support/DynamicLibrary.h | 17 +- .../llvm/Support/ELFAttrParserCompact.h | 3 +- .../llvm/Support/ELFAttrParserExtended.h | 3 +- llvm/include/llvm/Support/ELFAttributes.h | 5 +- llvm/include/llvm/Support/Errno.h | 5 +- llvm/include/llvm/Support/Error.h | 30 +-- llvm/include/llvm/Support/ErrorHandling.h | 32 +-- .../include/llvm/Support/ExponentialBackoff.h | 3 +- llvm/include/llvm/Support/ExtensibleRTTI.h | 2 +- llvm/include/llvm/Support/FileCollector.h | 7 +- llvm/include/llvm/Support/FileOutputBuffer.h | 3 +- llvm/include/llvm/Support/FileSystem.h | 191 +++++++++--------- llvm/include/llvm/Support/FileUtilities.h | 7 +- llvm/include/llvm/Support/Format.h | 3 +- llvm/include/llvm/Support/FormatVariadic.h | 3 +- .../llvm/Support/FormatVariadicDetails.h | 3 +- llvm/include/llvm/Support/FormattedStream.h | 9 +- llvm/include/llvm/Support/GlobPattern.h | 9 +- llvm/include/llvm/Support/GraphWriter.h | 9 +- .../llvm/Support/HexagonAttributeParser.h | 3 +- llvm/include/llvm/Support/HexagonAttributes.h | 3 +- llvm/include/llvm/Support/InitLLVM.h | 5 +- llvm/include/llvm/Support/InstructionCost.h | 3 +- llvm/include/llvm/Support/JSON.h | 74 +++---- llvm/include/llvm/Support/KnownBits.h | 95 ++++----- llvm/include/llvm/Support/LEB128.h | 5 +- llvm/include/llvm/Support/LineIterator.h | 7 +- llvm/include/llvm/Support/Locale.h | 4 +- llvm/include/llvm/Support/LockFileManager.h | 3 +- llvm/include/llvm/Support/MD5.h | 19 +- .../llvm/Support/MSP430AttributeParser.h | 3 +- llvm/include/llvm/Support/MSP430Attributes.h | 3 +- llvm/include/llvm/Support/ManagedStatic.h | 7 +- llvm/include/llvm/Support/MathExtras.h | 2 +- llvm/include/llvm/Support/MemAlloc.h | 4 +- llvm/include/llvm/Support/Memory.h | 9 +- llvm/include/llvm/Support/MemoryBuffer.h | 15 +- llvm/include/llvm/Support/MemoryBufferRef.h | 3 +- llvm/include/llvm/Support/ModRef.h | 9 +- llvm/include/llvm/Support/Mustache.h | 19 +- llvm/include/llvm/Support/NativeFormatting.h | 21 +- .../llvm/Support/OptimizedStructLayout.h | 3 +- llvm/include/llvm/Support/PGOOptions.h | 9 +- llvm/include/llvm/Support/Parallel.h | 15 +- llvm/include/llvm/Support/Path.h | 93 ++++----- llvm/include/llvm/Support/PluginLoader.h | 7 +- llvm/include/llvm/Support/PrettyStackTrace.h | 20 +- llvm/include/llvm/Support/Process.h | 57 +++--- llvm/include/llvm/Support/Program.h | 29 +-- .../llvm/Support/RISCVAttributeParser.h | 3 +- llvm/include/llvm/Support/RISCVAttributes.h | 3 +- llvm/include/llvm/Support/RISCVISAUtils.h | 3 +- .../llvm/Support/RandomNumberGenerator.h | 4 +- llvm/include/llvm/Support/Recycler.h | 3 +- llvm/include/llvm/Support/Regex.h | 23 ++- llvm/include/llvm/Support/SHA1.h | 13 +- llvm/include/llvm/Support/SHA256.h | 13 +- llvm/include/llvm/Support/SMTAPI.h | 11 +- llvm/include/llvm/Support/ScaledNumber.h | 15 +- llvm/include/llvm/Support/ScopedPrinter.h | 7 +- llvm/include/llvm/Support/Signals.h | 31 +-- llvm/include/llvm/Support/Signposts.h | 11 +- llvm/include/llvm/Support/SipHash.h | 7 +- .../llvm/Support/SmallVectorMemoryBuffer.h | 3 +- llvm/include/llvm/Support/SourceMgr.h | 37 ++-- llvm/include/llvm/Support/SpecialCaseList.h | 27 +-- llvm/include/llvm/Support/StringSaver.h | 9 +- llvm/include/llvm/Support/SuffixTree.h | 3 +- llvm/include/llvm/Support/SuffixTreeNode.h | 21 +- llvm/include/llvm/Support/SystemUtils.h | 2 +- llvm/include/llvm/Support/TarWriter.h | 5 +- llvm/include/llvm/Support/ThreadPool.h | 7 +- llvm/include/llvm/Support/Threading.h | 24 +-- llvm/include/llvm/Support/TimeProfiler.h | 29 +-- llvm/include/llvm/Support/Timer.h | 45 +++-- llvm/include/llvm/Support/ToolOutputFile.h | 9 +- llvm/include/llvm/Support/TypeSize.h | 5 +- llvm/include/llvm/Support/Unicode.h | 15 +- llvm/include/llvm/Support/Valgrind.h | 5 +- llvm/include/llvm/Support/VersionTuple.h | 9 +- llvm/include/llvm/Support/VirtualFileSystem.h | 67 +++--- llvm/include/llvm/Support/WindowsError.h | 5 +- llvm/include/llvm/Support/WithColor.h | 36 ++-- llvm/include/llvm/Support/YAMLParser.h | 49 ++--- llvm/include/llvm/Support/YAMLTraits.h | 79 ++++---- llvm/include/llvm/Support/raw_os_ostream.h | 3 +- llvm/include/llvm/Support/raw_ostream.h | 35 ++-- llvm/include/llvm/Support/raw_socket_stream.h | 13 +- llvm/include/llvm/Support/thread.h | 13 +- llvm/include/llvm/Support/xxhash.h | 9 +- 122 files changed, 1098 insertions(+), 992 deletions(-) diff --git a/llvm/include/llvm/Support/AArch64AttributeParser.h b/llvm/include/llvm/Support/AArch64AttributeParser.h index 823ae180a5c5a..aa82ca13668d5 100644 --- a/llvm/include/llvm/Support/AArch64AttributeParser.h +++ b/llvm/include/llvm/Support/AArch64AttributeParser.h @@ -9,13 +9,14 @@ #ifndef LLVM_SUPPORT_AARCH64ATTRIBUTEPARSER_H #define LLVM_SUPPORT_AARCH64ATTRIBUTEPARSER_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/ELFAttrParserExtended.h" #include "llvm/Support/ELFAttributes.h" namespace llvm { class AArch64AttributeParser : public ELFExtendedAttrParser { - static std::vector &returnTagsNamesMap(); + LLVM_ABI static std::vector &returnTagsNamesMap(); public: AArch64AttributeParser(ScopedPrinter *Sw) diff --git a/llvm/include/llvm/Support/AMDGPUMetadata.h b/llvm/include/llvm/Support/AMDGPUMetadata.h index 76ac7ab74a32e..c80ecb298cadc 100644 --- a/llvm/include/llvm/Support/AMDGPUMetadata.h +++ b/llvm/include/llvm/Support/AMDGPUMetadata.h @@ -15,6 +15,7 @@ #ifndef LLVM_SUPPORT_AMDGPUMETADATA_H #define LLVM_SUPPORT_AMDGPUMETADATA_H +#include "llvm/Support/Compiler.h" #include "llvm/ADT/StringRef.h" #include #include @@ -447,10 +448,10 @@ struct Metadata final { }; /// Converts \p String to \p HSAMetadata. -std::error_code fromString(StringRef String, Metadata &HSAMetadata); +LLVM_ABI std::error_code fromString(StringRef String, Metadata &HSAMetadata); /// Converts \p HSAMetadata to \p String. -std::error_code toString(Metadata HSAMetadata, std::string &String); +LLVM_ABI std::error_code toString(Metadata HSAMetadata, std::string &String); //===----------------------------------------------------------------------===// // HSA metadata for v3 code object. diff --git a/llvm/include/llvm/Support/ARMAttributeParser.h b/llvm/include/llvm/Support/ARMAttributeParser.h index 749f9cd2213d7..638c7d67cfa2a 100644 --- a/llvm/include/llvm/Support/ARMAttributeParser.h +++ b/llvm/include/llvm/Support/ARMAttributeParser.h @@ -9,6 +9,7 @@ #ifndef LLVM_SUPPORT_ARMATTRIBUTEPARSER_H #define LLVM_SUPPORT_ARMATTRIBUTEPARSER_H +#include "llvm/Support/Compiler.h" #include "ARMBuildAttributes.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ELFAttrParserCompact.h" @@ -18,7 +19,7 @@ namespace llvm { class ScopedPrinter; -class ARMAttributeParser : public ELFCompactAttrParser { +class LLVM_ABI ARMAttributeParser : public ELFCompactAttrParser { struct DisplayHandler { ARMBuildAttrs::AttrType attribute; Error (ARMAttributeParser::*routine)(ARMBuildAttrs::AttrType); diff --git a/llvm/include/llvm/Support/ARMBuildAttributes.h b/llvm/include/llvm/Support/ARMBuildAttributes.h index 35f8992ca9329..68acf30e52f3e 100644 --- a/llvm/include/llvm/Support/ARMBuildAttributes.h +++ b/llvm/include/llvm/Support/ARMBuildAttributes.h @@ -18,12 +18,13 @@ #ifndef LLVM_SUPPORT_ARMBUILDATTRIBUTES_H #define LLVM_SUPPORT_ARMBUILDATTRIBUTES_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/ELFAttributes.h" namespace llvm { namespace ARMBuildAttrs { -const TagNameMap &getARMAttributeTags(); +LLVM_ABI const TagNameMap &getARMAttributeTags(); enum SpecialAttr { // This is for the .cpu asm attr. It translates into one or more diff --git a/llvm/include/llvm/Support/ARMWinEH.h b/llvm/include/llvm/Support/ARMWinEH.h index b6710cca95650..2b9da0a93e8f1 100644 --- a/llvm/include/llvm/Support/ARMWinEH.h +++ b/llvm/include/llvm/Support/ARMWinEH.h @@ -9,6 +9,7 @@ #ifndef LLVM_SUPPORT_ARMWINEH_H #define LLVM_SUPPORT_ARMWINEH_H +#include "llvm/Support/Compiler.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/Endian.h" @@ -205,7 +206,7 @@ inline uint16_t StackAdjustment(const RuntimeFunction &RF) { /// SavedRegisterMask - Utility function to calculate the set of saved general /// purpose (r0-r15) and VFP (d0-d31) registers. -std::pair SavedRegisterMask(const RuntimeFunction &RF, +LLVM_ABI std::pair SavedRegisterMask(const RuntimeFunction &RF, bool Prologue = true); /// RuntimeFunctionARM64 - An entry in the table of procedure data (.pdata) diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h index 568f0d34032fa..36561cf5d5a93 100644 --- a/llvm/include/llvm/Support/Allocator.h +++ b/llvm/include/llvm/Support/Allocator.h @@ -36,7 +36,7 @@ namespace detail { // We call out to an external function to actually print the message as the // printing code uses Allocator.h in its implementation. -void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated, +LLVM_ABI void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated, size_t TotalMemory); } // end namespace detail diff --git a/llvm/include/llvm/Support/BalancedPartitioning.h b/llvm/include/llvm/Support/BalancedPartitioning.h index 539d157343fbe..cf72b2afbe881 100644 --- a/llvm/include/llvm/Support/BalancedPartitioning.h +++ b/llvm/include/llvm/Support/BalancedPartitioning.h @@ -39,6 +39,7 @@ #ifndef LLVM_SUPPORT_BALANCED_PARTITIONING_H #define LLVM_SUPPORT_BALANCED_PARTITIONING_H +#include "llvm/Support/Compiler.h" #include "raw_ostream.h" #include "llvm/ADT/ArrayRef.h" @@ -67,7 +68,7 @@ class BPFunctionNode { /// The ID of this node IDT Id; - void dump(raw_ostream &OS) const; + LLVM_ABI void dump(raw_ostream &OS) const; protected: /// The list of utility nodes associated with this node @@ -99,10 +100,10 @@ struct BalancedPartitioningConfig { class BalancedPartitioning { public: - BalancedPartitioning(const BalancedPartitioningConfig &Config); + LLVM_ABI BalancedPartitioning(const BalancedPartitioningConfig &Config); /// Run recursive graph partitioning that optimizes a given objective. - void run(std::vector &Nodes) const; + LLVM_ABI void run(std::vector &Nodes) const; private: struct UtilitySignature; @@ -127,7 +128,7 @@ class BalancedPartitioning { /// Blocking wait for all threads to complete. Unlike ThreadPool, it is /// acceptable for other threads to add more tasks while blocking on this /// call. - void wait(); + LLVM_ABI void wait(); BPThreadPool(ThreadPoolInterface &TheThreadPool) : TheThreadPool(TheThreadPool) {} }; @@ -192,7 +193,7 @@ class BalancedPartitioning { protected: /// Compute the move gain for uniform log-gap cost - static float moveGain(const BPFunctionNode &N, bool FromLeftToRight, + LLVM_ABI static float moveGain(const BPFunctionNode &N, bool FromLeftToRight, const SignaturesT &Signatures); friend class BalancedPartitioningTest_MoveGain_Test; }; diff --git a/llvm/include/llvm/Support/Base64.h b/llvm/include/llvm/Support/Base64.h index 3d96884749b32..997e8c0b7124e 100644 --- a/llvm/include/llvm/Support/Base64.h +++ b/llvm/include/llvm/Support/Base64.h @@ -13,6 +13,7 @@ #ifndef LLVM_SUPPORT_BASE64_H #define LLVM_SUPPORT_BASE64_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" #include #include @@ -54,7 +55,7 @@ template std::string encodeBase64(InputBytes const &Bytes) { return Buffer; } -llvm::Error decodeBase64(llvm::StringRef Input, std::vector &Output); +LLVM_ABI llvm::Error decodeBase64(llvm::StringRef Input, std::vector &Output); } // end namespace llvm diff --git a/llvm/include/llvm/Support/BinaryStreamError.h b/llvm/include/llvm/Support/BinaryStreamError.h index cf6e034ffd2ce..5fae4675f6822 100644 --- a/llvm/include/llvm/Support/BinaryStreamError.h +++ b/llvm/include/llvm/Support/BinaryStreamError.h @@ -9,6 +9,7 @@ #ifndef LLVM_SUPPORT_BINARYSTREAMERROR_H #define LLVM_SUPPORT_BINARYSTREAMERROR_H +#include "llvm/Support/Compiler.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" @@ -24,7 +25,7 @@ enum class stream_error_code { }; /// Base class for errors originating when parsing raw PDB files -class BinaryStreamError : public ErrorInfo { +class LLVM_ABI BinaryStreamError : public ErrorInfo { public: static char ID; explicit BinaryStreamError(stream_error_code C); diff --git a/llvm/include/llvm/Support/BinaryStreamReader.h b/llvm/include/llvm/Support/BinaryStreamReader.h index ca99388c5d03a..0028a601661ff 100644 --- a/llvm/include/llvm/Support/BinaryStreamReader.h +++ b/llvm/include/llvm/Support/BinaryStreamReader.h @@ -9,6 +9,7 @@ #ifndef LLVM_SUPPORT_BINARYSTREAMREADER_H #define LLVM_SUPPORT_BINARYSTREAMREADER_H +#include "llvm/Support/Compiler.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Alignment.h" @@ -29,10 +30,10 @@ namespace llvm { class BinaryStreamReader { public: BinaryStreamReader() = default; - explicit BinaryStreamReader(BinaryStreamRef Ref); - explicit BinaryStreamReader(BinaryStream &Stream); - explicit BinaryStreamReader(ArrayRef Data, llvm::endianness Endian); - explicit BinaryStreamReader(StringRef Data, llvm::endianness Endian); + LLVM_ABI explicit BinaryStreamReader(BinaryStreamRef Ref); + LLVM_ABI explicit BinaryStreamReader(BinaryStream &Stream); + LLVM_ABI explicit BinaryStreamReader(ArrayRef Data, llvm::endianness Endian); + LLVM_ABI explicit BinaryStreamReader(StringRef Data, llvm::endianness Endian); BinaryStreamReader(const BinaryStreamReader &Other) = default; @@ -46,7 +47,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readLongestContiguousChunk(ArrayRef &Buffer); + LLVM_ABI Error readLongestContiguousChunk(ArrayRef &Buffer); /// Read \p Size bytes from the underlying stream at the current offset and /// and set \p Buffer to the resulting data slice. Whether a copy occurs @@ -55,7 +56,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readBytes(ArrayRef &Buffer, uint32_t Size); + LLVM_ABI Error readBytes(ArrayRef &Buffer, uint32_t Size); /// Read an integer of the specified endianness into \p Dest and update the /// stream's offset. The data is always copied from the stream's underlying @@ -91,13 +92,13 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readULEB128(uint64_t &Dest); + LLVM_ABI Error readULEB128(uint64_t &Dest); /// Read a signed LEB128 encoded value. /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readSLEB128(int64_t &Dest); + LLVM_ABI Error readSLEB128(int64_t &Dest); /// Read a null terminated string from \p Dest. Whether a copy occurs depends /// on the implementation of the underlying stream. Updates the stream's @@ -105,14 +106,14 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readCString(StringRef &Dest); + LLVM_ABI Error readCString(StringRef &Dest); /// Similar to readCString, however read a null-terminated UTF16 string /// instead. /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readWideString(ArrayRef &Dest); + LLVM_ABI Error readWideString(ArrayRef &Dest); /// Read a \p Length byte string into \p Dest. Whether a copy occurs depends /// on the implementation of the underlying stream. Updates the stream's @@ -120,7 +121,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readFixedString(StringRef &Dest, uint32_t Length); + LLVM_ABI Error readFixedString(StringRef &Dest, uint32_t Length); /// Read the entire remainder of the underlying stream into \p Ref. This is /// equivalent to calling getUnderlyingStream().slice(Offset). Updates the @@ -128,7 +129,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readStreamRef(BinaryStreamRef &Ref); + LLVM_ABI Error readStreamRef(BinaryStreamRef &Ref); /// Read \p Length bytes from the underlying stream into \p Ref. This is /// equivalent to calling getUnderlyingStream().slice(Offset, Length). @@ -137,7 +138,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readStreamRef(BinaryStreamRef &Ref, uint32_t Length); + LLVM_ABI Error readStreamRef(BinaryStreamRef &Ref, uint32_t Length); /// Read \p Length bytes from the underlying stream into \p Ref. This is /// equivalent to calling getUnderlyingStream().slice(Offset, Length). @@ -146,7 +147,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readSubstream(BinarySubstreamRef &Ref, uint32_t Length); + LLVM_ABI Error readSubstream(BinarySubstreamRef &Ref, uint32_t Length); /// Get a pointer to an object of type T from the underlying stream, as if by /// memcpy, and store the result into \p Dest. It is up to the caller to @@ -251,17 +252,17 @@ class BinaryStreamReader { /// /// \returns a success error code if at least \p Amount bytes remain in the /// stream, otherwise returns an appropriate error code. - Error skip(uint64_t Amount); + LLVM_ABI Error skip(uint64_t Amount); /// Examine the next byte of the underlying stream without advancing the /// stream's offset. If the stream is empty the behavior is undefined. /// /// \returns the next byte in the stream. - uint8_t peek() const; + LLVM_ABI uint8_t peek() const; - Error padToAlignment(uint32_t Align); + LLVM_ABI Error padToAlignment(uint32_t Align); - std::pair + LLVM_ABI std::pair split(uint64_t Offset) const; private: diff --git a/llvm/include/llvm/Support/BinaryStreamRef.h b/llvm/include/llvm/Support/BinaryStreamRef.h index fdc46f5fd5605..85f2073bd67fa 100644 --- a/llvm/include/llvm/Support/BinaryStreamRef.h +++ b/llvm/include/llvm/Support/BinaryStreamRef.h @@ -9,6 +9,7 @@ #ifndef LLVM_SUPPORT_BINARYSTREAMREF_H #define LLVM_SUPPORT_BINARYSTREAMREF_H +#include "llvm/Support/Compiler.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/BinaryStream.h" #include "llvm/Support/BinaryStreamError.h" @@ -160,11 +161,11 @@ class BinaryStreamRef public: BinaryStreamRef() = default; - BinaryStreamRef(BinaryStream &Stream); - BinaryStreamRef(BinaryStream &Stream, uint64_t Offset, + LLVM_ABI BinaryStreamRef(BinaryStream &Stream); + LLVM_ABI BinaryStreamRef(BinaryStream &Stream, uint64_t Offset, std::optional Length); - explicit BinaryStreamRef(ArrayRef Data, llvm::endianness Endian); - explicit BinaryStreamRef(StringRef Data, llvm::endianness Endian); + LLVM_ABI explicit BinaryStreamRef(ArrayRef Data, llvm::endianness Endian); + LLVM_ABI explicit BinaryStreamRef(StringRef Data, llvm::endianness Endian); BinaryStreamRef(const BinaryStreamRef &Other) = default; BinaryStreamRef &operator=(const BinaryStreamRef &Other) = default; @@ -181,7 +182,7 @@ class BinaryStreamRef /// \returns a success error code if the entire range of data is within the /// bounds of this BinaryStreamRef's view and the implementation could read /// the data, and an appropriate error code otherwise. - Error readBytes(uint64_t Offset, uint64_t Size, + LLVM_ABI Error readBytes(uint64_t Offset, uint64_t Size, ArrayRef &Buffer) const; /// Given an Offset into this BinaryStreamRef, return a reference to the @@ -189,7 +190,7 @@ class BinaryStreamRef /// /// \returns a success error code if implementation could read the data, /// and an appropriate error code otherwise. - Error readLongestContiguousChunk(uint64_t Offset, + LLVM_ABI Error readLongestContiguousChunk(uint64_t Offset, ArrayRef &Buffer) const; }; @@ -233,10 +234,10 @@ class WritableBinaryStreamRef public: WritableBinaryStreamRef() = default; - WritableBinaryStreamRef(WritableBinaryStream &Stream); - WritableBinaryStreamRef(WritableBinaryStream &Stream, uint64_t Offset, + LLVM_ABI WritableBinaryStreamRef(WritableBinaryStream &Stream); + LLVM_ABI WritableBinaryStreamRef(WritableBinaryStream &Stream, uint64_t Offset, std::optional Length); - explicit WritableBinaryStreamRef(MutableArrayRef Data, + LLVM_ABI explicit WritableBinaryStreamRef(MutableArrayRef Data, llvm::endianness Endian); WritableBinaryStreamRef(const WritableBinaryStreamRef &Other) = default; WritableBinaryStreamRef & @@ -255,13 +256,13 @@ class WritableBinaryStreamRef /// \returns a success error code if the data could fit within the underlying /// stream at the specified location and the implementation could write the /// data, and an appropriate error code otherwise. - Error writeBytes(uint64_t Offset, ArrayRef Data) const; + LLVM_ABI Error writeBytes(uint64_t Offset, ArrayRef Data) const; /// Conver this WritableBinaryStreamRef to a read-only BinaryStreamRef. - operator BinaryStreamRef() const; + LLVM_ABI operator BinaryStreamRef() const; /// For buffered streams, commits changes to the backing store. - Error commit(); + LLVM_ABI Error commit(); }; } // end namespace llvm diff --git a/llvm/include/llvm/Support/BinaryStreamWriter.h b/llvm/include/llvm/Support/BinaryStreamWriter.h index bc1d7949841d6..4302818d33557 100644 --- a/llvm/include/llvm/Support/BinaryStreamWriter.h +++ b/llvm/include/llvm/Support/BinaryStreamWriter.h @@ -9,6 +9,7 @@ #ifndef LLVM_SUPPORT_BINARYSTREAMWRITER_H #define LLVM_SUPPORT_BINARYSTREAMWRITER_H +#include "llvm/Support/Compiler.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/BinaryStreamArray.h" @@ -30,9 +31,9 @@ namespace llvm { class BinaryStreamWriter { public: BinaryStreamWriter() = default; - explicit BinaryStreamWriter(WritableBinaryStreamRef Ref); - explicit BinaryStreamWriter(WritableBinaryStream &Stream); - explicit BinaryStreamWriter(MutableArrayRef Data, + LLVM_ABI explicit BinaryStreamWriter(WritableBinaryStreamRef Ref); + LLVM_ABI explicit BinaryStreamWriter(WritableBinaryStream &Stream); + LLVM_ABI explicit BinaryStreamWriter(MutableArrayRef Data, llvm::endianness Endian); BinaryStreamWriter(const BinaryStreamWriter &Other) = default; @@ -47,7 +48,7 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeBytes(ArrayRef Buffer); + LLVM_ABI Error writeBytes(ArrayRef Buffer); /// Write the integer \p Value to the underlying stream in the /// specified endianness. On success, updates the offset so that @@ -77,14 +78,14 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeULEB128(uint64_t Value); + LLVM_ABI Error writeULEB128(uint64_t Value); /// Write the unsigned integer Value to the underlying stream using ULEB128 /// encoding. /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeSLEB128(int64_t Value); + LLVM_ABI Error writeSLEB128(int64_t Value); /// Write the string \p Str to the underlying stream followed by a null /// terminator. On success, updates the offset so that subsequent writes @@ -93,7 +94,7 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeCString(StringRef Str); + LLVM_ABI Error writeCString(StringRef Str); /// Write the string \p Str to the underlying stream without a null /// terminator. On success, updates the offset so that subsequent writes @@ -101,7 +102,7 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeFixedString(StringRef Str); + LLVM_ABI Error writeFixedString(StringRef Str); /// Efficiently reads all data from \p Ref, and writes it to this stream. /// This operation will not invoke any copies of the source data, regardless @@ -109,7 +110,7 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeStreamRef(BinaryStreamRef Ref); + LLVM_ABI Error writeStreamRef(BinaryStreamRef Ref); /// Efficiently reads \p Size bytes from \p Ref, and writes it to this stream. /// This operation will not invoke any copies of the source data, regardless @@ -117,7 +118,7 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeStreamRef(BinaryStreamRef Ref, uint64_t Size); + LLVM_ABI Error writeStreamRef(BinaryStreamRef Ref, uint64_t Size); /// Writes the object \p Obj to the underlying stream, as if by using memcpy. /// It is up to the caller to ensure that type of \p Obj can be safely copied @@ -171,13 +172,13 @@ class BinaryStreamWriter { } /// Splits the Writer into two Writers at a given offset. - std::pair split(uint64_t Off) const; + LLVM_ABI std::pair split(uint64_t Off) const; void setOffset(uint64_t Off) { Offset = Off; } uint64_t getOffset() const { return Offset; } uint64_t getLength() const { return Stream.getLength(); } uint64_t bytesRemaining() const { return getLength() - getOffset(); } - Error padToAlignment(uint32_t Align); + LLVM_ABI Error padToAlignment(uint32_t Align); protected: WritableBinaryStreamRef Stream; diff --git a/llvm/include/llvm/Support/BlockFrequency.h b/llvm/include/llvm/Support/BlockFrequency.h index aeab99615a951..131f1d0b1ab02 100644 --- a/llvm/include/llvm/Support/BlockFrequency.h +++ b/llvm/include/llvm/Support/BlockFrequency.h @@ -13,6 +13,7 @@ #ifndef LLVM_SUPPORT_BLOCKFREQUENCY_H #define LLVM_SUPPORT_BLOCKFREQUENCY_H +#include "llvm/Support/Compiler.h" #include #include #include @@ -39,13 +40,13 @@ class BlockFrequency { /// Multiplies with a branch probability. The computation will never /// overflow. - BlockFrequency &operator*=(BranchProbability Prob); - BlockFrequency operator*(BranchProbability Prob) const; + LLVM_ABI BlockFrequency &operator*=(BranchProbability Prob); + LLVM_ABI BlockFrequency operator*(BranchProbability Prob) const; /// Divide by a non-zero branch probability using saturating /// arithmetic. - BlockFrequency &operator/=(BranchProbability Prob); - BlockFrequency operator/(BranchProbability Prob) const; + LLVM_ABI BlockFrequency &operator/=(BranchProbability Prob); + LLVM_ABI BlockFrequency operator/(BranchProbability Prob) const; /// Adds another block frequency using saturating arithmetic. BlockFrequency &operator+=(BlockFrequency Freq) { @@ -80,7 +81,7 @@ class BlockFrequency { } /// Multiplies frequency with `Factor`. Returns `nullopt` in case of overflow. - std::optional mul(uint64_t Factor) const; + LLVM_ABI std::optional mul(uint64_t Factor) const; /// Shift block frequency to the right by count digits saturating to 1. BlockFrequency &operator>>=(const unsigned count) { @@ -120,7 +121,7 @@ class BlockFrequency { } }; -void printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq, +LLVM_ABI void printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq, BlockFrequency Freq); } // namespace llvm diff --git a/llvm/include/llvm/Support/BranchProbability.h b/llvm/include/llvm/Support/BranchProbability.h index 74731c416ac04..37182c744c507 100644 --- a/llvm/include/llvm/Support/BranchProbability.h +++ b/llvm/include/llvm/Support/BranchProbability.h @@ -14,6 +14,7 @@ #define LLVM_SUPPORT_BRANCHPROBABILITY_H #include "llvm/ADT/ADL.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/DataTypes.h" #include #include @@ -42,7 +43,7 @@ class BranchProbability { public: BranchProbability() : N(UnknownN) {} - BranchProbability(uint32_t Numerator, uint32_t Denominator); + LLVM_ABI BranchProbability(uint32_t Numerator, uint32_t Denominator); bool isZero() const { return N == 0; } bool isUnknown() const { return N == UnknownN; } @@ -54,7 +55,7 @@ class BranchProbability { // as denominator. static BranchProbability getRaw(uint32_t N) { return BranchProbability(N); } // Create a BranchProbability object from 64-bit integers. - static BranchProbability getBranchProbability(uint64_t Numerator, + LLVM_ABI static BranchProbability getBranchProbability(uint64_t Numerator, uint64_t Denominator); // Normalize given probabilties so that the sum of them becomes approximate @@ -74,9 +75,9 @@ class BranchProbability { // Return (1 - Probability). BranchProbability getCompl() const { return BranchProbability(D - N); } - raw_ostream &print(raw_ostream &OS) const; + LLVM_ABI raw_ostream &print(raw_ostream &OS) const; - void dump() const; + LLVM_ABI void dump() const; /// Scale a large integer. /// @@ -84,7 +85,7 @@ class BranchProbability { /// result. /// /// \return \c Num times \c this. - uint64_t scale(uint64_t Num) const; + LLVM_ABI uint64_t scale(uint64_t Num) const; /// Scale a large integer by the inverse. /// @@ -92,7 +93,7 @@ class BranchProbability { /// Returns the floor of the result. /// /// \return \c Num divided by \c this. - uint64_t scaleByInverse(uint64_t Num) const; + LLVM_ABI uint64_t scaleByInverse(uint64_t Num) const; BranchProbability &operator+=(BranchProbability RHS) { assert(N != UnknownN && RHS.N != UnknownN && diff --git a/llvm/include/llvm/Support/BuryPointer.h b/llvm/include/llvm/Support/BuryPointer.h index 276a5b7089c3e..02144baed36af 100644 --- a/llvm/include/llvm/Support/BuryPointer.h +++ b/llvm/include/llvm/Support/BuryPointer.h @@ -9,6 +9,7 @@ #ifndef LLVM_SUPPORT_BURYPOINTER_H #define LLVM_SUPPORT_BURYPOINTER_H +#include "llvm/Support/Compiler.h" #include namespace llvm { @@ -19,7 +20,7 @@ namespace llvm { // the memory is not misdiagnosed as an unintentional leak by leak detection // tools (this is achieved by preserving pointers to the object in a globally // visible array). -void BuryPointer(const void *Ptr); +LLVM_ABI void BuryPointer(const void *Ptr); template void BuryPointer(std::unique_ptr Ptr) { BuryPointer(Ptr.release()); } diff --git a/llvm/include/llvm/Support/COM.h b/llvm/include/llvm/Support/COM.h index d59966f849b48..cb97977eddfa4 100644 --- a/llvm/include/llvm/Support/COM.h +++ b/llvm/include/llvm/Support/COM.h @@ -21,9 +21,9 @@ enum class COMThreadingMode { SingleThreaded, MultiThreaded }; class InitializeCOMRAII { public: - explicit InitializeCOMRAII(COMThreadingMode Threading, + LLVM_ABI explicit InitializeCOMRAII(COMThreadingMode Threading, bool SpeedOverMemory = false); - ~InitializeCOMRAII(); + LLVM_ABI ~InitializeCOMRAII(); private: InitializeCOMRAII(const InitializeCOMRAII &) = delete; diff --git a/llvm/include/llvm/Support/CRC.h b/llvm/include/llvm/Support/CRC.h index 210890ae06d47..a07b017d23519 100644 --- a/llvm/include/llvm/Support/CRC.h +++ b/llvm/include/llvm/Support/CRC.h @@ -13,17 +13,18 @@ #ifndef LLVM_SUPPORT_CRC_H #define LLVM_SUPPORT_CRC_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/DataTypes.h" namespace llvm { template class ArrayRef; // Compute the CRC-32 of Data. -uint32_t crc32(ArrayRef Data); +LLVM_ABI uint32_t crc32(ArrayRef Data); // Compute the running CRC-32 of Data, with CRC being the previous value of the // checksum. -uint32_t crc32(uint32_t CRC, ArrayRef Data); +LLVM_ABI uint32_t crc32(uint32_t CRC, ArrayRef Data); // Class for computing the JamCRC. // @@ -47,7 +48,7 @@ class JamCRC { JamCRC(uint32_t Init = 0xFFFFFFFFU) : CRC(Init) {} // Update the CRC calculation with Data. - void update(ArrayRef Data); + LLVM_ABI void update(ArrayRef Data); uint32_t getCRC() const { return CRC; } diff --git a/llvm/include/llvm/Support/CSKYAttributeParser.h b/llvm/include/llvm/Support/CSKYAttributeParser.h index 08257a744a959..df7051b0a7880 100644 --- a/llvm/include/llvm/Support/CSKYAttributeParser.h +++ b/llvm/include/llvm/Support/CSKYAttributeParser.h @@ -9,11 +9,12 @@ #ifndef LLVM_SUPPORT_CSKYATTRIBUTEPARSER_H #define LLVM_SUPPORT_CSKYATTRIBUTEPARSER_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/CSKYAttributes.h" #include "llvm/Support/ELFAttrParserCompact.h" namespace llvm { -class CSKYAttributeParser : public ELFCompactAttrParser { +class LLVM_ABI CSKYAttributeParser : public ELFCompactAttrParser { struct DisplayHandler { CSKYAttrs::AttrType attribute; Error (CSKYAttributeParser::*routine)(unsigned); diff --git a/llvm/include/llvm/Support/CSKYAttributes.h b/llvm/include/llvm/Support/CSKYAttributes.h index 723f2ceee8fb7..c16d3de96c219 100644 --- a/llvm/include/llvm/Support/CSKYAttributes.h +++ b/llvm/include/llvm/Support/CSKYAttributes.h @@ -12,12 +12,13 @@ #ifndef LLVM_SUPPORT_CSKYATTRIBUTES_H #define LLVM_SUPPORT_CSKYATTRIBUTES_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/ELFAttributes.h" namespace llvm { namespace CSKYAttrs { -const TagNameMap &getCSKYAttributeTags(); +LLVM_ABI const TagNameMap &getCSKYAttributeTags(); enum AttrType { CSKY_ARCH_NAME = 4, diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h index 17e148830a73f..50d5ea41ec9ba 100644 --- a/llvm/include/llvm/Support/CachePruning.h +++ b/llvm/include/llvm/Support/CachePruning.h @@ -14,6 +14,7 @@ #ifndef LLVM_SUPPORT_CACHEPRUNING_H #define LLVM_SUPPORT_CACHEPRUNING_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/MemoryBuffer.h" #include #include @@ -66,7 +67,7 @@ struct CachePruningPolicy { /// For example: "prune_interval=30s:prune_after=24h:cache_size=50%" /// which means a pruning interval of 30 seconds, expiration time of 24 hours /// and maximum cache size of 50% of available disk space. -Expected parseCachePruningPolicy(StringRef PolicyStr); +LLVM_ABI Expected parseCachePruningPolicy(StringRef PolicyStr); /// Peform pruning using the supplied policy, returns true if pruning /// occurred, i.e. if Policy.Interval was expired. @@ -79,7 +80,7 @@ Expected parseCachePruningPolicy(StringRef PolicyStr); /// As a safeguard against data loss if the user specifies the wrong directory /// as their cache directory, this function will ignore files not matching the /// pattern "llvmcache-*". -bool pruneCache(StringRef Path, CachePruningPolicy Policy, +LLVM_ABI bool pruneCache(StringRef Path, CachePruningPolicy Policy, const std::vector> &Files = {}); } // namespace llvm diff --git a/llvm/include/llvm/Support/Caching.h b/llvm/include/llvm/Support/Caching.h index 9a82921e6ffc7..7fd9befbef9db 100644 --- a/llvm/include/llvm/Support/Caching.h +++ b/llvm/include/llvm/Support/Caching.h @@ -15,6 +15,7 @@ #ifndef LLVM_SUPPORT_CACHING_H #define LLVM_SUPPORT_CACHING_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" namespace llvm { @@ -113,7 +114,7 @@ using AddBufferFn = std::function localCache( +LLVM_ABI Expected localCache( const Twine &CacheNameRef, const Twine &TempFilePrefixRef, const Twine &CacheDirectoryPathRef, AddBufferFn AddBuffer = [](size_t Task, const Twine &ModuleName, diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h index 71859af7c7e4a..98b8a44c851c9 100644 --- a/llvm/include/llvm/Support/Chrono.h +++ b/llvm/include/llvm/Support/Chrono.h @@ -77,8 +77,8 @@ toTimePoint(std::time_t T, uint32_t nsec) { } // namespace sys -raw_ostream &operator<<(raw_ostream &OS, sys::TimePoint<> TP); -raw_ostream &operator<<(raw_ostream &OS, sys::UtcTime<> TP); +LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, sys::TimePoint<> TP); +LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, sys::UtcTime<> TP); /// Format provider for TimePoint<> /// @@ -90,12 +90,12 @@ raw_ostream &operator<<(raw_ostream &OS, sys::UtcTime<> TP); /// If no options are given, the default format is "%Y-%m-%d %H:%M:%S.%N". template <> struct format_provider> { - static void format(const sys::TimePoint<> &TP, llvm::raw_ostream &OS, + LLVM_ABI static void format(const sys::TimePoint<> &TP, llvm::raw_ostream &OS, StringRef Style); }; template <> struct format_provider> { - static void format(const sys::UtcTime &TP, + LLVM_ABI static void format(const sys::UtcTime &TP, llvm::raw_ostream &OS, StringRef Style); }; @@ -103,12 +103,12 @@ namespace detail { template struct unit { static const char value[]; }; template const char unit::value[] = ""; -template <> struct unit> { static const char value[]; }; -template <> struct unit> { static const char value[]; }; -template <> struct unit> { static const char value[]; }; -template <> struct unit { static const char value[]; }; -template <> struct unit { static const char value[]; }; -template <> struct unit { static const char value[]; }; +template <> struct unit> { LLVM_ABI static const char value[]; }; +template <> struct unit> { LLVM_ABI static const char value[]; }; +template <> struct unit> { LLVM_ABI static const char value[]; }; +template <> struct unit { LLVM_ABI static const char value[]; }; +template <> struct unit { LLVM_ABI static const char value[]; }; +template <> struct unit { LLVM_ABI static const char value[]; }; } // namespace detail /// Implementation of format_provider for duration types. diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h index 531750572102c..a2bd9214d9dd1 100644 --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -19,6 +19,7 @@ #ifndef LLVM_SUPPORT_COMMANDLINE_H #define LLVM_SUPPORT_COMMANDLINE_H +#include "llvm/Support/Compiler.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" @@ -65,7 +66,7 @@ namespace cl { // that give precedence to later occurrences. If your program supports options // that give precedence to earlier occurrences, you will need to extend this // function to support it correctly. -bool ParseCommandLineOptions(int argc, const char *const *argv, +LLVM_ABI bool ParseCommandLineOptions(int argc, const char *const *argv, StringRef Overview = "", raw_ostream *Errs = nullptr, const char *EnvVar = nullptr, @@ -78,20 +79,20 @@ using VersionPrinterTy = std::function; /// Override the default (LLVM specific) version printer used to print out the /// version when --version is given on the command line. This allows other /// systems using the CommandLine utilities to print their own version string. -void SetVersionPrinter(VersionPrinterTy func); +LLVM_ABI void SetVersionPrinter(VersionPrinterTy func); ///===---------------------------------------------------------------------===// /// Add an extra printer to use in addition to the default one. This can be /// called multiple times, and each time it adds a new function to the list /// which will be called after the basic LLVM version printing is complete. /// Each can then add additional information specific to the tool. -void AddExtraVersionPrinter(VersionPrinterTy func); +LLVM_ABI void AddExtraVersionPrinter(VersionPrinterTy func); // Print option values. // With -print-options print the difference between option values and defaults. // With -print-all-options print all option values. // (Currently not perfect, but best-effort.) -void PrintOptionValues(); +LLVM_ABI void PrintOptionValues(); // Forward declaration - AddLiteralOption needs to be up here to make gcc happy. class Option; @@ -103,7 +104,7 @@ class Option; /// /// Literal options are used by some parsers to register special option values. /// This is how the PassNameParser registers pass names for opt. -void AddLiteralOption(Option &O, StringRef Name); +LLVM_ABI void AddLiteralOption(Option &O, StringRef Name); //===----------------------------------------------------------------------===// // Flags permitted to be passed to command line arguments @@ -181,7 +182,7 @@ class OptionCategory { StringRef const Name; StringRef const Description; - void registerCategory(); + LLVM_ABI void registerCategory(); public: OptionCategory(StringRef const Name, @@ -195,7 +196,7 @@ class OptionCategory { }; // The general Option Category (used as default category). -OptionCategory &getGeneralCategory(); +LLVM_ABI OptionCategory &getGeneralCategory(); //===----------------------------------------------------------------------===// // @@ -205,8 +206,8 @@ class SubCommand { StringRef Description; protected: - void registerSubCommand(); - void unregisterSubCommand(); + LLVM_ABI void registerSubCommand(); + LLVM_ABI void unregisterSubCommand(); public: SubCommand(StringRef Name, StringRef Description = "") @@ -216,15 +217,15 @@ class SubCommand { SubCommand() = default; // Get the special subcommand representing no subcommand. - static SubCommand &getTopLevel(); + LLVM_ABI static SubCommand &getTopLevel(); // Get the special subcommand that can be used to put an option into all // subcommands. - static SubCommand &getAll(); + LLVM_ABI static SubCommand &getAll(); - void reset(); + LLVM_ABI void reset(); - explicit operator bool() const; + LLVM_ABI explicit operator bool() const; StringRef getName() const { return Name; } StringRef getDescription() const { return Description; } @@ -247,7 +248,7 @@ class SubCommandGroup { //===----------------------------------------------------------------------===// // -class Option { +class LLVM_ABI Option { friend class alias; // Overriden by subclasses to handle the value passed into an argument. Should @@ -529,7 +530,7 @@ callback(F CB) { //===----------------------------------------------------------------------===// // Support value comparison outside the template. -struct GenericOptionValue { +struct LLVM_ABI GenericOptionValue { virtual bool compare(const GenericOptionValue &V) const = 0; protected: @@ -636,7 +637,7 @@ struct OptionValue final // Other safe-to-copy-by-value common option types. enum boolOrDefault { BOU_UNSET, BOU_TRUE, BOU_FALSE }; template <> -struct OptionValue final +struct LLVM_ABI OptionValue final : OptionValueCopy { using WrapperType = cl::boolOrDefault; @@ -654,7 +655,7 @@ struct OptionValue final }; template <> -struct OptionValue final : OptionValueCopy { +struct LLVM_ABI OptionValue final : OptionValueCopy { using WrapperType = StringRef; OptionValue() = default; @@ -724,7 +725,7 @@ template ValuesClass values(OptsTy... Options) { // every instance of the generic parser. This also allows us to put stuff into // CommandLine.cpp // -class generic_parser_base { +class LLVM_ABI generic_parser_base { protected: class GenericOptionInfo { public: @@ -890,7 +891,7 @@ template class parser : public generic_parser_base { //-------------------------------------------------- // Super class of parsers to provide boilerplate code // -class basic_parser_impl { // non-template implementation of basic_parser +class LLVM_ABI basic_parser_impl { // non-template implementation of basic_parser public: basic_parser_impl(Option &) {} @@ -941,7 +942,7 @@ template class basic_parser : public basic_parser_impl { extern template class basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -968,7 +969,7 @@ template <> class parser : public basic_parser { extern template class basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -993,7 +994,7 @@ template <> class parser : public basic_parser { extern template class basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1014,7 +1015,7 @@ template <> class parser : public basic_parser { extern template class basic_parser; -template <> class parser final : public basic_parser { +template <> class LLVM_ABI parser final : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1035,7 +1036,7 @@ template <> class parser final : public basic_parser { extern template class basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1056,7 +1057,7 @@ template <> class parser : public basic_parser { extern template class basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1078,7 +1079,7 @@ template <> class parser : public basic_parser { extern template class basic_parser; template <> -class parser final : public basic_parser { +class LLVM_ABI parser final : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1100,7 +1101,7 @@ class parser final : public basic_parser { extern template class basic_parser; template <> -class parser : public basic_parser { +class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1122,7 +1123,7 @@ class parser : public basic_parser { extern template class basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1143,7 +1144,7 @@ template <> class parser : public basic_parser { extern template class basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1164,7 +1165,7 @@ template <> class parser : public basic_parser { extern template class basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1188,7 +1189,7 @@ template <> class parser : public basic_parser { extern template class basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1906,7 +1907,7 @@ class bits : public Option, public bits_storage { // Aliased command line option (alias this name to a preexisting name) // -class alias : public Option { +class LLVM_ABI alias : public Option { Option *AliasFor; bool handleOccurrence(unsigned pos, StringRef /*ArgName*/, @@ -1979,27 +1980,27 @@ struct aliasopt { struct extrahelp { StringRef morehelp; - explicit extrahelp(StringRef help); + LLVM_ABI explicit extrahelp(StringRef help); }; -void PrintVersionMessage(); +LLVM_ABI void PrintVersionMessage(); /// This function just prints the help message, exactly the same way as if the /// -help or -help-hidden option had been given on the command line. /// /// \param Hidden if true will print hidden options /// \param Categorized if true print options in categories -void PrintHelpMessage(bool Hidden = false, bool Categorized = false); +LLVM_ABI void PrintHelpMessage(bool Hidden = false, bool Categorized = false); /// An array of optional enabled settings in the LLVM build configuration, /// which may be of interest to compiler developers. For example, includes /// "+assertions" if assertions are enabled. Used by printBuildConfig. -ArrayRef getCompilerBuildConfig(); +LLVM_ABI ArrayRef getCompilerBuildConfig(); /// Prints the compiler build configuration. /// Designed for compiler developers, not compiler end-users. /// Intended to be used in --version output when enabled. -void printBuildConfig(raw_ostream &OS); +LLVM_ABI void printBuildConfig(raw_ostream &OS); //===----------------------------------------------------------------------===// // Public interface for accessing registered options. @@ -2032,7 +2033,7 @@ void printBuildConfig(raw_ostream &OS); /// Hopefully this API can be deprecated soon. Any situation where options need /// to be modified by tools or libraries should be handled by sane APIs rather /// than just handing around a global list. -StringMap