Index: llvm/include/llvm/Support/AArch64TargetParser.h =================================================================== --- llvm/include/llvm/Support/AArch64TargetParser.h +++ llvm/include/llvm/Support/AArch64TargetParser.h @@ -17,6 +17,7 @@ #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 +112,33 @@ }; // FIXME: These should be moved to TargetTuple once it exists -bool getExtensionFeatures(uint64_t Extensions, - std::vector &Features); -bool getArchFeatures(ArchKind AK, std::vector &Features); - -StringRef getArchName(ArchKind AK); -unsigned getArchAttr(ArchKind AK); -StringRef getCPUAttr(ArchKind AK); -StringRef getSubArch(ArchKind AK); -StringRef getArchExtName(unsigned ArchExtKind); -StringRef getArchExtFeature(StringRef ArchExt); +bool LLVMSupport_API getExtensionFeatures(uint64_t Extensions, + std::vector &Features); +bool LLVMSupport_API getArchFeatures(ArchKind AK, + std::vector &Features); + +StringRef LLVMSupport_API getArchName(ArchKind AK); +unsigned LLVMSupport_API getArchAttr(ArchKind AK); +StringRef LLVMSupport_API getCPUAttr(ArchKind AK); +StringRef LLVMSupport_API getSubArch(ArchKind AK); +StringRef LLVMSupport_API getArchExtName(unsigned ArchExtKind); +StringRef LLVMSupport_API 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); +unsigned LLVMSupport_API getDefaultFPU(StringRef CPU, ArchKind AK); +uint64_t LLVMSupport_API getDefaultExtensions(StringRef CPU, ArchKind AK); +StringRef LLVMSupport_API getDefaultCPU(StringRef Arch); +ArchKind LLVMSupport_API getCPUArchKind(StringRef CPU); // Parser -ArchKind parseArch(StringRef Arch); -ArchExtKind parseArchExt(StringRef ArchExt); -ArchKind parseCPUArch(StringRef CPU); +ArchKind LLVMSupport_API parseArch(StringRef Arch); +ArchExtKind LLVMSupport_API parseArchExt(StringRef ArchExt); +ArchKind LLVMSupport_API parseCPUArch(StringRef CPU); + // Used by target parser tests -void fillValidCPUArchList(SmallVectorImpl &Values); +void LLVMSupport_API fillValidCPUArchList(SmallVectorImpl &Values); -bool isX18ReservedByDefault(const Triple &TT); +bool LLVMSupport_API isX18ReservedByDefault(const Triple &TT); struct ParsedBranchProtection { StringRef Scope; @@ -143,8 +146,9 @@ bool BranchTargetEnforcement; }; -bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP, - StringRef &Err); +bool LLVMSupport_API parseBranchProtection(StringRef Spec, + ParsedBranchProtection &PBP, + StringRef &Err); } // namespace AArch64 } // namespace llvm Index: llvm/include/llvm/Support/ARMTargetParser.h =================================================================== --- llvm/include/llvm/Support/ARMTargetParser.h +++ llvm/include/llvm/Support/ARMTargetParser.h @@ -17,6 +17,7 @@ #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 +233,52 @@ }; // Information by ID -StringRef getFPUName(unsigned FPUKind); -FPUVersion getFPUVersion(unsigned FPUKind); -NeonSupportLevel getFPUNeonSupportLevel(unsigned FPUKind); -FPURestriction getFPURestriction(unsigned FPUKind); +StringRef LLVMSupport_API getFPUName(unsigned FPUKind); +FPUVersion LLVMSupport_API getFPUVersion(unsigned FPUKind); +NeonSupportLevel LLVMSupport_API getFPUNeonSupportLevel(unsigned FPUKind); +FPURestriction LLVMSupport_API 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, - 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, - std::vector &Features, - unsigned &ArgFPUKind); +bool LLVMSupport_API getFPUFeatures(unsigned FPUKind, + std::vector &Features); +bool LLVMSupport_API getHWDivFeatures(uint64_t HWDivKind, + std::vector &Features); +bool LLVMSupport_API getExtensionFeatures(uint64_t Extensions, + std::vector &Features); + +StringRef LLVMSupport_API getArchName(ArchKind AK); +unsigned LLVMSupport_API getArchAttr(ArchKind AK); +StringRef LLVMSupport_API getCPUAttr(ArchKind AK); +StringRef LLVMSupport_API getSubArch(ArchKind AK); +StringRef LLVMSupport_API getArchExtName(uint64_t ArchExtKind); +StringRef LLVMSupport_API getArchExtFeature(StringRef ArchExt); +bool LLVMSupport_API 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); -StringRef getCanonicalArchName(StringRef Arch); -StringRef getFPUSynonym(StringRef FPU); -StringRef getArchSynonym(StringRef Arch); +unsigned LLVMSupport_API getDefaultFPU(StringRef CPU, ArchKind AK); +uint64_t LLVMSupport_API getDefaultExtensions(StringRef CPU, ArchKind AK); +StringRef LLVMSupport_API getDefaultCPU(StringRef Arch); +StringRef LLVMSupport_API getCanonicalArchName(StringRef Arch); +StringRef LLVMSupport_API getFPUSynonym(StringRef FPU); +StringRef LLVMSupport_API 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); +uint64_t LLVMSupport_API parseHWDiv(StringRef HWDiv); +unsigned LLVMSupport_API parseFPU(StringRef FPU); +ArchKind LLVMSupport_API parseArch(StringRef Arch); +uint64_t LLVMSupport_API parseArchExt(StringRef ArchExt); +ArchKind LLVMSupport_API parseCPUArch(StringRef CPU); +ISAKind LLVMSupport_API parseArchISA(StringRef Arch); +EndianKind LLVMSupport_API parseArchEndian(StringRef Arch); +ProfileKind LLVMSupport_API parseArchProfile(StringRef Arch); +unsigned LLVMSupport_API parseArchVersion(StringRef Arch); + +void LLVMSupport_API fillValidCPUArchList(SmallVectorImpl &Values); +StringRef LLVMSupport_API computeDefaultTargetABI(const Triple &TT, + StringRef CPU); } // namespace ARM } // namespace llvm Index: llvm/include/llvm/Support/Atomic.h =================================================================== --- llvm/include/llvm/Support/Atomic.h +++ llvm/include/llvm/Support/Atomic.h @@ -18,6 +18,7 @@ #define LLVM_SUPPORT_ATOMIC_H #include "llvm/Support/DataTypes.h" +#include "llvm/Support/LLVMSupportExports.h" // Windows will at times define MemoryFence. #ifdef MemoryFence @@ -25,18 +26,18 @@ #endif namespace llvm { - namespace sys { - void MemoryFence(); +namespace sys { +void LLVMSupport_API MemoryFence(); #ifdef _MSC_VER - typedef long cas_flag; +typedef long cas_flag; #else - typedef uint32_t cas_flag; +typedef uint32_t cas_flag; #endif - cas_flag CompareAndSwap(volatile cas_flag* ptr, - cas_flag new_value, - cas_flag old_value); - } -} + +cas_flag LLVMSupport_API CompareAndSwap(volatile cas_flag *ptr, + cas_flag new_value, cas_flag old_value); +} // namespace sys +} // namespace llvm #endif Index: llvm/include/llvm/Support/AutoConvert.h =================================================================== --- llvm/include/llvm/Support/AutoConvert.h +++ llvm/include/llvm/Support/AutoConvert.h @@ -14,6 +14,8 @@ #ifndef LLVM_SUPPORT_AUTOCONVERT_H #define LLVM_SUPPORT_AUTOCONVERT_H +#include "llvm/Support/LLVMSupportExports.h" + #ifdef __MVS__ #define CCSID_IBM_1047 1047 #define CCSID_UTF_8 1208 @@ -23,15 +25,15 @@ /// \brief Disable the z/OS enhanced ASCII auto-conversion for the file /// descriptor. -std::error_code disableAutoConversion(int FD); +std::error_code LLVMSupport_API disableAutoConversion(int FD); /// \brief Query the z/OS enhanced ASCII auto-conversion status of a file /// descriptor and force the conversion if the file is not tagged with a /// codepage. -std::error_code enableAutoConversion(int FD); +std::error_code LLVMSupport_API enableAutoConversion(int FD); /// \brief Set the tag information for a file descriptor. -std::error_code setFileTag(int FD, int CCSID, bool Text); +std::error_code LLVMSupport_API setFileTag(int FD, int CCSID, bool Text); } // namespace llvm Index: llvm/include/llvm/Support/BinaryStream.h =================================================================== --- llvm/include/llvm/Support/BinaryStream.h +++ llvm/include/llvm/Support/BinaryStream.h @@ -14,6 +14,7 @@ #include "llvm/Support/BinaryStreamError.h" #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" +#include "llvm/Support/LLVMSupportExports.h" #include namespace llvm { @@ -32,7 +33,7 @@ /// single contiguous buffer (or even in memory at all), in such cases a it may /// be necessary for an implementation to cache such a buffer so that it can /// return it. -class BinaryStream { +class LLVMSupport_API BinaryStream { public: virtual ~BinaryStream() = default; @@ -70,7 +71,7 @@ /// buffer to the stream's backing store. Streams are assumed to be buffered /// so that to be portable it is necessary to call commit() on the stream when /// all data has been written. -class WritableBinaryStream : public BinaryStream { +class LLVMSupport_API WritableBinaryStream : public BinaryStream { public: ~WritableBinaryStream() override = default; Index: llvm/include/llvm/Support/BinaryStreamError.h =================================================================== --- llvm/include/llvm/Support/BinaryStreamError.h +++ 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 LLVMSupport_API BinaryStreamError : public ErrorInfo { public: static char ID; explicit BinaryStreamError(stream_error_code C); Index: llvm/include/llvm/Support/BinaryStreamReader.h =================================================================== --- llvm/include/llvm/Support/BinaryStreamReader.h +++ llvm/include/llvm/Support/BinaryStreamReader.h @@ -18,6 +18,7 @@ #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 @@ -28,7 +29,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 LLVMSupport_API BinaryStreamReader { public: BinaryStreamReader() = default; explicit BinaryStreamReader(BinaryStreamRef Ref); Index: llvm/include/llvm/Support/BinaryStreamRef.h =================================================================== --- llvm/include/llvm/Support/BinaryStreamRef.h +++ llvm/include/llvm/Support/BinaryStreamRef.h @@ -14,6 +14,7 @@ #include "llvm/Support/BinaryStream.h" #include "llvm/Support/BinaryStreamError.h" #include "llvm/Support/Error.h" +#include "llvm/Support/LLVMSupportExports.h" #include #include #include @@ -21,7 +22,7 @@ namespace llvm { /// Common stuff for mutable and immutable StreamRefs. -template class BinaryStreamRefBase { +template class LLVMSupport_API BinaryStreamRefBase { protected: BinaryStreamRefBase() = default; explicit BinaryStreamRefBase(StreamType &BorrowedImpl) @@ -153,7 +154,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 LLVMSupport_API BinaryStreamRef : public BinaryStreamRefBase { friend BinaryStreamRefBase; friend class WritableBinaryStreamRef; @@ -219,7 +220,7 @@ bool empty() const { return size() == 0; } }; -class WritableBinaryStreamRef +class LLVMSupport_API WritableBinaryStreamRef : public BinaryStreamRefBase { friend BinaryStreamRefBase; Index: llvm/include/llvm/Support/BinaryStreamWriter.h =================================================================== --- llvm/include/llvm/Support/BinaryStreamWriter.h +++ llvm/include/llvm/Support/BinaryStreamWriter.h @@ -17,6 +17,7 @@ #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 +29,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 LLVMSupport_API BinaryStreamWriter { public: BinaryStreamWriter() = default; explicit BinaryStreamWriter(WritableBinaryStreamRef Ref); Index: llvm/include/llvm/Support/BlockFrequency.h =================================================================== --- llvm/include/llvm/Support/BlockFrequency.h +++ 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 LLVMSupport_API BlockFrequency { uint64_t Frequency; public: Index: llvm/include/llvm/Support/COM.h =================================================================== --- llvm/include/llvm/Support/COM.h +++ 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 LLVMSupport_API InitializeCOMRAII { public: explicit InitializeCOMRAII(COMThreadingMode Threading, bool SpeedOverMemory = false); Index: llvm/include/llvm/Support/CachePruning.h =================================================================== --- llvm/include/llvm/Support/CachePruning.h +++ llvm/include/llvm/Support/CachePruning.h @@ -15,6 +15,7 @@ #define LLVM_SUPPORT_CACHEPRUNING_H #include "llvm/ADT/Optional.h" +#include "llvm/Support/LLVMSupportExports.h" #include namespace llvm { @@ -65,7 +66,8 @@ /// 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); +Expected + LLVMSupport_API 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); +bool LLVMSupport_API pruneCache(StringRef Path, CachePruningPolicy Policy); } // namespace llvm Index: llvm/include/llvm/Support/Chrono.h =================================================================== --- llvm/include/llvm/Support/Chrono.h +++ 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 +LLVMSupport_API raw_ostream &operator<<(raw_ostream &OS, sys::TimePoint<> TP); /// Format provider for TimePoint<> Index: llvm/include/llvm/Support/CodeGenCoverage.h =================================================================== --- llvm/include/llvm/Support/CodeGenCoverage.h +++ 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 LLVMSupport_API CodeGenCoverage { protected: BitVector RuleCoverage; Index: llvm/include/llvm/Support/CommandLine.h =================================================================== --- llvm/include/llvm/Support/CommandLine.h +++ llvm/include/llvm/Support/CommandLine.h @@ -30,6 +30,7 @@ #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 @@ -68,11 +69,10 @@ // 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, - StringRef Overview = "", - raw_ostream *Errs = nullptr, - const char *EnvVar = nullptr, - bool LongOptionsUseDoubleDash = false); +bool LLVMSupport_API ParseCommandLineOptions( + int argc, const char *const *argv, StringRef Overview = "", + raw_ostream *Errs = nullptr, const char *EnvVar = nullptr, + bool LongOptionsUseDoubleDash = false); // Function pointer type for printing version information. using VersionPrinterTy = std::function; @@ -82,7 +82,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); +void LLVMSupport_API SetVersionPrinter(VersionPrinterTy func); ///===---------------------------------------------------------------------===// /// AddExtraVersionPrinter - Add an extra printer to use in addition to the @@ -91,13 +91,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); +void LLVMSupport_API 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(); +void LLVMSupport_API PrintOptionValues(); // Forward declaration - AddLiteralOption needs to be up here to make gcc happy. class Option; @@ -109,7 +109,7 @@ /// /// 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); +void LLVMSupport_API AddLiteralOption(Option &O, StringRef Name); //===----------------------------------------------------------------------===// // Flags permitted to be passed to command line arguments @@ -183,7 +183,7 @@ //===----------------------------------------------------------------------===// // Option Category class // -class OptionCategory { +class LLVMSupport_API OptionCategory { private: StringRef const Name; StringRef const Description; @@ -207,7 +207,7 @@ //===----------------------------------------------------------------------===// // SubCommand class // -class SubCommand { +class LLVMSupport_API SubCommand { private: StringRef Name; StringRef Description; @@ -238,15 +238,15 @@ }; // A special subcommand representing no subcommand -extern ManagedStatic TopLevelSubCommand; +extern ManagedStatic LLVMSupport_API TopLevelSubCommand; // A special subcommand that can be used to put an option into all subcommands. -extern ManagedStatic AllSubCommands; +extern ManagedStatic LLVMSupport_API AllSubCommands; //===----------------------------------------------------------------------===// // Option Base class // -class Option { +class LLVMSupport_API Option { friend class alias; // handleOccurrences - Overriden by subclasses to handle the value passed into Index: llvm/include/llvm/Support/Compression.h =================================================================== --- llvm/include/llvm/Support/Compression.h +++ llvm/include/llvm/Support/Compression.h @@ -14,6 +14,7 @@ #define LLVM_SUPPORT_COMPRESSION_H #include "llvm/Support/DataTypes.h" +#include "llvm/Support/LLVMSupportExports.h" namespace llvm { template class SmallVectorImpl; @@ -27,19 +28,21 @@ static constexpr int DefaultCompression = 6; static constexpr int BestSizeCompression = 9; -bool isAvailable(); +bool LLVMSupport_API isAvailable(); -Error compress(StringRef InputBuffer, SmallVectorImpl &CompressedBuffer, - int Level = DefaultCompression); +Error LLVMSupport_API compress(StringRef InputBuffer, + SmallVectorImpl &CompressedBuffer, + int Level = DefaultCompression); -Error uncompress(StringRef InputBuffer, char *UncompressedBuffer, - size_t &UncompressedSize); +Error LLVMSupport_API uncompress(StringRef InputBuffer, + char *UncompressedBuffer, + size_t &UncompressedSize); -Error uncompress(StringRef InputBuffer, - SmallVectorImpl &UncompressedBuffer, - size_t UncompressedSize); +Error LLVMSupport_API uncompress(StringRef InputBuffer, + SmallVectorImpl &UncompressedBuffer, + size_t UncompressedSize); -uint32_t crc32(StringRef Buffer); +uint32_t LLVMSupport_API crc32(StringRef Buffer); } // End of namespace zlib Index: llvm/include/llvm/Support/Error.h =================================================================== --- llvm/include/llvm/Support/Error.h +++ llvm/include/llvm/Support/Error.h @@ -25,6 +25,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/Format.h" +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/raw_ostream.h" #include #include @@ -45,7 +46,7 @@ /// Base class for error info classes. Do not extend this directly: Extend /// the ErrorInfo template subclass instead. -class ErrorInfoBase { +class LLVMSupport_API ErrorInfoBase { public: virtual ~ErrorInfoBase() = default; @@ -346,7 +347,7 @@ /// This class provides an implementation of the ErrorInfoBase::kind /// method, which is used by the Error RTTI system. template -class ErrorInfo : public ParentErrT { +class LLVMSupport_API ErrorInfo : public ParentErrT { public: using ParentErrT::ParentErrT; // inherit constructors Index: llvm/include/llvm/Support/LLVMSupportExports.h =================================================================== --- /dev/null +++ llvm/include/llvm/Support/LLVMSupportExports.h @@ -0,0 +1,40 @@ +//===--- SupportMacros.h - ABI Macro Definitions ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_LLVMSupport_EXPORTS_H +#define LLVM_SUPPORT_LLVMSupport_EXPORTS_H + +#if defined(__ELF__) +# if defined(LLVMSupport_STATIC) +# define LLVMSupport_API +# else +# if defined(LLVMSupport_EXPORTS) +# define LLVMSupport_API __attribute__((__visibility__("protected"))) +# else +# define LLVMSupport_API __attribute__((__visibility__("default"))) +# endif +# endif +#elif defined(__MACH__) || defined(__WASM__) +# if defined(LLVMSupport_STATIC) +# define LLVMSupport_API +# else +# define LLVMSupport_API __attribute__((__visibility__("default"))) +# endif +#else +# if defined(_DLL) +# if defined(LLVMSupport_EXPORTS) +# define LLVMSupport_API __declspec(dllexport) +# else +# define LLVMSupport_API __declspec(dllimport) +# endif +# else +# define LLVMSupport_API +# endif +#endif + +#endif Index: llvm/include/llvm/Support/circular_raw_ostream.h =================================================================== --- llvm/include/llvm/Support/circular_raw_ostream.h +++ llvm/include/llvm/Support/circular_raw_ostream.h @@ -14,6 +14,7 @@ #ifndef LLVM_SUPPORT_CIRCULAR_RAW_OSTREAM_H #define LLVM_SUPPORT_CIRCULAR_RAW_OSTREAM_H +#include "llvm/Support/LLVMSupportExports.h" #include "llvm/Support/raw_ostream.h" namespace llvm { @@ -21,7 +22,7 @@ /// to a circular buffer, or can pass it through directly to an /// underlying stream if specified with a buffer of zero. /// - class circular_raw_ostream : public raw_ostream { + class LLVMSupport_API circular_raw_ostream : public raw_ostream { public: /// TAKE_OWNERSHIP - Tell this stream that it owns the underlying /// stream and is responsible for cleanup, memory management Index: llvm/lib/Support/AArch64TargetParser.cpp =================================================================== --- llvm/lib/Support/AArch64TargetParser.cpp +++ llvm/lib/Support/AArch64TargetParser.cpp @@ -24,7 +24,8 @@ return 0; } -unsigned AArch64::getDefaultFPU(StringRef CPU, AArch64::ArchKind AK) { +unsigned LLVMSupport_API AArch64::getDefaultFPU(StringRef CPU, + AArch64::ArchKind AK) { if (CPU == "generic") return AArch64ARCHNames[static_cast(AK)].DefaultFPU; @@ -35,7 +36,8 @@ .Default(ARM::FK_INVALID); } -uint64_t AArch64::getDefaultExtensions(StringRef CPU, AArch64::ArchKind AK) { +uint64_t LLVMSupport_API AArch64::getDefaultExtensions(StringRef CPU, + AArch64::ArchKind AK) { if (CPU == "generic") return AArch64ARCHNames[static_cast(AK)].ArchBaseExtensions; @@ -48,7 +50,7 @@ .Default(AArch64::AEK_INVALID); } -AArch64::ArchKind AArch64::getCPUArchKind(StringRef CPU) { +AArch64::ArchKind LLVMSupport_API AArch64::getCPUArchKind(StringRef CPU) { if (CPU == "generic") return ArchKind::ARMV8A; @@ -59,8 +61,8 @@ .Default(ArchKind::INVALID); } -bool AArch64::getExtensionFeatures(uint64_t Extensions, - std::vector &Features) { +bool LLVMSupport_API AArch64::getExtensionFeatures( + uint64_t Extensions, std::vector &Features) { if (Extensions == AArch64::AEK_INVALID) return false; @@ -116,8 +118,8 @@ return true; } -bool AArch64::getArchFeatures(AArch64::ArchKind AK, - std::vector &Features) { +bool LLVMSupport_API AArch64::getArchFeatures( + AArch64::ArchKind AK, std::vector &Features) { if (AK == ArchKind::ARMV8_1A) Features.push_back("+v8.1a"); if (AK == ArchKind::ARMV8_2A) @@ -138,30 +140,30 @@ return AK != ArchKind::INVALID; } -StringRef AArch64::getArchName(AArch64::ArchKind AK) { +StringRef LLVMSupport_API AArch64::getArchName(AArch64::ArchKind AK) { return AArch64ARCHNames[static_cast(AK)].getName(); } -StringRef AArch64::getCPUAttr(AArch64::ArchKind AK) { +StringRef LLVMSupport_API AArch64::getCPUAttr(AArch64::ArchKind AK) { return AArch64ARCHNames[static_cast(AK)].getCPUAttr(); } -StringRef AArch64::getSubArch(AArch64::ArchKind AK) { +StringRef LLVMSupport_API AArch64::getSubArch(AArch64::ArchKind AK) { return AArch64ARCHNames[static_cast(AK)].getSubArch(); } -unsigned AArch64::getArchAttr(AArch64::ArchKind AK) { +unsigned LLVMSupport_API AArch64::getArchAttr(AArch64::ArchKind AK) { return AArch64ARCHNames[static_cast(AK)].ArchAttr; } -StringRef AArch64::getArchExtName(unsigned ArchExtKind) { +StringRef LLVMSupport_API AArch64::getArchExtName(unsigned ArchExtKind) { for (const auto &AE : AArch64ARCHExtNames) if (ArchExtKind == AE.ID) return AE.getName(); return StringRef(); } -StringRef AArch64::getArchExtFeature(StringRef ArchExt) { +StringRef LLVMSupport_API AArch64::getArchExtFeature(StringRef ArchExt) { if (ArchExt.startswith("no")) { StringRef ArchExtBase(ArchExt.substr(2)); for (const auto &AE : AArch64ARCHExtNames) { @@ -176,7 +178,7 @@ return StringRef(); } -StringRef AArch64::getDefaultCPU(StringRef Arch) { +StringRef LLVMSupport_API AArch64::getDefaultCPU(StringRef Arch) { ArchKind AK = parseArch(Arch); if (AK == ArchKind::INVALID) return StringRef(); @@ -190,20 +192,21 @@ return "generic"; } -void AArch64::fillValidCPUArchList(SmallVectorImpl &Values) { +void LLVMSupport_API +AArch64::fillValidCPUArchList(SmallVectorImpl &Values) { for (const auto &Arch : AArch64CPUNames) { if (Arch.ArchID != ArchKind::INVALID) Values.push_back(Arch.getName()); } } -bool AArch64::isX18ReservedByDefault(const Triple &TT) { +bool LLVMSupport_API AArch64::isX18ReservedByDefault(const Triple &TT) { return TT.isAndroid() || TT.isOSDarwin() || TT.isOSFuchsia() || TT.isOSWindows(); } // Allows partial match, ex. "v8a" matches "armv8a". -AArch64::ArchKind AArch64::parseArch(StringRef Arch) { +AArch64::ArchKind LLVMSupport_API AArch64::parseArch(StringRef Arch) { Arch = ARM::getCanonicalArchName(Arch); if (checkArchVersion(Arch) < 8) return ArchKind::INVALID; @@ -216,7 +219,7 @@ return ArchKind::INVALID; } -AArch64::ArchExtKind AArch64::parseArchExt(StringRef ArchExt) { +AArch64::ArchExtKind LLVMSupport_API AArch64::parseArchExt(StringRef ArchExt) { for (const auto &A : AArch64ARCHExtNames) { if (ArchExt == A.getName()) return static_cast(A.ID); @@ -224,7 +227,7 @@ return AArch64::AEK_INVALID; } -AArch64::ArchKind AArch64::parseCPUArch(StringRef CPU) { +AArch64::ArchKind LLVMSupport_API AArch64::parseCPUArch(StringRef CPU) { for (const auto &C : AArch64CPUNames) { if (CPU == C.getName()) return C.ArchID; @@ -237,8 +240,9 @@ // Returns true on success, with individual elements of the specification // returned in `PBP`. Returns false in error, with `Err` containing // an erroneous part of the spec. -bool AArch64::parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP, - StringRef &Err) { +bool LLVMSupport_API AArch64::parseBranchProtection(StringRef Spec, + ParsedBranchProtection &PBP, + StringRef &Err) { PBP = {"none", "a_key", false}; if (Spec == "none") return true; // defaults are ok Index: llvm/lib/Support/ARMTargetParser.cpp =================================================================== --- llvm/lib/Support/ARMTargetParser.cpp +++ llvm/lib/Support/ARMTargetParser.cpp @@ -25,7 +25,7 @@ } // Allows partial match, ex. "v7a" matches "armv7a". -ARM::ArchKind ARM::parseArch(StringRef Arch) { +ARM::ArchKind LLVMSupport_API ARM::parseArch(StringRef Arch) { Arch = getCanonicalArchName(Arch); StringRef Syn = getArchSynonym(Arch); for (const auto &A : ARCHNames) { @@ -36,7 +36,7 @@ } // Version number (ex. v7 = 7). -unsigned ARM::parseArchVersion(StringRef Arch) { +unsigned LLVMSupport_API ARM::parseArchVersion(StringRef Arch) { Arch = getCanonicalArchName(Arch); switch (parseArch(Arch)) { case ArchKind::ARMV2: @@ -89,7 +89,7 @@ } // Profile A/R/M -ARM::ProfileKind ARM::parseArchProfile(StringRef Arch) { +ARM::ProfileKind LLVMSupport_API ARM::parseArchProfile(StringRef Arch) { Arch = getCanonicalArchName(Arch); switch (parseArch(Arch)) { case ArchKind::ARMV6M: @@ -137,7 +137,7 @@ llvm_unreachable("Unhandled architecture"); } -StringRef ARM::getArchSynonym(StringRef Arch) { +StringRef LLVMSupport_API ARM::getArchSynonym(StringRef Arch) { return StringSwitch(Arch) .Case("v5", "v5t") .Case("v5e", "v5te") @@ -164,8 +164,8 @@ .Default(Arch); } -bool ARM::getFPUFeatures(unsigned FPUKind, std::vector &Features) { - +bool LLVMSupport_API ARM::getFPUFeatures(unsigned FPUKind, + std::vector &Features) { if (FPUKind >= FK_LAST || FPUKind == FK_INVALID) return false; @@ -229,7 +229,7 @@ } // Little/Big endian -ARM::EndianKind ARM::parseArchEndian(StringRef Arch) { +ARM::EndianKind LLVMSupport_API ARM::parseArchEndian(StringRef Arch) { if (Arch.startswith("armeb") || Arch.startswith("thumbeb") || Arch.startswith("aarch64_be")) return EndianKind::BIG; @@ -248,7 +248,7 @@ } // ARM, Thumb, AArch64 -ARM::ISAKind ARM::parseArchISA(StringRef Arch) { +ARM::ISAKind LLVMSupport_API ARM::parseArchISA(StringRef Arch) { return StringSwitch(Arch) .StartsWith("aarch64", ISAKind::AARCH64) .StartsWith("arm64", ISAKind::AARCH64) @@ -257,7 +257,7 @@ .Default(ISAKind::INVALID); } -unsigned ARM::parseFPU(StringRef FPU) { +unsigned LLVMSupport_API ARM::parseFPU(StringRef FPU) { StringRef Syn = getFPUSynonym(FPU); for (const auto &F : FPUNames) { if (Syn == F.getName()) @@ -266,7 +266,8 @@ return FK_INVALID; } -ARM::NeonSupportLevel ARM::getFPUNeonSupportLevel(unsigned FPUKind) { +ARM::NeonSupportLevel LLVMSupport_API +ARM::getFPUNeonSupportLevel(unsigned FPUKind) { if (FPUKind >= FK_LAST) return NeonSupportLevel::None; return FPUNames[FPUKind].NeonSupport; @@ -276,7 +277,7 @@ // (iwmmxt|xscale)(eb)? is also permitted. If the former, return // "v.+", if the latter, return unmodified string, minus 'eb'. // If invalid, return empty string. -StringRef ARM::getCanonicalArchName(StringRef Arch) { +StringRef LLVMSupport_API ARM::getCanonicalArchName(StringRef Arch) { size_t offset = StringRef::npos; StringRef A = Arch; StringRef Error = ""; @@ -331,7 +332,7 @@ return A; } -StringRef ARM::getFPUSynonym(StringRef FPU) { +StringRef LLVMSupport_API ARM::getFPUSynonym(StringRef FPU) { return StringSwitch(FPU) .Cases("fpa", "fpe2", "fpe3", "maverick", "invalid") // Unsupported .Case("vfp2", "vfpv2") @@ -348,25 +349,25 @@ .Default(FPU); } -StringRef ARM::getFPUName(unsigned FPUKind) { +StringRef LLVMSupport_API ARM::getFPUName(unsigned FPUKind) { if (FPUKind >= FK_LAST) return StringRef(); return FPUNames[FPUKind].getName(); } -ARM::FPUVersion ARM::getFPUVersion(unsigned FPUKind) { +ARM::FPUVersion LLVMSupport_API ARM::getFPUVersion(unsigned FPUKind) { if (FPUKind >= FK_LAST) return FPUVersion::NONE; return FPUNames[FPUKind].FPUVer; } -ARM::FPURestriction ARM::getFPURestriction(unsigned FPUKind) { +ARM::FPURestriction LLVMSupport_API ARM::getFPURestriction(unsigned FPUKind) { if (FPUKind >= FK_LAST) return FPURestriction::None; return FPUNames[FPUKind].Restriction; } -unsigned ARM::getDefaultFPU(StringRef CPU, ARM::ArchKind AK) { +unsigned LLVMSupport_API ARM::getDefaultFPU(StringRef CPU, ARM::ArchKind AK) { if (CPU == "generic") return ARM::ARCHNames[static_cast(AK)].DefaultFPU; @@ -377,7 +378,8 @@ .Default(ARM::FK_INVALID); } -uint64_t ARM::getDefaultExtensions(StringRef CPU, ARM::ArchKind AK) { +uint64_t LLVMSupport_API ARM::getDefaultExtensions(StringRef CPU, + ARM::ArchKind AK) { if (CPU == "generic") return ARM::ARCHNames[static_cast(AK)].ArchBaseExtensions; @@ -390,9 +392,8 @@ .Default(ARM::AEK_INVALID); } -bool ARM::getHWDivFeatures(uint64_t HWDivKind, - std::vector &Features) { - +bool LLVMSupport_API ARM::getHWDivFeatures(uint64_t HWDivKind, + std::vector &Features) { if (HWDivKind == AEK_INVALID) return false; @@ -409,9 +410,8 @@ return true; } -bool ARM::getExtensionFeatures(uint64_t Extensions, - std::vector &Features) { - +bool LLVMSupport_API ARM::getExtensionFeatures( + uint64_t Extensions, std::vector &Features) { if (Extensions == AEK_INVALID) return false; @@ -425,23 +425,23 @@ return getHWDivFeatures(Extensions, Features); } -StringRef ARM::getArchName(ARM::ArchKind AK) { +StringRef LLVMSupport_API ARM::getArchName(ARM::ArchKind AK) { return ARCHNames[static_cast(AK)].getName(); } -StringRef ARM::getCPUAttr(ARM::ArchKind AK) { +StringRef LLVMSupport_API ARM::getCPUAttr(ARM::ArchKind AK) { return ARCHNames[static_cast(AK)].getCPUAttr(); } -StringRef ARM::getSubArch(ARM::ArchKind AK) { +StringRef LLVMSupport_API ARM::getSubArch(ARM::ArchKind AK) { return ARCHNames[static_cast(AK)].getSubArch(); } -unsigned ARM::getArchAttr(ARM::ArchKind AK) { +unsigned LLVMSupport_API ARM::getArchAttr(ARM::ArchKind AK) { return ARCHNames[static_cast(AK)].ArchAttr; } -StringRef ARM::getArchExtName(uint64_t ArchExtKind) { +StringRef LLVMSupport_API ARM::getArchExtName(uint64_t ArchExtKind) { for (const auto &AE : ARCHExtNames) { if (ArchExtKind == AE.ID) return AE.getName(); @@ -457,7 +457,7 @@ return false; } -StringRef ARM::getArchExtFeature(StringRef ArchExt) { +StringRef LLVMSupport_API ARM::getArchExtFeature(StringRef ArchExt) { bool Negated = stripNegationPrefix(ArchExt); for (const auto &AE : ARCHExtNames) { if (AE.Feature && ArchExt == AE.getName()) @@ -496,11 +496,9 @@ return ARM::FK_INVALID; } -bool ARM::appendArchExtFeatures(StringRef CPU, ARM::ArchKind AK, - StringRef ArchExt, - std::vector &Features, - unsigned &ArgFPUID) { - +bool LLVMSupport_API ARM::appendArchExtFeatures( + StringRef CPU, ARM::ArchKind AK, StringRef ArchExt, + std::vector &Features, unsigned &ArgFPUID) { size_t StartingNumFeatures = Features.size(); const bool Negated = stripNegationPrefix(ArchExt); uint64_t ID = parseArchExt(ArchExt); @@ -540,7 +538,7 @@ return StartingNumFeatures != Features.size(); } -StringRef ARM::getDefaultCPU(StringRef Arch) { +StringRef LLVMSupport_API ARM::getDefaultCPU(StringRef Arch) { ArchKind AK = parseArch(Arch); if (AK == ArchKind::INVALID) return StringRef(); @@ -555,7 +553,7 @@ return "generic"; } -uint64_t ARM::parseHWDiv(StringRef HWDiv) { +uint64_t LLVMSupport_API ARM::parseHWDiv(StringRef HWDiv) { StringRef Syn = getHWDivSynonym(HWDiv); for (const auto &D : HWDivNames) { if (Syn == D.getName()) @@ -564,7 +562,7 @@ return AEK_INVALID; } -uint64_t ARM::parseArchExt(StringRef ArchExt) { +uint64_t LLVMSupport_API ARM::parseArchExt(StringRef ArchExt) { for (const auto &A : ARCHExtNames) { if (ArchExt == A.getName()) return A.ID; @@ -572,7 +570,7 @@ return AEK_INVALID; } -ARM::ArchKind ARM::parseCPUArch(StringRef CPU) { +ARM::ArchKind LLVMSupport_API ARM::parseCPUArch(StringRef CPU) { for (const auto &C : CPUNames) { if (CPU == C.getName()) return C.ArchID; @@ -580,14 +578,16 @@ return ArchKind::INVALID; } -void ARM::fillValidCPUArchList(SmallVectorImpl &Values) { +void LLVMSupport_API +ARM::fillValidCPUArchList(SmallVectorImpl &Values) { for (const CpuNames &Arch : CPUNames) { if (Arch.ArchID != ArchKind::INVALID) Values.push_back(Arch.getName()); } } -StringRef ARM::computeDefaultTargetABI(const Triple &TT, StringRef CPU) { +StringRef LLVMSupport_API ARM::computeDefaultTargetABI(const Triple &TT, + StringRef CPU) { StringRef ArchName = CPU.empty() ? TT.getArchName() : getArchName(parseCPUArch(CPU)); Index: llvm/lib/Support/Atomic.cpp =================================================================== --- llvm/lib/Support/Atomic.cpp +++ llvm/lib/Support/Atomic.cpp @@ -27,7 +27,7 @@ #define GNU_ATOMICS #endif -void sys::MemoryFence() { +void LLVMSupport_API sys::MemoryFence() { #if LLVM_HAS_ATOMICS == 0 return; #else @@ -41,9 +41,9 @@ #endif } -sys::cas_flag sys::CompareAndSwap(volatile sys::cas_flag* ptr, - sys::cas_flag new_value, - sys::cas_flag old_value) { +sys::cas_flag LLVMSupport_API sys::CompareAndSwap(volatile sys::cas_flag *ptr, + sys::cas_flag new_value, + sys::cas_flag old_value) { #if LLVM_HAS_ATOMICS == 0 sys::cas_flag result = *ptr; if (result == old_value) Index: llvm/lib/Support/AutoConvert.cpp =================================================================== --- llvm/lib/Support/AutoConvert.cpp +++ llvm/lib/Support/AutoConvert.cpp @@ -17,7 +17,7 @@ #include #include -std::error_code llvm::disableAutoConversion(int FD) { +std::error_code LLVMSupport_API llvm::disableAutoConversion(int FD) { static const struct f_cnvrt Convert = { SETCVTOFF, // cvtcmd 0, // pccsid @@ -28,7 +28,7 @@ return std::error_code(); } -std::error_code llvm::enableAutoConversion(int FD) { +std::error_code LLVMSupport_API llvm::enableAutoConversion(int FD) { struct f_cnvrt Query = { QUERYCVT, // cvtcmd 0, // pccsid @@ -50,7 +50,7 @@ return std::error_code(); } -std::error_code llvm::setFileTag(int FD, int CCSID, bool Text) { +std::error_code LLVMSupport_API llvm::setFileTag(int FD, int CCSID, bool Text) { assert((!Text || (CCSID != FT_UNTAGGED && CCSID != FT_BINARY)) && "FT_UNTAGGED and FT_BINARY are not allowed for text files"); struct file_tag Tag; Index: llvm/lib/Support/CMakeLists.txt =================================================================== --- llvm/lib/Support/CMakeLists.txt +++ llvm/lib/Support/CMakeLists.txt @@ -101,7 +101,7 @@ endif() endif() -add_llvm_component_library(LLVMSupport +add_llvm_component_library(LLVMSupport SHARED AArch64TargetParser.cpp ABIBreak.cpp ARMTargetParser.cpp @@ -281,7 +281,12 @@ set(llvm_system_libs ${llvm_system_libs} "${terminfo_library}") endif() -set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${llvm_system_libs}") +set_target_properties(LLVMSupport PROPERTIES + LLVM_SYSTEM_LIBS "${llvm_system_libs}" + DEFINE_SYMBOL "LLVMSupport_EXPORTS" + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN YES) if(LLVM_INTEGRATED_CRT_ALLOC) Index: llvm/lib/Support/CachePruning.cpp =================================================================== --- llvm/lib/Support/CachePruning.cpp +++ llvm/lib/Support/CachePruning.cpp @@ -74,7 +74,7 @@ } Expected -llvm::parseCachePruningPolicy(StringRef PolicyStr) { + LLVMSupport_API llvm::parseCachePruningPolicy(StringRef PolicyStr) { CachePruningPolicy Policy; std::pair P = {"", PolicyStr}; while (!P.second.empty()) { @@ -141,7 +141,8 @@ } /// Prune the cache of files that haven't been accessed in a long time. -bool llvm::pruneCache(StringRef Path, CachePruningPolicy Policy) { +bool LLVMSupport_API llvm::pruneCache(StringRef Path, + CachePruningPolicy Policy) { using namespace std::chrono; if (Path.empty()) Index: llvm/lib/Support/Chrono.cpp =================================================================== --- llvm/lib/Support/Chrono.cpp +++ llvm/lib/Support/Chrono.cpp @@ -40,7 +40,7 @@ return Storage; } -raw_ostream &operator<<(raw_ostream &OS, TimePoint<> TP) { +LLVMSupport_API raw_ostream &operator<<(raw_ostream &OS, TimePoint<> TP) { struct tm LT = getStructTM(TP); char Buffer[sizeof("YYYY-MM-DD HH:MM:SS")]; strftime(Buffer, sizeof(Buffer), "%Y-%m-%d %H:%M:%S", <); Index: llvm/lib/Support/Compression.cpp =================================================================== --- llvm/lib/Support/Compression.cpp +++ llvm/lib/Support/Compression.cpp @@ -44,10 +44,11 @@ } } -bool zlib::isAvailable() { return true; } +bool LLVMSupport_API zlib::isAvailable() { return true; } -Error zlib::compress(StringRef InputBuffer, - SmallVectorImpl &CompressedBuffer, int Level) { +Error LLVMSupport_API zlib::compress(StringRef InputBuffer, + SmallVectorImpl &CompressedBuffer, + int Level) { unsigned long CompressedSize = ::compressBound(InputBuffer.size()); CompressedBuffer.reserve(CompressedSize); int Res = @@ -60,8 +61,9 @@ return Res ? createError(convertZlibCodeToString(Res)) : Error::success(); } -Error zlib::uncompress(StringRef InputBuffer, char *UncompressedBuffer, - size_t &UncompressedSize) { +Error LLVMSupport_API zlib::uncompress(StringRef InputBuffer, + char *UncompressedBuffer, + size_t &UncompressedSize) { int Res = ::uncompress((Bytef *)UncompressedBuffer, (uLongf *)&UncompressedSize, (const Bytef *)InputBuffer.data(), InputBuffer.size()); @@ -71,9 +73,9 @@ return Res ? createError(convertZlibCodeToString(Res)) : Error::success(); } -Error zlib::uncompress(StringRef InputBuffer, - SmallVectorImpl &UncompressedBuffer, - size_t UncompressedSize) { +Error LLVMSupport_API zlib::uncompress( + StringRef InputBuffer, SmallVectorImpl &UncompressedBuffer, + size_t UncompressedSize) { UncompressedBuffer.reserve(UncompressedSize); Error E = uncompress(InputBuffer, UncompressedBuffer.data(), UncompressedSize); @@ -81,26 +83,28 @@ return E; } -uint32_t zlib::crc32(StringRef Buffer) { +uint32_t LLVMSupport_API zlib::crc32(StringRef Buffer) { return ::crc32(0, (const Bytef *)Buffer.data(), Buffer.size()); } #else -bool zlib::isAvailable() { return false; } -Error zlib::compress(StringRef InputBuffer, - SmallVectorImpl &CompressedBuffer, int Level) { +bool LLVMSupport_API zlib::isAvailable() { return false; } +Error LLVMSupport_API zlib::compress(StringRef InputBuffer, + SmallVectorImpl &CompressedBuffer, + int Level) { llvm_unreachable("zlib::compress is unavailable"); } -Error zlib::uncompress(StringRef InputBuffer, char *UncompressedBuffer, - size_t &UncompressedSize) { +Error LLVMSupport_API zlib::uncompress(StringRef InputBuffer, + char *UncompressedBuffer, + size_t &UncompressedSize) { llvm_unreachable("zlib::uncompress is unavailable"); } -Error zlib::uncompress(StringRef InputBuffer, - SmallVectorImpl &UncompressedBuffer, - size_t UncompressedSize) { +Error LLVMSupport_API zlib::uncompress( + StringRef InputBuffer, SmallVectorImpl &UncompressedBuffer, + size_t UncompressedSize) { llvm_unreachable("zlib::uncompress is unavailable"); } -uint32_t zlib::crc32(StringRef Buffer) { +uint32_t LLVMSupport_API zlib::crc32(StringRef Buffer) { llvm_unreachable("zlib::crc32 is unavailable"); } #endif