diff --git a/llvm/include/llvm-c/Error.h b/llvm/include/llvm-c/Error.h --- a/llvm/include/llvm-c/Error.h +++ b/llvm/include/llvm-c/Error.h @@ -14,6 +14,7 @@ #ifndef LLVM_C_ERROR_H #define LLVM_C_ERROR_H +#include "llvm/Support/LLVMSupportExports.h" #include "llvm-c/ExternC.h" LLVM_C_EXTERN_C_BEGIN @@ -34,7 +35,7 @@ * Returns the type id for the given error instance, which must be a failure * value (i.e. non-null). */ -LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err); +LLVM_SUPPORT_ABI LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err); /** * Dispose of the given error without handling it. This operation consumes the @@ -42,7 +43,7 @@ * Note: This method *only* needs to be called if the error is not being passed * to some other consuming operation, e.g. LLVMGetErrorMessage. */ -void LLVMConsumeError(LLVMErrorRef Err); +LLVM_SUPPORT_ABI void LLVMConsumeError(LLVMErrorRef Err); /** * Returns the given string's error message. This operation consumes the error, @@ -50,17 +51,17 @@ * The caller is responsible for disposing of the string by calling * LLVMDisposeErrorMessage. */ -char *LLVMGetErrorMessage(LLVMErrorRef Err); +LLVM_SUPPORT_ABI char *LLVMGetErrorMessage(LLVMErrorRef Err); /** * Dispose of the given error message. */ -void LLVMDisposeErrorMessage(char *ErrMsg); +LLVM_SUPPORT_ABI void LLVMDisposeErrorMessage(char *ErrMsg); /** * Returns the type id for llvm StringError. */ -LLVMErrorTypeId LLVMGetStringErrorTypeId(void); +LLVM_SUPPORT_ABI LLVMErrorTypeId LLVMGetStringErrorTypeId(void); /** * Create a StringError. diff --git a/llvm/include/llvm-c/ErrorHandling.h b/llvm/include/llvm-c/ErrorHandling.h --- a/llvm/include/llvm-c/ErrorHandling.h +++ b/llvm/include/llvm-c/ErrorHandling.h @@ -15,6 +15,7 @@ #define LLVM_C_ERRORHANDLING_H #include "llvm-c/ExternC.h" +#include "llvm/Support/LLVMSupportExports.h" LLVM_C_EXTERN_C_BEGIN @@ -40,7 +41,7 @@ * signals and prints which component of LLVM you were in at the time if the * crash. */ -void LLVMEnablePrettyStackTrace(void); +LLVM_SUPPORT_ABI void LLVMEnablePrettyStackTrace(void); LLVM_C_EXTERN_C_END diff --git a/llvm/include/llvm/ADT/APFixedPoint.h b/llvm/include/llvm/ADT/APFixedPoint.h --- a/llvm/include/llvm/ADT/APFixedPoint.h +++ b/llvm/include/llvm/ADT/APFixedPoint.h @@ -18,6 +18,7 @@ #include "llvm/ADT/APSInt.h" #include "llvm/ADT/SmallString.h" +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/raw_ostream.h" namespace llvm { @@ -30,7 +31,7 @@ /// if any). The scale represents the number of fractional bits in this type. /// When HasUnsignedPadding is true and this type is unsigned, the first bit /// in the value this represents is treated as padding. -class FixedPointSemantics { +class LLVM_SUPPORT_ABI FixedPointSemantics { public: FixedPointSemantics(unsigned Width, unsigned Scale, bool IsSigned, bool IsSaturated, bool HasUnsignedPadding) @@ -97,7 +98,7 @@ /// info about the fixed point type's width, sign, scale, and saturation, and /// provides different operations that would normally be performed on fixed point /// types. -class APFixedPoint { +class LLVM_SUPPORT_ABI APFixedPoint { public: APFixedPoint(const APInt &Val, const FixedPointSemantics &Sema) : Val(Val, !Sema.isSigned()), Sema(Sema) { diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h --- a/llvm/include/llvm/ADT/APFloat.h +++ b/llvm/include/llvm/ADT/APFloat.h @@ -20,6 +20,8 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/FloatingPointMode.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/LLVMSupportExports.h" + #include #define APFLOAT_DISPATCH_ON_SEMANTICS(METHOD_CALL) \ @@ -140,7 +142,7 @@ // This is the common type definitions shared by APFloat and its internal // implementation classes. This struct should not define any non-static data // members. -struct APFloatBase { +struct LLVM_SUPPORT_ABI APFloatBase { typedef APInt::WordType integerPart; static constexpr unsigned integerPartWidth = APInt::APINT_BITS_PER_WORD; @@ -244,7 +246,7 @@ namespace detail { -class IEEEFloat final : public APFloatBase { +class LLVM_SUPPORT_ABI IEEEFloat final : public APFloatBase { public: /// \name Constructors /// @{ @@ -404,7 +406,7 @@ /// emphasizes producing different codes for different inputs in order to /// be used in canonicalization and memoization. As such, equality is /// bitwiseIsEqual, and 0 != -0. - friend hash_code hash_value(const IEEEFloat &Arg); + friend LLVM_SUPPORT_ABI hash_code hash_value(const IEEEFloat &Arg); /// Converts this value into a decimal string. /// @@ -448,12 +450,12 @@ /// 0 -> \c IEK_Zero /// Inf -> \c IEK_Inf /// - friend int ilogb(const IEEEFloat &Arg); + friend LLVM_SUPPORT_ABI int ilogb(const IEEEFloat &Arg); /// Returns: X * 2^Exp for integral exponents. - friend IEEEFloat scalbn(IEEEFloat X, int Exp, roundingMode); + friend LLVM_SUPPORT_ABI IEEEFloat scalbn(IEEEFloat X, int Exp, roundingMode); - friend IEEEFloat frexp(const IEEEFloat &X, int &Exp, roundingMode); + friend LLVM_SUPPORT_ABI IEEEFloat frexp(const IEEEFloat &X, int &Exp, roundingMode); /// \name Special value setters. /// @{ @@ -590,16 +592,16 @@ unsigned int sign : 1; }; -hash_code hash_value(const IEEEFloat &Arg); -int ilogb(const IEEEFloat &Arg); -IEEEFloat scalbn(IEEEFloat X, int Exp, IEEEFloat::roundingMode); -IEEEFloat frexp(const IEEEFloat &Val, int &Exp, IEEEFloat::roundingMode RM); +LLVM_SUPPORT_ABI hash_code hash_value(const IEEEFloat &Arg); +LLVM_SUPPORT_ABI int ilogb(const IEEEFloat &Arg); +LLVM_SUPPORT_ABI IEEEFloat scalbn(IEEEFloat X, int Exp, IEEEFloat::roundingMode); +LLVM_SUPPORT_ABI IEEEFloat frexp(const IEEEFloat &Val, int &Exp, IEEEFloat::roundingMode RM); // This mode implements more precise float in terms of two APFloats. // The interface and layout is designed for arbitrary underlying semantics, // though currently only PPCDoubleDouble semantics are supported, whose // corresponding underlying semantics are IEEEdouble. -class DoubleAPFloat final : public APFloatBase { +class LLVM_SUPPORT_ABI DoubleAPFloat final : public APFloatBase { // Note: this must be the first data member. const fltSemantics *Semantics; std::unique_ptr Floats; @@ -687,8 +689,8 @@ bool getExactInverse(APFloat *inv) const; - friend DoubleAPFloat scalbn(const DoubleAPFloat &X, int Exp, roundingMode); - friend DoubleAPFloat frexp(const DoubleAPFloat &X, int &Exp, roundingMode); + friend LLVM_SUPPORT_ABI DoubleAPFloat scalbn(const DoubleAPFloat &X, int Exp, roundingMode); + friend LLVM_SUPPORT_ABI DoubleAPFloat frexp(const DoubleAPFloat &X, int &Exp, roundingMode); friend hash_code hash_value(const DoubleAPFloat &Arg); }; @@ -698,7 +700,7 @@ // This is a interface class that is currently forwarding functionalities from // detail::IEEEFloat. -class APFloat : public APFloatBase { +class LLVM_SUPPORT_ABI APFloat : public APFloatBase { typedef detail::IEEEFloat IEEEFloat; typedef detail::DoubleAPFloat DoubleAPFloat; @@ -1248,7 +1250,7 @@ APFLOAT_DISPATCH_ON_SEMANTICS(getExactInverse(inv)); } - friend hash_code hash_value(const APFloat &Arg); + friend LLVM_SUPPORT_ABI hash_code hash_value(const APFloat &Arg); friend int ilogb(const APFloat &Arg) { return ilogb(Arg.getIEEE()); } friend APFloat scalbn(APFloat X, int Exp, roundingMode RM); friend APFloat frexp(const APFloat &X, int &Exp, roundingMode RM); @@ -1260,7 +1262,8 @@ /// /// These additional declarations are required in order to compile LLVM with IBM /// xlC compiler. -hash_code hash_value(const APFloat &Arg); +LLVM_SUPPORT_ABI hash_code hash_value(const APFloat &Arg); + inline APFloat scalbn(APFloat X, int Exp, APFloat::roundingMode RM) { if (APFloat::usesLayout(X.getSemantics())) return APFloat(scalbn(X.U.IEEE, Exp, RM), X.getSemantics()); diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -16,7 +16,9 @@ #define LLVM_ADT_APINT_H #include "llvm/Support/Compiler.h" +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/MathExtras.h" + #include #include #include @@ -67,7 +69,7 @@ /// * In general, the class tries to follow the style of computation that LLVM /// uses in its IR. This simplifies its use for LLVM. /// -class LLVM_NODISCARD APInt { +class LLVM_NODISCARD LLVM_SUPPORT_ABI APInt { public: typedef uint64_t WordType; @@ -686,7 +688,7 @@ } /// Overload to compute a hash_code for an APInt value. - friend hash_code hash_value(const APInt &Arg); + friend LLVM_SUPPORT_ABI hash_code hash_value(const APInt &Arg); /// This function returns a pointer to the internal storage of the APInt. /// This is useful for writing out the APInt in binary form without any @@ -2190,7 +2192,7 @@ /// using Stein's algorithm. /// /// \returns the greatest common divisor of A and B. -APInt GreatestCommonDivisor(APInt A, APInt B); +LLVM_SUPPORT_ABI APInt GreatestCommonDivisor(APInt A, APInt B); /// Converts the given APInt to a double value. /// @@ -2221,7 +2223,7 @@ /// Converts the given double value into a APInt. /// /// This function convert a double value to an APInt value. -APInt RoundDoubleToAPInt(double Double, unsigned width); +LLVM_SUPPORT_ABI APInt RoundDoubleToAPInt(double Double, unsigned width); /// Converts a float value into a APInt. /// @@ -2231,10 +2233,10 @@ } /// Return A unsign-divided by B, rounded by the given rounding mode. -APInt RoundingUDiv(const APInt &A, const APInt &B, APInt::Rounding RM); +LLVM_SUPPORT_ABI APInt RoundingUDiv(const APInt &A, const APInt &B, APInt::Rounding RM); /// Return A sign-divided by B, rounded by the given rounding mode. -APInt RoundingSDiv(const APInt &A, const APInt &B, APInt::Rounding RM); +LLVM_SUPPORT_ABI APInt RoundingSDiv(const APInt &A, const APInt &B, APInt::Rounding RM); /// Let q(n) = An^2 + Bn + C, and BW = bit width of the value range /// (e.g. 32 for i32). @@ -2269,30 +2271,30 @@ /// /// The returned value may have a different bit width from the input /// coefficients. -Optional SolveQuadraticEquationWrap(APInt A, APInt B, APInt C, +LLVM_SUPPORT_ABI Optional SolveQuadraticEquationWrap(APInt A, APInt B, APInt C, unsigned RangeWidth); /// Compare two values, and if they are different, return the position of the /// most significant bit that is different in the values. -Optional GetMostSignificantDifferentBit(const APInt &A, +LLVM_SUPPORT_ABI Optional GetMostSignificantDifferentBit(const APInt &A, const APInt &B); } // End of APIntOps namespace // See friend declaration above. This additional declaration is required in // order to compile LLVM with IBM xlC compiler. -hash_code hash_value(const APInt &Arg); +LLVM_SUPPORT_ABI hash_code hash_value(const APInt &Arg); /// StoreIntToMemory - Fills the StoreBytes bytes of memory starting from Dst /// with the integer held in IntVal. -void StoreIntToMemory(const APInt &IntVal, uint8_t *Dst, unsigned StoreBytes); +LLVM_SUPPORT_ABI void StoreIntToMemory(const APInt &IntVal, uint8_t *Dst, unsigned StoreBytes); /// LoadIntFromMemory - Loads the integer stored in the LoadBytes bytes starting /// from Src into IntVal, which is assumed to be wide enough and to hold zero. -void LoadIntFromMemory(APInt &IntVal, const uint8_t *Src, unsigned LoadBytes); +LLVM_SUPPORT_ABI void LoadIntFromMemory(APInt &IntVal, const uint8_t *Src, unsigned LoadBytes); /// Provide DenseMapInfo for APInt. -template <> struct DenseMapInfo { +template <> struct LLVM_SUPPORT_ABI DenseMapInfo { static inline APInt getEmptyKey() { APInt V(nullptr, 0); V.U.VAL = 0; diff --git a/llvm/include/llvm/ADT/APSInt.h b/llvm/include/llvm/ADT/APSInt.h --- a/llvm/include/llvm/ADT/APSInt.h +++ b/llvm/include/llvm/ADT/APSInt.h @@ -15,11 +15,12 @@ #define LLVM_ADT_APSINT_H #include "llvm/ADT/APInt.h" +#include "llvm/Support/LLVMSupportExports.h" namespace llvm { /// An arbitrary precision integer that knows its signedness. -class LLVM_NODISCARD APSInt : public APInt { +class LLVM_NODISCARD LLVM_SUPPORT_ABI APSInt : public APInt { bool IsUnsigned; public: diff --git a/llvm/include/llvm/ADT/DAGDeltaAlgorithm.h b/llvm/include/llvm/ADT/DAGDeltaAlgorithm.h --- a/llvm/include/llvm/ADT/DAGDeltaAlgorithm.h +++ b/llvm/include/llvm/ADT/DAGDeltaAlgorithm.h @@ -8,6 +8,8 @@ #ifndef LLVM_ADT_DAGDELTAALGORITHM_H #define LLVM_ADT_DAGDELTAALGORITHM_H +#include "llvm/Support/LLVMSupportExports.h" + #include #include #include @@ -35,7 +37,7 @@ /// substantially fewer tests with appropriate dependencies. \see DeltaAlgorithm /// for more information on the properties which the predicate function itself /// should satisfy. -class DAGDeltaAlgorithm { +class LLVM_SUPPORT_ABI DAGDeltaAlgorithm { virtual void anchor(); public: diff --git a/llvm/include/llvm/ADT/DeltaAlgorithm.h b/llvm/include/llvm/ADT/DeltaAlgorithm.h --- a/llvm/include/llvm/ADT/DeltaAlgorithm.h +++ b/llvm/include/llvm/ADT/DeltaAlgorithm.h @@ -8,6 +8,8 @@ #ifndef LLVM_ADT_DELTAALGORITHM_H #define LLVM_ADT_DELTAALGORITHM_H +#include "llvm/Support/LLVMSupportExports.h" + #include #include @@ -32,7 +34,7 @@ /// requirements, and the algorithm will generally produce reasonable /// results. However, it may run substantially more tests than with a good /// predicate. -class DeltaAlgorithm { +class LLVM_SUPPORT_ABI DeltaAlgorithm { public: using change_ty = unsigned; // FIXME: Use a decent data structure. diff --git a/llvm/include/llvm/ADT/EpochTracker.h b/llvm/include/llvm/ADT/EpochTracker.h --- a/llvm/include/llvm/ADT/EpochTracker.h +++ b/llvm/include/llvm/ADT/EpochTracker.h @@ -16,6 +16,7 @@ #define LLVM_ADT_EPOCHTRACKER_H #include "llvm/Config/abi-breaking.h" +#include "llvm/Support/LLVMSupportExports.h" #include @@ -32,7 +33,7 @@ /// isHandleInSync at appropriate points to assert that the handle they're using /// is still valid. /// -class DebugEpochBase { +class LLVM_SUPPORT_ABI DebugEpochBase { uint64_t Epoch; public: @@ -78,7 +79,7 @@ #else -class DebugEpochBase { +class LLVM_SUPPORT_ABI DebugEpochBase { public: void incrementEpoch() {} diff --git a/llvm/include/llvm/ADT/FoldingSet.h b/llvm/include/llvm/ADT/FoldingSet.h --- a/llvm/include/llvm/ADT/FoldingSet.h +++ b/llvm/include/llvm/ADT/FoldingSet.h @@ -18,6 +18,8 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/iterator.h" #include "llvm/Support/Allocator.h" +#include "llvm/Support/LLVMSupportExports.h" + #include #include #include @@ -109,7 +111,7 @@ /// in the bucket via a singly linked list. The last node in the list points /// back to the bucket to facilitate node removal. /// -class FoldingSetBase { +class LLVM_SUPPORT_ABI FoldingSetBase { protected: /// Buckets - Array of bucket chains. void **Buckets; @@ -282,7 +284,7 @@ /// than using plain FoldingSetNodeIDs, since the 32-element SmallVector /// is often much larger than necessary, and the possibility of heap /// allocation means it requires a non-trivial destructor call. -class FoldingSetNodeIDRef { +class LLVM_SUPPORT_ABI FoldingSetNodeIDRef { const unsigned *Data = nullptr; size_t Size = 0; @@ -310,7 +312,7 @@ /// FoldingSetNodeID - This class is used to gather all the unique data bits of /// a node. When all the bits are gathered this class is used to produce a /// hash value for the node. -class FoldingSetNodeID { +class LLVM_SUPPORT_ABI FoldingSetNodeID { /// Bits - Vector of all the data bits that make the node unique. /// Use a SmallVector to avoid a heap allocation in the common case. SmallVector Bits; @@ -662,7 +664,7 @@ //===----------------------------------------------------------------------===// /// FoldingSetIteratorImpl - This is the common iterator support shared by all /// folding sets, which knows how to walk the folding set hash table. -class FoldingSetIteratorImpl { +class LLVM_SUPPORT_ABI FoldingSetIteratorImpl { protected: FoldingSetNode *NodePtr; diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h --- a/llvm/include/llvm/ADT/Hashing.h +++ b/llvm/include/llvm/ADT/Hashing.h @@ -319,7 +319,7 @@ /// This variable can be set using the \see llvm::set_fixed_execution_seed /// function. See that function for details. Do not, under any circumstances, /// set or read this variable. -extern uint64_t fixed_seed_override; +extern LLVM_SUPPORT_ABI uint64_t fixed_seed_override; inline uint64_t get_execution_seed() { // FIXME: This needs to be a per-execution seed. This is just a placeholder diff --git a/llvm/include/llvm/ADT/IntEqClasses.h b/llvm/include/llvm/ADT/IntEqClasses.h --- a/llvm/include/llvm/ADT/IntEqClasses.h +++ b/llvm/include/llvm/ADT/IntEqClasses.h @@ -21,10 +21,11 @@ #define LLVM_ADT_INTEQCLASSES_H #include "llvm/ADT/SmallVector.h" +#include "llvm/Support/LLVMSupportExports.h" namespace llvm { -class IntEqClasses { +class LLVM_SUPPORT_ABI IntEqClasses { /// EC - When uncompressed, map each integer to a smaller member of its /// equivalence class. The class leader is the smallest member and maps to /// itself. diff --git a/llvm/include/llvm/ADT/IntervalMap.h b/llvm/include/llvm/ADT/IntervalMap.h --- a/llvm/include/llvm/ADT/IntervalMap.h +++ b/llvm/include/llvm/ADT/IntervalMap.h @@ -108,7 +108,9 @@ #include "llvm/ADT/bit.h" #include "llvm/Support/AlignOf.h" #include "llvm/Support/Allocator.h" +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/RecyclingAllocator.h" + #include #include #include @@ -413,6 +415,7 @@ /// @param Position Insert position. /// @param Grow Reserve space for a new element at Position. /// @return (node, offset) for Position. +LLVM_SUPPORT_ABI IdxPair distribute(unsigned Nodes, unsigned Elements, unsigned Capacity, const unsigned *CurSize, unsigned NewSize[], unsigned Position, bool Grow); @@ -492,7 +495,7 @@ // //===----------------------------------------------------------------------===// -class NodeRef { +class LLVM_SUPPORT_ABI NodeRef { struct CacheAlignedPointerTraits { static inline void *getAsVoidPointer(void *P) { return P; } static inline void *getFromVoidPointer(void *P) { return P; } @@ -772,7 +775,7 @@ // //===----------------------------------------------------------------------===// -class Path { +class LLVM_SUPPORT_ABI Path { /// Entry - Each step in the path is a node pointer and an offset into that /// node. struct Entry { diff --git a/llvm/include/llvm/ADT/Optional.h b/llvm/include/llvm/ADT/Optional.h --- a/llvm/include/llvm/ADT/Optional.h +++ b/llvm/include/llvm/ADT/Optional.h @@ -19,7 +19,9 @@ #include "llvm/ADT/None.h" #include "llvm/ADT/STLForwardCompat.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/type_traits.h" + #include #include #include @@ -479,7 +481,7 @@ return !(X < Y); } -raw_ostream &operator<<(raw_ostream &OS, NoneType); +LLVM_SUPPORT_ABI raw_ostream &operator<<(raw_ostream &OS, NoneType); template () << std::declval())> diff --git a/llvm/include/llvm/ADT/SmallPtrSet.h b/llvm/include/llvm/ADT/SmallPtrSet.h --- a/llvm/include/llvm/ADT/SmallPtrSet.h +++ b/llvm/include/llvm/ADT/SmallPtrSet.h @@ -16,8 +16,10 @@ #include "llvm/ADT/EpochTracker.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/ReverseIteration.h" #include "llvm/Support/type_traits.h" + #include #include #include @@ -46,7 +48,7 @@ /// (-2), to allow deletion. The hash table is resized when the table is 3/4 or /// more. When this happens, the table is doubled in size. /// -class SmallPtrSetImplBase : public DebugEpochBase { +class LLVM_SUPPORT_ABI SmallPtrSetImplBase : public DebugEpochBase { friend class SmallPtrSetIteratorImpl; protected: diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -16,8 +16,10 @@ #include "llvm/ADT/iterator_range.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/MemAlloc.h" #include "llvm/Support/type_traits.h" + #include #include #include @@ -59,12 +61,12 @@ /// This is a helper for \a grow() that's out of line to reduce code /// duplication. This function will report a fatal error if it can't grow at /// least to \p MinSize. - void *mallocForGrow(size_t MinSize, size_t TSize, size_t &NewCapacity); + LLVM_SUPPORT_ABI void *mallocForGrow(size_t MinSize, size_t TSize, size_t &NewCapacity); /// This is an implementation of the grow() method which only works /// on POD-like data types and is out of line to reduce code duplication. /// This function will report a fatal error if it cannot increase capacity. - void grow_pod(void *FirstEl, size_t MinSize, size_t TSize); + LLVM_SUPPORT_ABI void grow_pod(void *FirstEl, size_t MinSize, size_t TSize); public: size_t size() const { return Size; } @@ -87,6 +89,11 @@ } }; +extern template LLVM_SUPPORT_ABI SmallVectorBase; +#if SIZE_MAX > UINT32_MAX +extern template LLVM_SUPPORT_ABI SmallVectorBase; +#endif + template using SmallVectorSizeType = typename std::conditional= 8, uint64_t, diff --git a/llvm/include/llvm/ADT/Statistic.h b/llvm/include/llvm/ADT/Statistic.h --- a/llvm/include/llvm/ADT/Statistic.h +++ b/llvm/include/llvm/ADT/Statistic.h @@ -27,6 +27,8 @@ #include "llvm/Config/llvm-config.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/LLVMSupportExports.h" + #include #include #include @@ -46,7 +48,7 @@ class raw_fd_ostream; class StringRef; -class TrackingStatistic { +class LLVM_SUPPORT_ABI TrackingStatistic { public: const char *const DebugType; const char *const Name; @@ -172,25 +174,25 @@ static llvm::TrackingStatistic VARNAME = {DEBUG_TYPE, #VARNAME, DESC} /// Enable the collection and printing of statistics. -void EnableStatistics(bool DoPrintOnExit = true); +LLVM_SUPPORT_ABI void EnableStatistics(bool DoPrintOnExit = true); /// Check if statistics are enabled. -bool AreStatisticsEnabled(); +LLVM_SUPPORT_ABI bool AreStatisticsEnabled(); /// Return a file stream to print our output on. -std::unique_ptr CreateInfoOutputFile(); +LLVM_SUPPORT_ABI std::unique_ptr CreateInfoOutputFile(); /// Print statistics to the file returned by CreateInfoOutputFile(). -void PrintStatistics(); +LLVM_SUPPORT_ABI void PrintStatistics(); /// Print statistics to the given output stream. -void PrintStatistics(raw_ostream &OS); +LLVM_SUPPORT_ABI void PrintStatistics(raw_ostream &OS); /// Print statistics in JSON format. This does include all global timers (\see /// Timer, TimerGroup). Note that the timers are cleared after printing and will /// not be printed in human readable form or in a second call of /// PrintStatisticsJSON(). -void PrintStatisticsJSON(raw_ostream &OS); +LLVM_SUPPORT_ABI void PrintStatisticsJSON(raw_ostream &OS); /// Get the statistics. This can be used to look up the value of /// statistics without needing to parse JSON. @@ -199,7 +201,7 @@ /// during it's execution. It will return the value at the point that it is /// read. However, it will prevent new statistics from registering until it /// completes. -const std::vector> GetStatistics(); +LLVM_SUPPORT_ABI const std::vector> GetStatistics(); /// Reset the statistics. This can be used to zero and de-register the /// statistics in order to measure a compilation. @@ -214,7 +216,7 @@ /// compilation should ensure that no compilations are in progress at the point /// this function is called and that only one compilation executes until calling /// GetStatistics(). -void ResetStatistics(); +LLVM_SUPPORT_ABI void ResetStatistics(); } // end namespace llvm diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h --- a/llvm/include/llvm/ADT/StringExtras.h +++ b/llvm/include/llvm/ADT/StringExtras.h @@ -18,6 +18,8 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" +#include "llvm/Support/LLVMSupportExports.h" + #include #include #include @@ -311,7 +313,7 @@ /// StrInStrNoCase - Portable version of strcasestr. Locates the first /// occurrence of string 's1' in string 's2', ignoring case. Returns /// the offset of s2 in s1 or npos if s2 cannot be found. -StringRef::size_type StrInStrNoCase(StringRef s1, StringRef s2); +LLVM_SUPPORT_ABI StringRef::size_type StrInStrNoCase(StringRef s1, StringRef s2); /// getToken - This function extracts one token from source, ignoring any /// leading characters that appear in the Delimiters string, and ending the @@ -319,11 +321,13 @@ /// there are no tokens in the source string, an empty string is returned. /// The function returns a pair containing the extracted token and the /// remaining tail string. +LLVM_SUPPORT_ABI std::pair getToken(StringRef Source, StringRef Delimiters = " \t\n\v\f\r"); /// SplitString - Split up the specified string according to the specified /// delimiters, appending the result fragments to the output list. +LLVM_SUPPORT_ABI void SplitString(StringRef Source, SmallVectorImpl &OutFragments, StringRef Delimiters = " \t\n\v\f\r"); @@ -349,25 +353,25 @@ /// Print each character of the specified string, escaping it if it is not /// printable or if it is an escape char. -void printEscapedString(StringRef Name, raw_ostream &Out); +LLVM_SUPPORT_ABI void printEscapedString(StringRef Name, raw_ostream &Out); /// Print each character of the specified string, escaping HTML special /// characters. -void printHTMLEscaped(StringRef String, raw_ostream &Out); +LLVM_SUPPORT_ABI void printHTMLEscaped(StringRef String, raw_ostream &Out); /// printLowerCase - Print each character as lowercase if it is uppercase. -void printLowerCase(StringRef String, raw_ostream &Out); +LLVM_SUPPORT_ABI void printLowerCase(StringRef String, raw_ostream &Out); /// Converts a string from camel-case to snake-case by replacing all uppercase /// letters with '_' followed by the letter in lowercase, except if the /// uppercase letter is the first character of the string. -std::string convertToSnakeFromCamelCase(StringRef input); +LLVM_SUPPORT_ABI std::string convertToSnakeFromCamelCase(StringRef input); /// Converts a string from snake-case to camel-case by replacing all occurrences /// of '_' followed by a lowercase letter with the letter in uppercase. /// Optionally allow capitalization of the first letter (if it is a lowercase /// letter) -std::string convertToCamelFromSnakeCase(StringRef input, +LLVM_SUPPORT_ABI std::string convertToCamelFromSnakeCase(StringRef input, bool capitalizeFirst = false); namespace detail { diff --git a/llvm/include/llvm/ADT/StringMap.h b/llvm/include/llvm/ADT/StringMap.h --- a/llvm/include/llvm/ADT/StringMap.h +++ b/llvm/include/llvm/ADT/StringMap.h @@ -15,6 +15,7 @@ #include "llvm/ADT/StringMapEntry.h" #include "llvm/Support/AllocatorBase.h" +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/PointerLikeTypeTraits.h" #include #include @@ -27,7 +28,7 @@ /// StringMapImpl - This is the base class of StringMap that is shared among /// all of its instantiations. -class StringMapImpl { +class LLVM_SUPPORT_ABI StringMapImpl { protected: // Array of NumBuckets pointers to entries, null pointers are holes. // TheTable[NumBuckets] contains a sentinel value for easy iteration. Followed diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/include/llvm/ADT/StringRef.h @@ -12,6 +12,8 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/LLVMSupportExports.h" + #include #include #include @@ -39,13 +41,18 @@ class StringRef; /// Helper functions for StringRef::getAsInteger. + LLVM_SUPPORT_ABI bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result); + LLVM_SUPPORT_ABI bool getAsSignedInteger(StringRef Str, unsigned Radix, long long &Result); + LLVM_SUPPORT_ABI bool consumeUnsignedInteger(StringRef &Str, unsigned Radix, unsigned long long &Result); + + LLVM_SUPPORT_ABI bool consumeSignedInteger(StringRef &Str, unsigned Radix, long long &Result); /// StringRef - Represent a constant reference to a string, i.e. a character @@ -55,7 +62,7 @@ /// situations where the character data resides in some other buffer, whose /// lifetime extends past that of the StringRef. For this reason, it is not in /// general safe to store a StringRef. - class LLVM_GSL_POINTER StringRef { + class LLVM_SUPPORT_ABI LLVM_GSL_POINTER StringRef { public: static constexpr size_t npos = ~size_t(0); @@ -945,7 +952,7 @@ /// @} /// Compute a hash_code for a StringRef. - LLVM_NODISCARD + LLVM_NODISCARD LLVM_SUPPORT_ABI hash_code hash_value(StringRef S); // Provide DenseMapInfo for StringRefs. diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h --- a/llvm/include/llvm/ADT/Triple.h +++ b/llvm/include/llvm/ADT/Triple.h @@ -10,6 +10,7 @@ #define LLVM_ADT_TRIPLE_H #include "llvm/ADT/Twine.h" +#include "llvm/Support/LLVMSupportExports.h" // Some system headers or GCC predefined macros conflict with identifiers in // this file. Undefine them here. @@ -42,7 +43,7 @@ /// /// See autoconf/config.guess for a glimpse into what configuration names /// look like in practice. -class Triple { +class LLVM_SUPPORT_ABI Triple { public: enum ArchType { UnknownArch, diff --git a/llvm/include/llvm/ADT/Twine.h b/llvm/include/llvm/ADT/Twine.h --- a/llvm/include/llvm/ADT/Twine.h +++ b/llvm/include/llvm/ADT/Twine.h @@ -12,6 +12,8 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/LLVMSupportExports.h" + #include #include #include @@ -80,7 +82,7 @@ /// so we provide two additional methods (and accompanying operator+ /// overloads) to guarantee that particularly important cases (cstring plus /// StringRef) codegen as desired. - class Twine { + class LLVM_SUPPORT_ABI Twine { /// NodeKind - Represent the type of an argument. enum NodeKind : unsigned char { /// An empty string; the result of concatenating anything with it is also diff --git a/llvm/include/llvm/Support/AArch64TargetParser.h b/llvm/include/llvm/Support/AArch64TargetParser.h --- a/llvm/include/llvm/Support/AArch64TargetParser.h +++ b/llvm/include/llvm/Support/AArch64TargetParser.h @@ -17,6 +17,8 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ARMTargetParser.h" +#include "llvm/Support/LLVMSupportExports.h" + #include // FIXME:This should be made into class design,to avoid dupplication. @@ -111,31 +113,31 @@ }; // FIXME: These should be moved to TargetTuple once it exists -bool getExtensionFeatures(uint64_t Extensions, +LLVM_SUPPORT_ABI bool getExtensionFeatures(uint64_t Extensions, std::vector &Features); -bool getArchFeatures(ArchKind AK, std::vector &Features); +LLVM_SUPPORT_ABI bool getArchFeatures(ArchKind AK, std::vector &Features); StringRef getArchName(ArchKind AK); unsigned getArchAttr(ArchKind AK); -StringRef getCPUAttr(ArchKind AK); -StringRef getSubArch(ArchKind AK); +LLVM_SUPPORT_ABI StringRef getCPUAttr(ArchKind AK); +LLVM_SUPPORT_ABI StringRef getSubArch(ArchKind AK); StringRef getArchExtName(unsigned ArchExtKind); -StringRef getArchExtFeature(StringRef ArchExt); +LLVM_SUPPORT_ABI StringRef getArchExtFeature(StringRef ArchExt); // Information by Name -unsigned getDefaultFPU(StringRef CPU, ArchKind AK); -uint64_t getDefaultExtensions(StringRef CPU, ArchKind AK); -StringRef getDefaultCPU(StringRef Arch); -ArchKind getCPUArchKind(StringRef CPU); +LLVM_SUPPORT_ABI unsigned getDefaultFPU(StringRef CPU, ArchKind AK); +LLVM_SUPPORT_ABI uint64_t getDefaultExtensions(StringRef CPU, ArchKind AK); +LLVM_SUPPORT_ABI StringRef getDefaultCPU(StringRef Arch); +LLVM_SUPPORT_ABI ArchKind getCPUArchKind(StringRef CPU); // Parser -ArchKind parseArch(StringRef Arch); -ArchExtKind parseArchExt(StringRef ArchExt); -ArchKind parseCPUArch(StringRef CPU); +LLVM_SUPPORT_ABI ArchKind parseArch(StringRef Arch); +LLVM_SUPPORT_ABI ArchExtKind parseArchExt(StringRef ArchExt); +LLVM_SUPPORT_ABI ArchKind parseCPUArch(StringRef CPU); // Used by target parser tests -void fillValidCPUArchList(SmallVectorImpl &Values); +LLVM_SUPPORT_ABI void fillValidCPUArchList(SmallVectorImpl &Values); -bool isX18ReservedByDefault(const Triple &TT); +LLVM_SUPPORT_ABI bool isX18ReservedByDefault(const Triple &TT); struct ParsedBranchProtection { StringRef Scope; @@ -143,7 +145,7 @@ bool BranchTargetEnforcement; }; -bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP, +LLVM_SUPPORT_ABI bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP, StringRef &Err); } // namespace AArch64 diff --git a/llvm/include/llvm/Support/AMDGPUMetadata.h b/llvm/include/llvm/Support/AMDGPUMetadata.h --- a/llvm/include/llvm/Support/AMDGPUMetadata.h +++ b/llvm/include/llvm/Support/AMDGPUMetadata.h @@ -16,6 +16,8 @@ #define LLVM_SUPPORT_AMDGPUMETADATA_H #include "llvm/ADT/StringRef.h" +#include "llvm/Support/LLVMSupportExports.h" + #include #include #include @@ -441,10 +443,10 @@ }; /// Converts \p String to \p HSAMetadata. -std::error_code fromString(StringRef String, Metadata &HSAMetadata); +LLVM_SUPPORT_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_SUPPORT_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 --- a/llvm/include/llvm/Support/ARMAttributeParser.h +++ b/llvm/include/llvm/Support/ARMAttributeParser.h @@ -16,11 +16,12 @@ #include "llvm/Support/DataExtractor.h" #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" +#include "llvm/Support/LLVMSupportExports.h" namespace llvm { class StringRef; -class ARMAttributeParser : public ELFAttributeParser { +class LLVM_SUPPORT_ABI ARMAttributeParser : public ELFAttributeParser { 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 --- a/llvm/include/llvm/Support/ARMBuildAttributes.h +++ b/llvm/include/llvm/Support/ARMBuildAttributes.h @@ -19,11 +19,12 @@ #define LLVM_SUPPORT_ARMBUILDATTRIBUTES_H #include "llvm/Support/ELFAttributes.h" +#include "llvm/Support/LLVMSupportExports.h" namespace llvm { namespace ARMBuildAttrs { -const TagNameMap &getARMAttributeTags(); +LLVM_SUPPORT_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/ARMTargetParser.h b/llvm/include/llvm/Support/ARMTargetParser.h --- a/llvm/include/llvm/Support/ARMTargetParser.h +++ b/llvm/include/llvm/Support/ARMTargetParser.h @@ -17,6 +17,8 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ARMBuildAttributes.h" +#include "llvm/Support/LLVMSupportExports.h" + #include namespace llvm { @@ -232,48 +234,48 @@ }; // Information by ID -StringRef getFPUName(unsigned FPUKind); -FPUVersion getFPUVersion(unsigned FPUKind); -NeonSupportLevel getFPUNeonSupportLevel(unsigned FPUKind); -FPURestriction getFPURestriction(unsigned FPUKind); +LLVM_SUPPORT_ABI StringRef getFPUName(unsigned FPUKind); +LLVM_SUPPORT_ABI FPUVersion getFPUVersion(unsigned FPUKind); +LLVM_SUPPORT_ABI NeonSupportLevel getFPUNeonSupportLevel(unsigned FPUKind); +LLVM_SUPPORT_ABI FPURestriction getFPURestriction(unsigned FPUKind); // FIXME: These should be moved to TargetTuple once it exists -bool getFPUFeatures(unsigned FPUKind, std::vector &Features); -bool getHWDivFeatures(uint64_t HWDivKind, std::vector &Features); -bool getExtensionFeatures(uint64_t Extensions, +LLVM_SUPPORT_ABI bool getFPUFeatures(unsigned FPUKind, std::vector &Features); +LLVM_SUPPORT_ABI bool getHWDivFeatures(uint64_t HWDivKind, std::vector &Features); +LLVM_SUPPORT_ABI bool getExtensionFeatures(uint64_t Extensions, std::vector &Features); -StringRef getArchName(ArchKind AK); -unsigned getArchAttr(ArchKind AK); -StringRef getCPUAttr(ArchKind AK); -StringRef getSubArch(ArchKind AK); -StringRef getArchExtName(uint64_t ArchExtKind); -StringRef getArchExtFeature(StringRef ArchExt); -bool appendArchExtFeatures(StringRef CPU, ARM::ArchKind AK, StringRef ArchExt, +LLVM_SUPPORT_ABI StringRef getArchName(ArchKind AK); +LLVM_SUPPORT_ABI unsigned getArchAttr(ArchKind AK); +LLVM_SUPPORT_ABI StringRef getCPUAttr(ArchKind AK); +LLVM_SUPPORT_ABI StringRef getSubArch(ArchKind AK); +LLVM_SUPPORT_ABI StringRef getArchExtName(uint64_t ArchExtKind); +LLVM_SUPPORT_ABI StringRef getArchExtFeature(StringRef ArchExt); +LLVM_SUPPORT_ABI bool appendArchExtFeatures(StringRef CPU, ARM::ArchKind AK, StringRef ArchExt, std::vector &Features, unsigned &ArgFPUKind); // Information by Name -unsigned getDefaultFPU(StringRef CPU, ArchKind AK); -uint64_t getDefaultExtensions(StringRef CPU, ArchKind AK); -StringRef getDefaultCPU(StringRef Arch); +LLVM_SUPPORT_ABI unsigned getDefaultFPU(StringRef CPU, ArchKind AK); +LLVM_SUPPORT_ABI uint64_t getDefaultExtensions(StringRef CPU, ArchKind AK); +LLVM_SUPPORT_ABI StringRef getDefaultCPU(StringRef Arch); StringRef getCanonicalArchName(StringRef Arch); StringRef getFPUSynonym(StringRef FPU); StringRef getArchSynonym(StringRef Arch); // Parser -uint64_t parseHWDiv(StringRef HWDiv); -unsigned parseFPU(StringRef FPU); -ArchKind parseArch(StringRef Arch); -uint64_t parseArchExt(StringRef ArchExt); -ArchKind parseCPUArch(StringRef CPU); -ISAKind parseArchISA(StringRef Arch); -EndianKind parseArchEndian(StringRef Arch); -ProfileKind parseArchProfile(StringRef Arch); -unsigned parseArchVersion(StringRef Arch); - -void fillValidCPUArchList(SmallVectorImpl &Values); -StringRef computeDefaultTargetABI(const Triple &TT, StringRef CPU); +LLVM_SUPPORT_ABI uint64_t parseHWDiv(StringRef HWDiv); +LLVM_SUPPORT_ABI unsigned parseFPU(StringRef FPU); +LLVM_SUPPORT_ABI ArchKind parseArch(StringRef Arch); +LLVM_SUPPORT_ABI uint64_t parseArchExt(StringRef ArchExt); +LLVM_SUPPORT_ABI ArchKind parseCPUArch(StringRef CPU); +LLVM_SUPPORT_ABI ISAKind parseArchISA(StringRef Arch); +LLVM_SUPPORT_ABI EndianKind parseArchEndian(StringRef Arch); +LLVM_SUPPORT_ABI ProfileKind parseArchProfile(StringRef Arch); +LLVM_SUPPORT_ABI unsigned parseArchVersion(StringRef Arch); + +LLVM_SUPPORT_ABI void fillValidCPUArchList(SmallVectorImpl &Values); +LLVM_SUPPORT_ABI StringRef computeDefaultTargetABI(const Triple &TT, StringRef CPU); } // namespace ARM } // namespace llvm diff --git a/llvm/include/llvm/Support/ARMWinEH.h b/llvm/include/llvm/Support/ARMWinEH.h --- a/llvm/include/llvm/Support/ARMWinEH.h +++ b/llvm/include/llvm/Support/ARMWinEH.h @@ -11,6 +11,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/Endian.h" +#include "llvm/Support/LLVMSupportExports.h" namespace llvm { namespace ARM { @@ -205,7 +206,8 @@ /// 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_SUPPORT_ABI std::pair +SavedRegisterMask(const RuntimeFunction &RF); /// 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 --- a/llvm/include/llvm/Support/Allocator.h +++ b/llvm/include/llvm/Support/Allocator.h @@ -23,8 +23,10 @@ #include "llvm/Support/AllocatorBase.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/MemAlloc.h" + #include #include #include @@ -40,7 +42,7 @@ // 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_SUPPORT_ABI void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated, size_t TotalMemory); } // end namespace detail diff --git a/llvm/include/llvm/Support/BinaryStreamError.h b/llvm/include/llvm/Support/BinaryStreamError.h --- a/llvm/include/llvm/Support/BinaryStreamError.h +++ b/llvm/include/llvm/Support/BinaryStreamError.h @@ -11,6 +11,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" +#include "llvm/Support/LLVMSupportExports.h" #include @@ -24,7 +25,7 @@ }; /// Base class for errors originating when parsing raw PDB files -class BinaryStreamError : public ErrorInfo { +class LLVM_SUPPORT_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 --- a/llvm/include/llvm/Support/BinaryStreamReader.h +++ b/llvm/include/llvm/Support/BinaryStreamReader.h @@ -18,7 +18,9 @@ #include "llvm/Support/ConvertUTF.h" #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/type_traits.h" + #include namespace llvm { @@ -28,7 +30,7 @@ /// null-terminated strings, integers in various flavors of endianness, etc. /// Can be subclassed to provide reading of custom datatypes, although no /// are overridable. -class BinaryStreamReader { +class LLVM_SUPPORT_ABI BinaryStreamReader { public: BinaryStreamReader() = default; explicit BinaryStreamReader(BinaryStreamRef Ref); diff --git a/llvm/include/llvm/Support/BinaryStreamRef.h b/llvm/include/llvm/Support/BinaryStreamRef.h --- a/llvm/include/llvm/Support/BinaryStreamRef.h +++ b/llvm/include/llvm/Support/BinaryStreamRef.h @@ -14,6 +14,8 @@ #include "llvm/Support/BinaryStream.h" #include "llvm/Support/BinaryStreamError.h" #include "llvm/Support/Error.h" +#include "llvm/Support/LLVMSupportExports.h" + #include #include #include @@ -153,7 +155,7 @@ /// general, you should not pass around pointers or references to BinaryStreams /// and use inheritance to achieve polymorphism. Instead, you should pass /// around BinaryStreamRefs by value and achieve polymorphism that way. -class BinaryStreamRef +class LLVM_SUPPORT_ABI BinaryStreamRef : public BinaryStreamRefBase { friend BinaryStreamRefBase; friend class WritableBinaryStreamRef; @@ -219,7 +221,7 @@ bool empty() const { return size() == 0; } }; -class WritableBinaryStreamRef +class LLVM_SUPPORT_ABI WritableBinaryStreamRef : public BinaryStreamRefBase { friend BinaryStreamRefBase; diff --git a/llvm/include/llvm/Support/BinaryStreamWriter.h b/llvm/include/llvm/Support/BinaryStreamWriter.h --- a/llvm/include/llvm/Support/BinaryStreamWriter.h +++ b/llvm/include/llvm/Support/BinaryStreamWriter.h @@ -17,6 +17,8 @@ #include "llvm/Support/BinaryStreamRef.h" #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" +#include "llvm/Support/LLVMSupportExports.h" + #include #include #include @@ -28,7 +30,7 @@ /// such as null-terminated strings, integers in various flavors of endianness, /// etc. Can be subclassed to provide reading and writing of custom datatypes, /// although no methods are overridable. -class BinaryStreamWriter { +class LLVM_SUPPORT_ABI BinaryStreamWriter { public: BinaryStreamWriter() = default; explicit BinaryStreamWriter(WritableBinaryStreamRef Ref); diff --git a/llvm/include/llvm/Support/BlockFrequency.h b/llvm/include/llvm/Support/BlockFrequency.h --- a/llvm/include/llvm/Support/BlockFrequency.h +++ b/llvm/include/llvm/Support/BlockFrequency.h @@ -15,13 +15,14 @@ #include "llvm/Support/BranchProbability.h" #include "llvm/Support/DataTypes.h" +#include "llvm/Support/LLVMSupportExports.h" namespace llvm { class raw_ostream; // This class represents Block Frequency as a 64-bit value. -class BlockFrequency { +class LLVM_SUPPORT_ABI BlockFrequency { uint64_t Frequency; public: diff --git a/llvm/include/llvm/Support/BranchProbability.h b/llvm/include/llvm/Support/BranchProbability.h --- a/llvm/include/llvm/Support/BranchProbability.h +++ b/llvm/include/llvm/Support/BranchProbability.h @@ -14,6 +14,8 @@ #define LLVM_SUPPORT_BRANCHPROBABILITY_H #include "llvm/Support/DataTypes.h" +#include "llvm/Support/LLVMSupportExports.h" + #include #include #include @@ -27,7 +29,7 @@ // no greater than 1. It uses a fixed-point-like implementation, in which the // denominator is always a constant value (here we use 1<<31 for maximum // precision). -class BranchProbability { +class LLVM_SUPPORT_ABI BranchProbability { // Numerator uint32_t N; diff --git a/llvm/include/llvm/Support/BuryPointer.h b/llvm/include/llvm/Support/BuryPointer.h --- a/llvm/include/llvm/Support/BuryPointer.h +++ b/llvm/include/llvm/Support/BuryPointer.h @@ -9,6 +9,8 @@ #ifndef LLVM_SUPPORT_BURYPOINTER_H #define LLVM_SUPPORT_BURYPOINTER_H +#include "llvm/Support/LLVMSupportExports.h" + #include namespace llvm { @@ -19,7 +21,8 @@ // 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_SUPPORT_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 --- a/llvm/include/llvm/Support/COM.h +++ b/llvm/include/llvm/Support/COM.h @@ -14,12 +14,14 @@ #ifndef LLVM_SUPPORT_COM_H #define LLVM_SUPPORT_COM_H +#include "llvm/Support/LLVMSupportExports.h" + namespace llvm { namespace sys { enum class COMThreadingMode { SingleThreaded, MultiThreaded }; -class InitializeCOMRAII { +class LLVM_SUPPORT_ABI InitializeCOMRAII { public: explicit InitializeCOMRAII(COMThreadingMode Threading, bool SpeedOverMemory = false); diff --git a/llvm/include/llvm/Support/CRC.h b/llvm/include/llvm/Support/CRC.h --- a/llvm/include/llvm/Support/CRC.h +++ b/llvm/include/llvm/Support/CRC.h @@ -14,16 +14,17 @@ #define LLVM_SUPPORT_CRC_H #include "llvm/Support/DataTypes.h" +#include "llvm/Support/LLVMSupportExports.h" namespace llvm { template class ArrayRef; // Compute the CRC-32 of Data. -uint32_t crc32(ArrayRef Data); +LLVM_SUPPORT_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_SUPPORT_ABI uint32_t crc32(uint32_t CRC, ArrayRef Data); // Class for computing the JamCRC. // @@ -42,7 +43,7 @@ // // N.B. We permit flexibility of the "Init" value. Some consumers of this need // it to be zero. -class JamCRC { +class LLVM_SUPPORT_ABI JamCRC { public: JamCRC(uint32_t Init = 0xFFFFFFFFU) : CRC(Init) {} diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h --- a/llvm/include/llvm/Support/CachePruning.h +++ b/llvm/include/llvm/Support/CachePruning.h @@ -15,6 +15,8 @@ #define LLVM_SUPPORT_CACHEPRUNING_H #include "llvm/ADT/Optional.h" +#include "llvm/Support/LLVMSupportExports.h" + #include namespace llvm { @@ -65,7 +67,7 @@ /// 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_SUPPORT_ABI Expected parseCachePruningPolicy(StringRef PolicyStr); /// Peform pruning using the supplied policy, returns true if pruning /// occurred, i.e. if Policy.Interval was expired. @@ -73,7 +75,7 @@ /// 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_SUPPORT_ABI bool pruneCache(StringRef Path, CachePruningPolicy Policy); } // namespace llvm diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h --- a/llvm/include/llvm/Support/Chrono.h +++ b/llvm/include/llvm/Support/Chrono.h @@ -11,6 +11,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/FormatProviders.h" +#include "llvm/Support/LLVMSupportExports.h" #include #include @@ -56,6 +57,7 @@ } // namespace sys +LLVM_SUPPORT_ABI raw_ostream &operator<<(raw_ostream &OS, sys::TimePoint<> TP); /// Format provider for TimePoint<> @@ -67,7 +69,7 @@ /// /// If no options are given, the default format is "%Y-%m-%d %H:%M:%S.%N". template <> -struct format_provider> { +struct LLVM_SUPPORT_ABI format_provider> { static void format(const sys::TimePoint<> &TP, llvm::raw_ostream &OS, StringRef Style); }; @@ -76,12 +78,12 @@ 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 LLVM_SUPPORT_ABI unit> { static const char value[]; }; +template <> struct LLVM_SUPPORT_ABI unit> { static const char value[]; }; +template <> struct LLVM_SUPPORT_ABI unit> { static const char value[]; }; +template <> struct LLVM_SUPPORT_ABI unit { static const char value[]; }; +template <> struct LLVM_SUPPORT_ABI unit { static const char value[]; }; +template <> struct LLVM_SUPPORT_ABI unit { static const char value[]; }; } // namespace detail /// Implementation of format_provider for duration types. diff --git a/llvm/include/llvm/Support/CodeGenCoverage.h b/llvm/include/llvm/Support/CodeGenCoverage.h --- a/llvm/include/llvm/Support/CodeGenCoverage.h +++ b/llvm/include/llvm/Support/CodeGenCoverage.h @@ -12,12 +12,13 @@ #define LLVM_SUPPORT_CODEGENCOVERAGE_H #include "llvm/ADT/BitVector.h" +#include "llvm/Support/LLVMSupportExports.h" namespace llvm { class LLVMContext; class MemoryBuffer; -class CodeGenCoverage { +class LLVM_SUPPORT_ABI CodeGenCoverage { protected: BitVector RuleCoverage; diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -30,8 +30,10 @@ #include "llvm/ADT/Twine.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/raw_ostream.h" + #include #include #include @@ -68,6 +70,7 @@ // 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. +LLVM_SUPPORT_ABI bool ParseCommandLineOptions(int argc, const char *const *argv, StringRef Overview = "", raw_ostream *Errs = nullptr, @@ -82,7 +85,7 @@ /// 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_SUPPORT_ABI void SetVersionPrinter(VersionPrinterTy func); ///===---------------------------------------------------------------------===// /// AddExtraVersionPrinter - Add an extra printer to use in addition to the @@ -91,13 +94,13 @@ /// 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_SUPPORT_ABI void AddExtraVersionPrinter(VersionPrinterTy func); // PrintOptionValues - 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_SUPPORT_ABI void PrintOptionValues(); // Forward declaration - AddLiteralOption needs to be up here to make gcc happy. class Option; @@ -109,6 +112,7 @@ /// /// Literal options are used by some parsers to register special option values. /// This is how the PassNameParser registers pass names for opt. +LLVM_SUPPORT_ABI void AddLiteralOption(Option &O, StringRef Name); //===----------------------------------------------------------------------===// @@ -183,7 +187,7 @@ //===----------------------------------------------------------------------===// // Option Category class // -class OptionCategory { +class LLVM_SUPPORT_ABI OptionCategory { private: StringRef const Name; StringRef const Description; @@ -202,12 +206,12 @@ }; // The general Option Category (used as default category). -OptionCategory &getGeneralCategory(); +LLVM_SUPPORT_ABI OptionCategory &getGeneralCategory(); //===----------------------------------------------------------------------===// // SubCommand class // -class SubCommand { +class LLVM_SUPPORT_ABI SubCommand { private: StringRef Name; StringRef Description; @@ -238,15 +242,15 @@ }; // A special subcommand representing no subcommand -extern ManagedStatic TopLevelSubCommand; +extern LLVM_SUPPORT_ABI ManagedStatic TopLevelSubCommand; // A special subcommand that can be used to put an option into all subcommands. -extern ManagedStatic AllSubCommands; +extern LLVM_SUPPORT_ABI ManagedStatic AllSubCommands; //===----------------------------------------------------------------------===// // Option Base class // -class Option { +class LLVM_SUPPORT_ABI Option { friend class alias; // handleOccurrences - Overriden by subclasses to handle the value passed into @@ -519,7 +523,7 @@ // OptionValue class // Support value comparison outside the template. -struct GenericOptionValue { +struct LLVM_SUPPORT_ABI GenericOptionValue { virtual bool compare(const GenericOptionValue &V) const = 0; protected: @@ -638,7 +642,7 @@ } private: - void anchor() override; + LLVM_SUPPORT_ABI void anchor() override; }; template <> @@ -655,7 +659,7 @@ } private: - void anchor() override; + LLVM_SUPPORT_ABI void anchor() override; }; //===----------------------------------------------------------------------===// @@ -712,7 +716,7 @@ // not need replicated for every instance of the generic parser. This also // allows us to put stuff into CommandLine.cpp // -class generic_parser_base { +class LLVM_SUPPORT_ABI generic_parser_base { protected: class GenericOptionInfo { public: @@ -875,7 +879,7 @@ //-------------------------------------------------- // basic_parser - Super class of parsers to provide boilerplate code // -class basic_parser_impl { // non-template implementation of basic_parser +class LLVM_SUPPORT_ABI basic_parser_impl { // non-template implementation of basic_parser public: basic_parser_impl(Option &) {} @@ -926,7 +930,7 @@ //-------------------------------------------------- // parser // -template <> class parser : public basic_parser { +template <> class LLVM_SUPPORT_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -953,7 +957,7 @@ //-------------------------------------------------- // parser -template <> class parser : public basic_parser { +template <> class LLVM_SUPPORT_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -979,7 +983,7 @@ //-------------------------------------------------- // parser // -template <> class parser : public basic_parser { +template <> class LLVM_SUPPORT_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1023,7 +1027,7 @@ //-------------------------------------------------- // parser // -template <> class parser : public basic_parser { +template <> class LLVM_SUPPORT_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1045,7 +1049,7 @@ //-------------------------------------------------- // parser // -template <> class parser : public basic_parser { +template <> class LLVM_SUPPORT_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1091,7 +1095,7 @@ // parser // template <> -class parser : public basic_parser { +class LLVM_SUPPORT_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1114,7 +1118,7 @@ //-------------------------------------------------- // parser // -template <> class parser : public basic_parser { +template <> class LLVM_SUPPORT_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1136,7 +1140,7 @@ //-------------------------------------------------- // parser // -template <> class parser : public basic_parser { +template <> class LLVM_SUPPORT_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1158,7 +1162,7 @@ //-------------------------------------------------- // parser // -template <> class parser : public basic_parser { +template <> class LLVM_SUPPORT_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1183,7 +1187,7 @@ //-------------------------------------------------- // parser // -template <> class parser : public basic_parser { +template <> class LLVM_SUPPORT_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1859,7 +1863,7 @@ // Aliased command line option (alias this name to a preexisting name) // -class alias : public Option { +class LLVM_SUPPORT_ABI alias : public Option { Option *AliasFor; bool handleOccurrence(unsigned pos, StringRef /*ArgName*/, @@ -1930,20 +1934,20 @@ // output. All occurrences of cl::extrahelp will be accumulated and // printed to stderr at the end of the regular help, just before // exit is called. -struct extrahelp { +struct LLVM_SUPPORT_ABI extrahelp { StringRef morehelp; explicit extrahelp(StringRef help); }; -void PrintVersionMessage(); +LLVM_SUPPORT_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_SUPPORT_ABI void PrintHelpMessage(bool Hidden = false, bool Categorized = false); //===----------------------------------------------------------------------===// // Public interface for accessing registered options. @@ -1976,7 +1980,7 @@ /// 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