[llvm] [Support] Add clang tooling generated explicit visibility macros (PR #113097)
Thomas Fransham via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 14:26:27 PST 2024
https://github.com/fsfod updated https://github.com/llvm/llvm-project/pull/113097
>From 305f60aa1d0b33d50467507a4cd48dfb961025c1 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Sun, 20 Oct 2024 18:00:03 +0100
Subject: [PATCH 1/4] [Support] Add clang tooling generated explicit visibility
macros
These will be needed to export symbols from llvm shared library on windows without
having to export every symbol and running in to the 64k symbol limit of DLLs.
This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on window.
---
llvm/include/llvm/Support/AMDGPUMetadata.h | 5 +-
.../include/llvm/Support/ARMAttributeParser.h | 3 +-
.../include/llvm/Support/ARMBuildAttributes.h | 3 +-
llvm/include/llvm/Support/ARMWinEH.h | 3 +-
llvm/include/llvm/Support/Allocator.h | 2 +-
llvm/include/llvm/Support/Atomic.h | 5 +-
.../llvm/Support/BalancedPartitioning.h | 7 +-
llvm/include/llvm/Support/Base64.h | 3 +-
llvm/include/llvm/Support/BinaryStream.h | 5 +-
llvm/include/llvm/Support/BinaryStreamError.h | 3 +-
.../include/llvm/Support/BinaryStreamReader.h | 3 +-
llvm/include/llvm/Support/BinaryStreamRef.h | 5 +-
.../include/llvm/Support/BinaryStreamWriter.h | 3 +-
llvm/include/llvm/Support/BlockFrequency.h | 5 +-
llvm/include/llvm/Support/BranchProbability.h | 3 +-
llvm/include/llvm/Support/BuryPointer.h | 3 +-
llvm/include/llvm/Support/COM.h | 3 +-
llvm/include/llvm/Support/CRC.h | 7 +-
.../llvm/Support/CSKYAttributeParser.h | 3 +-
llvm/include/llvm/Support/CSKYAttributes.h | 3 +-
llvm/include/llvm/Support/CachePruning.h | 5 +-
llvm/include/llvm/Support/Caching.h | 3 +-
llvm/include/llvm/Support/Chrono.h | 20 +--
llvm/include/llvm/Support/CodeGenCoverage.h | 3 +-
llvm/include/llvm/Support/CommandLine.h | 131 +++++++-------
llvm/include/llvm/Support/Compression.h | 27 +--
llvm/include/llvm/Support/ConvertEBCDIC.h | 5 +-
llvm/include/llvm/Support/ConvertUTF.h | 53 +++---
.../llvm/Support/CrashRecoveryContext.h | 5 +-
llvm/include/llvm/Support/DJB.h | 3 +-
llvm/include/llvm/Support/DataExtractor.h | 3 +-
llvm/include/llvm/Support/Debug.h | 13 +-
llvm/include/llvm/Support/DebugCounter.h | 5 +-
.../llvm/Support/DivisionByConstantInfo.h | 5 +-
llvm/include/llvm/Support/DynamicLibrary.h | 3 +-
.../include/llvm/Support/ELFAttributeParser.h | 3 +-
llvm/include/llvm/Support/ELFAttributes.h | 5 +-
llvm/include/llvm/Support/Errno.h | 5 +-
llvm/include/llvm/Support/Error.h | 30 ++--
llvm/include/llvm/Support/ErrorHandling.h | 20 +--
.../include/llvm/Support/ExponentialBackoff.h | 3 +-
llvm/include/llvm/Support/ExtensibleRTTI.h | 3 +-
llvm/include/llvm/Support/FileCollector.h | 7 +-
llvm/include/llvm/Support/FileOutputBuffer.h | 3 +-
llvm/include/llvm/Support/FileSystem.h | 161 +++++++++---------
llvm/include/llvm/Support/FileUtilities.h | 5 +-
llvm/include/llvm/Support/Format.h | 3 +-
llvm/include/llvm/Support/FormatVariadic.h | 3 +-
.../llvm/Support/FormatVariadicDetails.h | 5 +-
llvm/include/llvm/Support/FormattedStream.h | 9 +-
llvm/include/llvm/Support/GlobPattern.h | 5 +-
llvm/include/llvm/Support/GraphWriter.h | 9 +-
.../llvm/Support/HexagonAttributeParser.h | 3 +-
llvm/include/llvm/Support/HexagonAttributes.h | 3 +-
llvm/include/llvm/Support/InitLLVM.h | 3 +-
llvm/include/llvm/Support/InstructionCost.h | 3 +-
llvm/include/llvm/Support/JSON.h | 30 ++--
llvm/include/llvm/Support/KnownBits.h | 3 +-
llvm/include/llvm/Support/LEB128.h | 5 +-
llvm/include/llvm/Support/LineIterator.h | 3 +-
llvm/include/llvm/Support/Locale.h | 5 +-
llvm/include/llvm/Support/LockFileManager.h | 3 +-
llvm/include/llvm/Support/MD5.h | 5 +-
.../llvm/Support/MSP430AttributeParser.h | 3 +-
llvm/include/llvm/Support/MSP430Attributes.h | 3 +-
llvm/include/llvm/Support/ManagedStatic.h | 5 +-
llvm/include/llvm/Support/MathExtras.h | 2 +-
llvm/include/llvm/Support/MemAlloc.h | 4 +-
llvm/include/llvm/Support/Memory.h | 7 +-
llvm/include/llvm/Support/MemoryBuffer.h | 7 +-
llvm/include/llvm/Support/MemoryBufferRef.h | 3 +-
llvm/include/llvm/Support/ModRef.h | 5 +-
llvm/include/llvm/Support/NativeFormatting.h | 21 +--
.../llvm/Support/OptimizedStructLayout.h | 5 +-
llvm/include/llvm/Support/OptionStrCmp.h | 5 +-
llvm/include/llvm/Support/PGOOptions.h | 3 +-
llvm/include/llvm/Support/Parallel.h | 11 +-
llvm/include/llvm/Support/Path.h | 93 +++++-----
llvm/include/llvm/Support/PluginLoader.h | 3 +-
llvm/include/llvm/Support/PrettyStackTrace.h | 22 +--
llvm/include/llvm/Support/Process.h | 3 +-
llvm/include/llvm/Support/Program.h | 29 ++--
.../llvm/Support/RISCVAttributeParser.h | 3 +-
llvm/include/llvm/Support/RISCVAttributes.h | 3 +-
llvm/include/llvm/Support/RISCVISAUtils.h | 3 +-
.../llvm/Support/RandomNumberGenerator.h | 4 +-
llvm/include/llvm/Support/Recycler.h | 3 +-
llvm/include/llvm/Support/Regex.h | 3 +-
llvm/include/llvm/Support/SHA1.h | 3 +-
llvm/include/llvm/Support/SHA256.h | 3 +-
llvm/include/llvm/Support/SMTAPI.h | 11 +-
llvm/include/llvm/Support/ScaledNumber.h | 11 +-
llvm/include/llvm/Support/ScopedPrinter.h | 9 +-
llvm/include/llvm/Support/Signals.h | 31 ++--
llvm/include/llvm/Support/Signposts.h | 3 +-
llvm/include/llvm/Support/SipHash.h | 7 +-
.../llvm/Support/SmallVectorMemoryBuffer.h | 3 +-
llvm/include/llvm/Support/SourceMgr.h | 9 +-
llvm/include/llvm/Support/SpecialCaseList.h | 5 +-
llvm/include/llvm/Support/StringSaver.h | 5 +-
llvm/include/llvm/Support/SuffixTree.h | 5 +-
llvm/include/llvm/Support/SuffixTreeNode.h | 7 +-
llvm/include/llvm/Support/SystemUtils.h | 3 +-
llvm/include/llvm/Support/TarWriter.h | 3 +-
llvm/include/llvm/Support/ThreadPool.h | 7 +-
llvm/include/llvm/Support/Threading.h | 20 +--
llvm/include/llvm/Support/TimeProfiler.h | 29 ++--
llvm/include/llvm/Support/Timer.h | 11 +-
llvm/include/llvm/Support/ToolOutputFile.h | 5 +-
llvm/include/llvm/Support/TypeSize.h | 5 +-
llvm/include/llvm/Support/Unicode.h | 15 +-
llvm/include/llvm/Support/Valgrind.h | 5 +-
llvm/include/llvm/Support/VersionTuple.h | 5 +-
llvm/include/llvm/Support/VirtualFileSystem.h | 37 ++--
llvm/include/llvm/Support/Watchdog.h | 2 +-
.../llvm/Support/Windows/WindowsSupport.h | 12 +-
llvm/include/llvm/Support/WindowsError.h | 5 +-
llvm/include/llvm/Support/WithColor.h | 4 +-
llvm/include/llvm/Support/YAMLParser.h | 29 ++--
llvm/include/llvm/Support/YAMLTraits.h | 43 ++---
.../llvm/Support/circular_raw_ostream.h | 3 +-
llvm/include/llvm/Support/raw_os_ostream.h | 3 +-
llvm/include/llvm/Support/raw_ostream.h | 29 ++--
llvm/include/llvm/Support/raw_socket_stream.h | 7 +-
llvm/include/llvm/Support/thread.h | 13 +-
llvm/include/llvm/Support/xxhash.h | 9 +-
126 files changed, 744 insertions(+), 631 deletions(-)
diff --git a/llvm/include/llvm/Support/AMDGPUMetadata.h b/llvm/include/llvm/Support/AMDGPUMetadata.h
index 76ac7ab74a32e8..990c825ae68751 100644
--- a/llvm/include/llvm/Support/AMDGPUMetadata.h
+++ b/llvm/include/llvm/Support/AMDGPUMetadata.h
@@ -16,6 +16,7 @@
#define LLVM_SUPPORT_AMDGPUMETADATA_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include <cstdint>
#include <string>
#include <system_error>
@@ -447,10 +448,10 @@ struct Metadata final {
};
/// Converts \p String to \p HSAMetadata.
-std::error_code fromString(StringRef String, Metadata &HSAMetadata);
+LLVM_ABI std::error_code fromString(StringRef String, Metadata &HSAMetadata);
/// Converts \p HSAMetadata to \p String.
-std::error_code toString(Metadata HSAMetadata, std::string &String);
+LLVM_ABI std::error_code toString(Metadata HSAMetadata, std::string &String);
//===----------------------------------------------------------------------===//
// HSA metadata for v3 code object.
diff --git a/llvm/include/llvm/Support/ARMAttributeParser.h b/llvm/include/llvm/Support/ARMAttributeParser.h
index d1d953120ae7ed..da0884d823ffcb 100644
--- a/llvm/include/llvm/Support/ARMAttributeParser.h
+++ b/llvm/include/llvm/Support/ARMAttributeParser.h
@@ -12,13 +12,14 @@
#include "ARMBuildAttributes.h"
#include "ELFAttributeParser.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
namespace llvm {
class ScopedPrinter;
-class ARMAttributeParser : public ELFAttributeParser {
+class LLVM_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
index 35f8992ca93296..68acf30e52f3ec 100644
--- a/llvm/include/llvm/Support/ARMBuildAttributes.h
+++ b/llvm/include/llvm/Support/ARMBuildAttributes.h
@@ -18,12 +18,13 @@
#ifndef LLVM_SUPPORT_ARMBUILDATTRIBUTES_H
#define LLVM_SUPPORT_ARMBUILDATTRIBUTES_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ELFAttributes.h"
namespace llvm {
namespace ARMBuildAttrs {
-const TagNameMap &getARMAttributeTags();
+LLVM_ABI const TagNameMap &getARMAttributeTags();
enum SpecialAttr {
// This is for the .cpu asm attr. It translates into one or more
diff --git a/llvm/include/llvm/Support/ARMWinEH.h b/llvm/include/llvm/Support/ARMWinEH.h
index b6710cca95650d..3c952bcae5f027 100644
--- a/llvm/include/llvm/Support/ARMWinEH.h
+++ b/llvm/include/llvm/Support/ARMWinEH.h
@@ -10,6 +10,7 @@
#define LLVM_SUPPORT_ARMWINEH_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Endian.h"
namespace llvm {
@@ -205,7 +206,7 @@ inline uint16_t StackAdjustment(const RuntimeFunction &RF) {
/// SavedRegisterMask - Utility function to calculate the set of saved general
/// purpose (r0-r15) and VFP (d0-d31) registers.
-std::pair<uint16_t, uint32_t> SavedRegisterMask(const RuntimeFunction &RF,
+LLVM_ABI std::pair<uint16_t, uint32_t> SavedRegisterMask(const RuntimeFunction &RF,
bool Prologue = true);
/// RuntimeFunctionARM64 - An entry in the table of procedure data (.pdata)
diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h
index 568f0d34032fa2..36561cf5d5a93d 100644
--- a/llvm/include/llvm/Support/Allocator.h
+++ b/llvm/include/llvm/Support/Allocator.h
@@ -36,7 +36,7 @@ namespace detail {
// We call out to an external function to actually print the message as the
// printing code uses Allocator.h in its implementation.
-void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated,
+LLVM_ABI void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated,
size_t TotalMemory);
} // end namespace detail
diff --git a/llvm/include/llvm/Support/Atomic.h b/llvm/include/llvm/Support/Atomic.h
index a8445fddc1a855..43df01462b59c3 100644
--- a/llvm/include/llvm/Support/Atomic.h
+++ b/llvm/include/llvm/Support/Atomic.h
@@ -17,6 +17,7 @@
#ifndef LLVM_SUPPORT_ATOMIC_H
#define LLVM_SUPPORT_ATOMIC_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
// Windows will at times define MemoryFence.
@@ -26,14 +27,14 @@
namespace llvm {
namespace sys {
- void MemoryFence();
+ LLVM_ABI void MemoryFence();
#ifdef _MSC_VER
typedef long cas_flag;
#else
typedef uint32_t cas_flag;
#endif
- cas_flag CompareAndSwap(volatile cas_flag* ptr,
+ LLVM_ABI cas_flag CompareAndSwap(volatile cas_flag* ptr,
cas_flag new_value,
cas_flag old_value);
}
diff --git a/llvm/include/llvm/Support/BalancedPartitioning.h b/llvm/include/llvm/Support/BalancedPartitioning.h
index 539d157343fbe3..b1b120787516e8 100644
--- a/llvm/include/llvm/Support/BalancedPartitioning.h
+++ b/llvm/include/llvm/Support/BalancedPartitioning.h
@@ -41,6 +41,7 @@
#include "raw_ostream.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Compiler.h"
#include <atomic>
#include <condition_variable>
@@ -53,7 +54,7 @@ namespace llvm {
class ThreadPoolInterface;
/// A function with a set of utility nodes where it is beneficial to order two
/// functions close together if they have similar utility nodes
-class BPFunctionNode {
+class LLVM_ABI BPFunctionNode {
friend class BalancedPartitioning;
public:
@@ -97,7 +98,7 @@ struct BalancedPartitioningConfig {
unsigned TaskSplitDepth = 9;
};
-class BalancedPartitioning {
+class LLVM_ABI BalancedPartitioning {
public:
BalancedPartitioning(const BalancedPartitioningConfig &Config);
@@ -114,7 +115,7 @@ class BalancedPartitioning {
/// wait(). BalancedPartitioning recursively spawns new threads inside other
/// threads, so we need to track how many active threads that could spawn more
/// threads.
- struct BPThreadPool {
+ struct LLVM_ABI BPThreadPool {
ThreadPoolInterface &TheThreadPool;
std::mutex mtx;
std::condition_variable cv;
diff --git a/llvm/include/llvm/Support/Base64.h b/llvm/include/llvm/Support/Base64.h
index 3d96884749b32f..997e8c0b7124e1 100644
--- a/llvm/include/llvm/Support/Base64.h
+++ b/llvm/include/llvm/Support/Base64.h
@@ -13,6 +13,7 @@
#ifndef LLVM_SUPPORT_BASE64_H
#define LLVM_SUPPORT_BASE64_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include <cstdint>
#include <string>
@@ -54,7 +55,7 @@ template <class InputBytes> std::string encodeBase64(InputBytes const &Bytes) {
return Buffer;
}
-llvm::Error decodeBase64(llvm::StringRef Input, std::vector<char> &Output);
+LLVM_ABI llvm::Error decodeBase64(llvm::StringRef Input, std::vector<char> &Output);
} // end namespace llvm
diff --git a/llvm/include/llvm/Support/BinaryStream.h b/llvm/include/llvm/Support/BinaryStream.h
index 8fba5ee9b0b368..1cb783207a23cb 100644
--- a/llvm/include/llvm/Support/BinaryStream.h
+++ b/llvm/include/llvm/Support/BinaryStream.h
@@ -12,6 +12,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/Support/BinaryStreamError.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include <cstdint>
@@ -31,7 +32,7 @@ enum BinaryStreamFlags {
/// 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 LLVM_ABI BinaryStream {
public:
virtual ~BinaryStream() = default;
@@ -69,7 +70,7 @@ class BinaryStream {
/// 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 LLVM_ABI WritableBinaryStream : public BinaryStream {
public:
~WritableBinaryStream() override = default;
diff --git a/llvm/include/llvm/Support/BinaryStreamError.h b/llvm/include/llvm/Support/BinaryStreamError.h
index cf6e034ffd2ceb..8a45f7bbd52cce 100644
--- a/llvm/include/llvm/Support/BinaryStreamError.h
+++ b/llvm/include/llvm/Support/BinaryStreamError.h
@@ -10,6 +10,7 @@
#define LLVM_SUPPORT_BINARYSTREAMERROR_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include <string>
@@ -24,7 +25,7 @@ enum class stream_error_code {
};
/// Base class for errors originating when parsing raw PDB files
-class BinaryStreamError : public ErrorInfo<BinaryStreamError> {
+class LLVM_ABI BinaryStreamError : public ErrorInfo<BinaryStreamError> {
public:
static char ID;
explicit BinaryStreamError(stream_error_code C);
diff --git a/llvm/include/llvm/Support/BinaryStreamReader.h b/llvm/include/llvm/Support/BinaryStreamReader.h
index ca99388c5d03af..e61349d841cdb9 100644
--- a/llvm/include/llvm/Support/BinaryStreamReader.h
+++ b/llvm/include/llvm/Support/BinaryStreamReader.h
@@ -14,6 +14,7 @@
#include "llvm/Support/Alignment.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
@@ -26,7 +27,7 @@ namespace llvm {
/// 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_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
index fdc46f5fd56057..351c3958aee98c 100644
--- a/llvm/include/llvm/Support/BinaryStreamRef.h
+++ b/llvm/include/llvm/Support/BinaryStreamRef.h
@@ -12,6 +12,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/BinaryStream.h"
#include "llvm/Support/BinaryStreamError.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include <cstdint>
#include <memory>
@@ -150,7 +151,7 @@ template <class RefType, class StreamType> class BinaryStreamRefBase {
/// 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_ABI BinaryStreamRef
: public BinaryStreamRefBase<BinaryStreamRef, BinaryStream> {
friend BinaryStreamRefBase<BinaryStreamRef, BinaryStream>;
friend class WritableBinaryStreamRef;
@@ -214,7 +215,7 @@ struct BinarySubstreamRef {
bool empty() const { return size() == 0; }
};
-class WritableBinaryStreamRef
+class LLVM_ABI WritableBinaryStreamRef
: public BinaryStreamRefBase<WritableBinaryStreamRef,
WritableBinaryStream> {
friend BinaryStreamRefBase<WritableBinaryStreamRef, WritableBinaryStream>;
diff --git a/llvm/include/llvm/Support/BinaryStreamWriter.h b/llvm/include/llvm/Support/BinaryStreamWriter.h
index bc1d7949841d6f..f5102ef1931014 100644
--- a/llvm/include/llvm/Support/BinaryStreamWriter.h
+++ b/llvm/include/llvm/Support/BinaryStreamWriter.h
@@ -14,6 +14,7 @@
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamError.h"
#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <cstdint>
@@ -27,7 +28,7 @@ namespace llvm {
/// 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_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
index aeab99615a951a..4f630d28f72d63 100644
--- a/llvm/include/llvm/Support/BlockFrequency.h
+++ b/llvm/include/llvm/Support/BlockFrequency.h
@@ -13,6 +13,7 @@
#ifndef LLVM_SUPPORT_BLOCKFREQUENCY_H
#define LLVM_SUPPORT_BLOCKFREQUENCY_H
+#include "llvm/Support/Compiler.h"
#include <cassert>
#include <cstdint>
#include <optional>
@@ -23,7 +24,7 @@ class raw_ostream;
class BranchProbability;
// This class represents Block Frequency as a 64-bit value.
-class BlockFrequency {
+class LLVM_ABI BlockFrequency {
uint64_t Frequency;
public:
@@ -120,7 +121,7 @@ class BlockFrequency {
}
};
-void printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq,
+LLVM_ABI void printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq,
BlockFrequency Freq);
} // namespace llvm
diff --git a/llvm/include/llvm/Support/BranchProbability.h b/llvm/include/llvm/Support/BranchProbability.h
index 79d70cf611d415..4b48ce22ada14e 100644
--- a/llvm/include/llvm/Support/BranchProbability.h
+++ b/llvm/include/llvm/Support/BranchProbability.h
@@ -13,6 +13,7 @@
#ifndef LLVM_SUPPORT_BRANCHPROBABILITY_H
#define LLVM_SUPPORT_BRANCHPROBABILITY_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include <algorithm>
#include <cassert>
@@ -27,7 +28,7 @@ class raw_ostream;
// 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_ABI BranchProbability {
// Numerator
uint32_t N;
diff --git a/llvm/include/llvm/Support/BuryPointer.h b/llvm/include/llvm/Support/BuryPointer.h
index 276a5b7089c3e7..02144baed36af1 100644
--- a/llvm/include/llvm/Support/BuryPointer.h
+++ b/llvm/include/llvm/Support/BuryPointer.h
@@ -9,6 +9,7 @@
#ifndef LLVM_SUPPORT_BURYPOINTER_H
#define LLVM_SUPPORT_BURYPOINTER_H
+#include "llvm/Support/Compiler.h"
#include <memory>
namespace llvm {
@@ -19,7 +20,7 @@ namespace llvm {
// the memory is not misdiagnosed as an unintentional leak by leak detection
// tools (this is achieved by preserving pointers to the object in a globally
// visible array).
-void BuryPointer(const void *Ptr);
+LLVM_ABI void BuryPointer(const void *Ptr);
template <typename T> void BuryPointer(std::unique_ptr<T> Ptr) {
BuryPointer(Ptr.release());
}
diff --git a/llvm/include/llvm/Support/COM.h b/llvm/include/llvm/Support/COM.h
index d59966f849b485..53a599acc745b7 100644
--- a/llvm/include/llvm/Support/COM.h
+++ b/llvm/include/llvm/Support/COM.h
@@ -14,12 +14,13 @@
#ifndef LLVM_SUPPORT_COM_H
#define LLVM_SUPPORT_COM_H
+#include "llvm/Support/Compiler.h"
namespace llvm {
namespace sys {
enum class COMThreadingMode { SingleThreaded, MultiThreaded };
-class InitializeCOMRAII {
+class LLVM_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
index 210890ae06d47c..b96e7664ba3724 100644
--- a/llvm/include/llvm/Support/CRC.h
+++ b/llvm/include/llvm/Support/CRC.h
@@ -13,17 +13,18 @@
#ifndef LLVM_SUPPORT_CRC_H
#define LLVM_SUPPORT_CRC_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
namespace llvm {
template <typename T> class ArrayRef;
// Compute the CRC-32 of Data.
-uint32_t crc32(ArrayRef<uint8_t> Data);
+LLVM_ABI uint32_t crc32(ArrayRef<uint8_t> Data);
// Compute the running CRC-32 of Data, with CRC being the previous value of the
// checksum.
-uint32_t crc32(uint32_t CRC, ArrayRef<uint8_t> Data);
+LLVM_ABI uint32_t crc32(uint32_t CRC, ArrayRef<uint8_t> Data);
// Class for computing the JamCRC.
//
@@ -42,7 +43,7 @@ uint32_t crc32(uint32_t CRC, ArrayRef<uint8_t> Data);
//
// N.B. We permit flexibility of the "Init" value. Some consumers of this need
// it to be zero.
-class JamCRC {
+class LLVM_ABI JamCRC {
public:
JamCRC(uint32_t Init = 0xFFFFFFFFU) : CRC(Init) {}
diff --git a/llvm/include/llvm/Support/CSKYAttributeParser.h b/llvm/include/llvm/Support/CSKYAttributeParser.h
index e926ebe5e306e3..4bf89e3f69d436 100644
--- a/llvm/include/llvm/Support/CSKYAttributeParser.h
+++ b/llvm/include/llvm/Support/CSKYAttributeParser.h
@@ -10,10 +10,11 @@
#define LLVM_SUPPORT_CSKYATTRIBUTEPARSER_H
#include "llvm/Support/CSKYAttributes.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ELFAttributeParser.h"
namespace llvm {
-class CSKYAttributeParser : public ELFAttributeParser {
+class LLVM_ABI CSKYAttributeParser : public ELFAttributeParser {
struct DisplayHandler {
CSKYAttrs::AttrType attribute;
Error (CSKYAttributeParser::*routine)(unsigned);
diff --git a/llvm/include/llvm/Support/CSKYAttributes.h b/llvm/include/llvm/Support/CSKYAttributes.h
index 723f2ceee8fb79..c16d3de96c2197 100644
--- a/llvm/include/llvm/Support/CSKYAttributes.h
+++ b/llvm/include/llvm/Support/CSKYAttributes.h
@@ -12,12 +12,13 @@
#ifndef LLVM_SUPPORT_CSKYATTRIBUTES_H
#define LLVM_SUPPORT_CSKYATTRIBUTES_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ELFAttributes.h"
namespace llvm {
namespace CSKYAttrs {
-const TagNameMap &getCSKYAttributeTags();
+LLVM_ABI const TagNameMap &getCSKYAttributeTags();
enum AttrType {
CSKY_ARCH_NAME = 4,
diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h
index 17e148830a73f9..50d5ea41ec9ba9 100644
--- a/llvm/include/llvm/Support/CachePruning.h
+++ b/llvm/include/llvm/Support/CachePruning.h
@@ -14,6 +14,7 @@
#ifndef LLVM_SUPPORT_CACHEPRUNING_H
#define LLVM_SUPPORT_CACHEPRUNING_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MemoryBuffer.h"
#include <chrono>
#include <optional>
@@ -66,7 +67,7 @@ struct CachePruningPolicy {
/// For example: "prune_interval=30s:prune_after=24h:cache_size=50%"
/// which means a pruning interval of 30 seconds, expiration time of 24 hours
/// and maximum cache size of 50% of available disk space.
-Expected<CachePruningPolicy> parseCachePruningPolicy(StringRef PolicyStr);
+LLVM_ABI Expected<CachePruningPolicy> parseCachePruningPolicy(StringRef PolicyStr);
/// Peform pruning using the supplied policy, returns true if pruning
/// occurred, i.e. if Policy.Interval was expired.
@@ -79,7 +80,7 @@ Expected<CachePruningPolicy> parseCachePruningPolicy(StringRef PolicyStr);
/// As a safeguard against data loss if the user specifies the wrong directory
/// as their cache directory, this function will ignore files not matching the
/// pattern "llvmcache-*".
-bool pruneCache(StringRef Path, CachePruningPolicy Policy,
+LLVM_ABI bool pruneCache(StringRef Path, CachePruningPolicy Policy,
const std::vector<std::unique_ptr<MemoryBuffer>> &Files = {});
} // namespace llvm
diff --git a/llvm/include/llvm/Support/Caching.h b/llvm/include/llvm/Support/Caching.h
index cf45145619d95b..8c50902c42999b 100644
--- a/llvm/include/llvm/Support/Caching.h
+++ b/llvm/include/llvm/Support/Caching.h
@@ -15,6 +15,7 @@
#ifndef LLVM_SUPPORT_CACHING_H
#define LLVM_SUPPORT_CACHING_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
namespace llvm {
@@ -96,7 +97,7 @@ using AddBufferFn = std::function<void(unsigned Task, const Twine &ModuleName,
/// done lazily the first time a file is added. The cache name appears in error
/// messages for errors during caching. The temporary file prefix is used in the
/// temporary file naming scheme used when writing files atomically.
-Expected<FileCache> localCache(
+LLVM_ABI Expected<FileCache> localCache(
const Twine &CacheNameRef, const Twine &TempFilePrefixRef,
const Twine &CacheDirectoryPathRef,
AddBufferFn AddBuffer = [](size_t Task, const Twine &ModuleName,
diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h
index 71859af7c7e4a5..e20cd30687d915 100644
--- a/llvm/include/llvm/Support/Chrono.h
+++ b/llvm/include/llvm/Support/Chrono.h
@@ -77,8 +77,8 @@ toTimePoint(std::time_t T, uint32_t nsec) {
} // namespace sys
-raw_ostream &operator<<(raw_ostream &OS, sys::TimePoint<> TP);
-raw_ostream &operator<<(raw_ostream &OS, sys::UtcTime<> TP);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, sys::TimePoint<> TP);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, sys::UtcTime<> TP);
/// Format provider for TimePoint<>
///
@@ -89,12 +89,12 @@ raw_ostream &operator<<(raw_ostream &OS, sys::UtcTime<> TP);
///
/// If no options are given, the default format is "%Y-%m-%d %H:%M:%S.%N".
template <>
-struct format_provider<sys::TimePoint<>> {
+struct LLVM_ABI format_provider<sys::TimePoint<>> {
static void format(const sys::TimePoint<> &TP, llvm::raw_ostream &OS,
StringRef Style);
};
-template <> struct format_provider<sys::UtcTime<std::chrono::seconds>> {
+template <> struct LLVM_ABI format_provider<sys::UtcTime<std::chrono::seconds>> {
static void format(const sys::UtcTime<std::chrono::seconds> &TP,
llvm::raw_ostream &OS, StringRef Style);
};
@@ -103,12 +103,12 @@ namespace detail {
template <typename Period> struct unit { static const char value[]; };
template <typename Period> const char unit<Period>::value[] = "";
-template <> struct unit<std::ratio<3600>> { static const char value[]; };
-template <> struct unit<std::ratio<60>> { static const char value[]; };
-template <> struct unit<std::ratio<1>> { static const char value[]; };
-template <> struct unit<std::milli> { static const char value[]; };
-template <> struct unit<std::micro> { static const char value[]; };
-template <> struct unit<std::nano> { static const char value[]; };
+template <> struct LLVM_ABI unit<std::ratio<3600>> { static const char value[]; };
+template <> struct LLVM_ABI unit<std::ratio<60>> { static const char value[]; };
+template <> struct LLVM_ABI unit<std::ratio<1>> { static const char value[]; };
+template <> struct LLVM_ABI unit<std::milli> { static const char value[]; };
+template <> struct LLVM_ABI unit<std::micro> { static const char value[]; };
+template <> struct LLVM_ABI unit<std::nano> { static const char value[]; };
} // namespace detail
/// Implementation of format_provider<T> for duration types.
diff --git a/llvm/include/llvm/Support/CodeGenCoverage.h b/llvm/include/llvm/Support/CodeGenCoverage.h
index 2acdd6a36a514c..769e1918945ffc 100644
--- a/llvm/include/llvm/Support/CodeGenCoverage.h
+++ b/llvm/include/llvm/Support/CodeGenCoverage.h
@@ -12,11 +12,12 @@
#define LLVM_SUPPORT_CODEGENCOVERAGE_H
#include "llvm/ADT/BitVector.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
class MemoryBuffer;
-class CodeGenCoverage {
+class LLVM_ABI CodeGenCoverage {
protected:
BitVector RuleCoverage;
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 5d60bb64bbb205..2c685c5dc5950b 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -27,6 +27,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/raw_ostream.h"
@@ -65,7 +66,7 @@ namespace cl {
// that give precedence to later occurrences. If your program supports options
// that give precedence to earlier occurrences, you will need to extend this
// function to support it correctly.
-bool ParseCommandLineOptions(int argc, const char *const *argv,
+LLVM_ABI bool ParseCommandLineOptions(int argc, const char *const *argv,
StringRef Overview = "",
raw_ostream *Errs = nullptr,
const char *EnvVar = nullptr,
@@ -78,20 +79,20 @@ using VersionPrinterTy = std::function<void(raw_ostream &)>;
/// Override the default (LLVM specific) version printer used to print out the
/// version when --version is given on the command line. This allows other
/// systems using the CommandLine utilities to print their own version string.
-void SetVersionPrinter(VersionPrinterTy func);
+LLVM_ABI void SetVersionPrinter(VersionPrinterTy func);
///===---------------------------------------------------------------------===//
/// Add an extra printer to use in addition to the default one. This can be
/// called multiple times, and each time it adds a new function to the list
/// which will be called after the basic LLVM version printing is complete.
/// Each can then add additional information specific to the tool.
-void AddExtraVersionPrinter(VersionPrinterTy func);
+LLVM_ABI void AddExtraVersionPrinter(VersionPrinterTy func);
// Print option values.
// With -print-options print the difference between option values and defaults.
// With -print-all-options print all option values.
// (Currently not perfect, but best-effort.)
-void PrintOptionValues();
+LLVM_ABI void PrintOptionValues();
// Forward declaration - AddLiteralOption needs to be up here to make gcc happy.
class Option;
@@ -103,7 +104,7 @@ class Option;
///
/// Literal options are used by some parsers to register special option values.
/// This is how the PassNameParser registers pass names for opt.
-void AddLiteralOption(Option &O, StringRef Name);
+LLVM_ABI void AddLiteralOption(Option &O, StringRef Name);
//===----------------------------------------------------------------------===//
// Flags permitted to be passed to command line arguments
@@ -176,7 +177,7 @@ enum MiscFlags { // Miscellaneous flags to adjust argument
//===----------------------------------------------------------------------===//
//
-class OptionCategory {
+class LLVM_ABI OptionCategory {
private:
StringRef const Name;
StringRef const Description;
@@ -195,11 +196,11 @@ class OptionCategory {
};
// The general Option Category (used as default category).
-OptionCategory &getGeneralCategory();
+LLVM_ABI OptionCategory &getGeneralCategory();
//===----------------------------------------------------------------------===//
//
-class SubCommand {
+class LLVM_ABI SubCommand {
private:
StringRef Name;
StringRef Description;
@@ -247,7 +248,7 @@ class SubCommandGroup {
//===----------------------------------------------------------------------===//
//
-class Option {
+class LLVM_ABI Option {
friend class alias;
// Overriden by subclasses to handle the value passed into an argument. Should
@@ -529,7 +530,7 @@ callback(F CB) {
//===----------------------------------------------------------------------===//
// Support value comparison outside the template.
-struct GenericOptionValue {
+struct LLVM_ABI GenericOptionValue {
virtual bool compare(const GenericOptionValue &V) const = 0;
protected:
@@ -636,7 +637,7 @@ struct OptionValue final
// Other safe-to-copy-by-value common option types.
enum boolOrDefault { BOU_UNSET, BOU_TRUE, BOU_FALSE };
template <>
-struct OptionValue<cl::boolOrDefault> final
+struct LLVM_ABI OptionValue<cl::boolOrDefault> final
: OptionValueCopy<cl::boolOrDefault> {
using WrapperType = cl::boolOrDefault;
@@ -654,7 +655,7 @@ struct OptionValue<cl::boolOrDefault> final
};
template <>
-struct OptionValue<std::string> final : OptionValueCopy<std::string> {
+struct LLVM_ABI OptionValue<std::string> final : OptionValueCopy<std::string> {
using WrapperType = StringRef;
OptionValue() = default;
@@ -724,7 +725,7 @@ template <typename... OptsTy> ValuesClass values(OptsTy... Options) {
// every instance of the generic parser. This also allows us to put stuff into
// CommandLine.cpp
//
-class generic_parser_base {
+class LLVM_ABI generic_parser_base {
protected:
class GenericOptionInfo {
public:
@@ -890,7 +891,7 @@ template <class DataType> class parser : public generic_parser_base {
//--------------------------------------------------
// Super class of parsers to provide boilerplate code
//
-class basic_parser_impl { // non-template implementation of basic_parser<t>
+class LLVM_ABI basic_parser_impl { // non-template implementation of basic_parser<t>
public:
basic_parser_impl(Option &) {}
@@ -939,9 +940,9 @@ template <class DataType> class basic_parser : public basic_parser_impl {
//--------------------------------------------------
-extern template class basic_parser<bool>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<bool>;
-template <> class parser<bool> : public basic_parser<bool> {
+template <> class LLVM_ABI parser<bool> : public basic_parser<bool> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -966,9 +967,9 @@ template <> class parser<bool> : public basic_parser<bool> {
//--------------------------------------------------
-extern template class basic_parser<boolOrDefault>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<boolOrDefault>;
-template <> class parser<boolOrDefault> : public basic_parser<boolOrDefault> {
+template <> class LLVM_ABI parser<boolOrDefault> : public basic_parser<boolOrDefault> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -991,9 +992,9 @@ template <> class parser<boolOrDefault> : public basic_parser<boolOrDefault> {
//--------------------------------------------------
-extern template class basic_parser<int>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<int>;
-template <> class parser<int> : public basic_parser<int> {
+template <> class LLVM_ABI parser<int> : public basic_parser<int> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1012,9 +1013,9 @@ template <> class parser<int> : public basic_parser<int> {
//--------------------------------------------------
-extern template class basic_parser<long>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<long>;
-template <> class parser<long> final : public basic_parser<long> {
+template <> class LLVM_ABI parser<long> final : public basic_parser<long> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1033,9 +1034,9 @@ template <> class parser<long> final : public basic_parser<long> {
//--------------------------------------------------
-extern template class basic_parser<long long>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<long long>;
-template <> class parser<long long> : public basic_parser<long long> {
+template <> class LLVM_ABI parser<long long> : public basic_parser<long long> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1054,9 +1055,9 @@ template <> class parser<long long> : public basic_parser<long long> {
//--------------------------------------------------
-extern template class basic_parser<unsigned>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<unsigned>;
-template <> class parser<unsigned> : public basic_parser<unsigned> {
+template <> class LLVM_ABI parser<unsigned> : public basic_parser<unsigned> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1075,10 +1076,10 @@ template <> class parser<unsigned> : public basic_parser<unsigned> {
//--------------------------------------------------
-extern template class basic_parser<unsigned long>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<unsigned long>;
template <>
-class parser<unsigned long> final : public basic_parser<unsigned long> {
+class LLVM_ABI parser<unsigned long> final : public basic_parser<unsigned long> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1097,10 +1098,10 @@ class parser<unsigned long> final : public basic_parser<unsigned long> {
//--------------------------------------------------
-extern template class basic_parser<unsigned long long>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<unsigned long long>;
template <>
-class parser<unsigned long long> : public basic_parser<unsigned long long> {
+class LLVM_ABI parser<unsigned long long> : public basic_parser<unsigned long long> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1120,9 +1121,9 @@ class parser<unsigned long long> : public basic_parser<unsigned long long> {
//--------------------------------------------------
-extern template class basic_parser<double>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<double>;
-template <> class parser<double> : public basic_parser<double> {
+template <> class LLVM_ABI parser<double> : public basic_parser<double> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1141,9 +1142,9 @@ template <> class parser<double> : public basic_parser<double> {
//--------------------------------------------------
-extern template class basic_parser<float>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<float>;
-template <> class parser<float> : public basic_parser<float> {
+template <> class LLVM_ABI parser<float> : public basic_parser<float> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1162,9 +1163,9 @@ template <> class parser<float> : public basic_parser<float> {
//--------------------------------------------------
-extern template class basic_parser<std::string>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<std::string>;
-template <> class parser<std::string> : public basic_parser<std::string> {
+template <> class LLVM_ABI parser<std::string> : public basic_parser<std::string> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1186,9 +1187,9 @@ template <> class parser<std::string> : public basic_parser<std::string> {
//--------------------------------------------------
-extern template class basic_parser<char>;
+extern template class LLVM_TEMPLATE_ABI basic_parser<char>;
-template <> class parser<char> : public basic_parser<char> {
+template <> class LLVM_ABI parser<char> : public basic_parser<char> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1510,11 +1511,11 @@ class opt
[](const typename ParserClass::parser_data_type &) {};
};
-extern template class opt<unsigned>;
-extern template class opt<int>;
-extern template class opt<std::string>;
-extern template class opt<char>;
-extern template class opt<bool>;
+extern template class LLVM_TEMPLATE_ABI opt<unsigned>;
+extern template class LLVM_TEMPLATE_ABI opt<int>;
+extern template class LLVM_TEMPLATE_ABI opt<std::string>;
+extern template class LLVM_TEMPLATE_ABI opt<char>;
+extern template class LLVM_TEMPLATE_ABI opt<bool>;
//===----------------------------------------------------------------------===//
// Default storage class definition: external storage. This implementation
@@ -1910,7 +1911,7 @@ class bits : public Option, public bits_storage<DataType, Storage> {
// Aliased command line option (alias this name to a preexisting name)
//
-class alias : public Option {
+class LLVM_ABI alias : public Option {
Option *AliasFor;
bool handleOccurrence(unsigned pos, StringRef /*ArgName*/,
@@ -1980,30 +1981,30 @@ struct aliasopt {
// Provide additional help at the end of the normal help 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_ABI extrahelp {
StringRef morehelp;
explicit extrahelp(StringRef help);
};
-void PrintVersionMessage();
+LLVM_ABI void PrintVersionMessage();
/// This function just prints the help message, exactly the same way as if the
/// -help or -help-hidden option had been given on the command line.
///
/// \param Hidden if true will print hidden options
/// \param Categorized if true print options in categories
-void PrintHelpMessage(bool Hidden = false, bool Categorized = false);
+LLVM_ABI void PrintHelpMessage(bool Hidden = false, bool Categorized = false);
/// An array of optional enabled settings in the LLVM build configuration,
/// which may be of interest to compiler developers. For example, includes
/// "+assertions" if assertions are enabled. Used by printBuildConfig.
-ArrayRef<StringRef> getCompilerBuildConfig();
+LLVM_ABI ArrayRef<StringRef> getCompilerBuildConfig();
/// Prints the compiler build configuration.
/// Designed for compiler developers, not compiler end-users.
/// Intended to be used in --version output when enabled.
-void printBuildConfig(raw_ostream &OS);
+LLVM_ABI void printBuildConfig(raw_ostream &OS);
//===----------------------------------------------------------------------===//
// Public interface for accessing registered options.
@@ -2036,7 +2037,7 @@ void printBuildConfig(raw_ostream &OS);
/// Hopefully this API can be deprecated soon. Any situation where options need
/// to be modified by tools or libraries should be handled by sane APIs rather
/// than just handing around a global list.
-StringMap<Option *> &
+LLVM_ABI StringMap<Option *> &
getRegisteredOptions(SubCommand &Sub = SubCommand::getTopLevel());
/// Use this to get all registered SubCommands from the provided parser.
@@ -2058,7 +2059,7 @@ getRegisteredOptions(SubCommand &Sub = SubCommand::getTopLevel());
///
/// This interface is useful for defining subcommands in libraries and
/// the dispatch from a single point (like in the main function).
-iterator_range<typename SmallPtrSet<SubCommand *, 4>::iterator>
+LLVM_ABI iterator_range<typename SmallPtrSet<SubCommand *, 4>::iterator>
getRegisteredSubcommands();
//===----------------------------------------------------------------------===//
@@ -2077,7 +2078,7 @@ getRegisteredSubcommands();
/// \param [in] MarkEOLs true if tokenizing a response file and you want end of
/// lines and end of the response file to be marked with a nullptr string.
/// \param [out] NewArgv All parsed strings are appended to NewArgv.
-void TokenizeGNUCommandLine(StringRef Source, StringSaver &Saver,
+LLVM_ABI void TokenizeGNUCommandLine(StringRef Source, StringSaver &Saver,
SmallVectorImpl<const char *> &NewArgv,
bool MarkEOLs = false);
@@ -2095,7 +2096,7 @@ void TokenizeGNUCommandLine(StringRef Source, StringSaver &Saver,
/// \param [in] MarkEOLs true if tokenizing a response file and you want end of
/// lines and end of the response file to be marked with a nullptr string.
/// \param [out] NewArgv All parsed strings are appended to NewArgv.
-void TokenizeWindowsCommandLine(StringRef Source, StringSaver &Saver,
+LLVM_ABI void TokenizeWindowsCommandLine(StringRef Source, StringSaver &Saver,
SmallVectorImpl<const char *> &NewArgv,
bool MarkEOLs = false);
@@ -2103,7 +2104,7 @@ void TokenizeWindowsCommandLine(StringRef Source, StringSaver &Saver,
/// quoting or escaping was used, this produces substrings of the original
/// string. If a token requires unquoting, it will be allocated with the
/// StringSaver.
-void TokenizeWindowsCommandLineNoCopy(StringRef Source, StringSaver &Saver,
+LLVM_ABI void TokenizeWindowsCommandLineNoCopy(StringRef Source, StringSaver &Saver,
SmallVectorImpl<StringRef> &NewArgv);
/// Tokenizes a Windows full command line, including command name at the start.
@@ -2119,7 +2120,7 @@ void TokenizeWindowsCommandLineNoCopy(StringRef Source, StringSaver &Saver,
/// if you set MarkEOLs = true, then the first word of every line will be
/// parsed using the special rules for command names, making this function
/// suitable for parsing a file full of commands to execute.
-void TokenizeWindowsCommandLineFull(StringRef Source, StringSaver &Saver,
+LLVM_ABI void TokenizeWindowsCommandLineFull(StringRef Source, StringSaver &Saver,
SmallVectorImpl<const char *> &NewArgv,
bool MarkEOLs = false);
@@ -2138,12 +2139,12 @@ using TokenizerCallback = void (*)(StringRef Source, StringSaver &Saver,
///
/// It works like TokenizeGNUCommandLine with ability to skip comment lines.
///
-void tokenizeConfigFile(StringRef Source, StringSaver &Saver,
+LLVM_ABI void tokenizeConfigFile(StringRef Source, StringSaver &Saver,
SmallVectorImpl<const char *> &NewArgv,
bool MarkEOLs = false);
/// Contains options that control response file expansion.
-class ExpansionContext {
+class LLVM_ABI ExpansionContext {
/// Provides persistent storage for parsed strings.
StringSaver Saver;
@@ -2233,19 +2234,19 @@ class ExpansionContext {
/// environment variable EnvVar and command line options, then expands
/// response files recursively.
/// \return true if all @files were expanded successfully or there were none.
-bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar,
+LLVM_ABI bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar,
SmallVectorImpl<const char *> &NewArgv);
/// A convenience helper which supports the typical use case of expansion
/// function call.
-bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
+LLVM_ABI bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
SmallVectorImpl<const char *> &Argv);
/// A convenience helper which concatenates the options specified by the
/// environment variable EnvVar and command line options, then expands response
/// files recursively. The tokenizer is a predefined GNU or Windows one.
/// \return true if all @files were expanded successfully or there were none.
-bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar,
+LLVM_ABI bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar,
StringSaver &Saver,
SmallVectorImpl<const char *> &NewArgv);
@@ -2256,7 +2257,7 @@ bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar,
/// Some tools (like clang-format) like to be able to hide all options that are
/// not specific to the tool. This function allows a tool to specify a single
/// option category to display in the -help output.
-void HideUnrelatedOptions(cl::OptionCategory &Category,
+LLVM_ABI void HideUnrelatedOptions(cl::OptionCategory &Category,
SubCommand &Sub = SubCommand::getTopLevel());
/// Mark all options not part of the categories as cl::ReallyHidden.
@@ -2266,22 +2267,22 @@ void HideUnrelatedOptions(cl::OptionCategory &Category,
/// Some tools (like clang-format) like to be able to hide all options that are
/// not specific to the tool. This function allows a tool to specify a single
/// option category to display in the -help output.
-void HideUnrelatedOptions(ArrayRef<const cl::OptionCategory *> Categories,
+LLVM_ABI void HideUnrelatedOptions(ArrayRef<const cl::OptionCategory *> Categories,
SubCommand &Sub = SubCommand::getTopLevel());
/// Reset all command line options to a state that looks as if they have
/// never appeared on the command line. This is useful for being able to parse
/// a command line multiple times (especially useful for writing tests).
-void ResetAllOptionOccurrences();
+LLVM_ABI void ResetAllOptionOccurrences();
/// Reset the command line parser back to its initial state. This
/// removes
/// all options, categories, and subcommands and returns the parser to a state
/// where no options are supported.
-void ResetCommandLineParser();
+LLVM_ABI void ResetCommandLineParser();
/// Parses `Arg` into the option handler `Handler`.
-bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i);
+LLVM_ABI bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i);
} // end namespace cl
diff --git a/llvm/include/llvm/Support/Compression.h b/llvm/include/llvm/Support/Compression.h
index 2a8da9e96d356f..96dc6504ea1e4d 100644
--- a/llvm/include/llvm/Support/Compression.h
+++ b/llvm/include/llvm/Support/Compression.h
@@ -14,6 +14,7 @@
#define LLVM_SUPPORT_COMPRESSION_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
namespace llvm {
@@ -38,16 +39,16 @@ constexpr int BestSpeedCompression = 1;
constexpr int DefaultCompression = 6;
constexpr int BestSizeCompression = 9;
-bool isAvailable();
+LLVM_ABI bool isAvailable();
-void compress(ArrayRef<uint8_t> Input,
+LLVM_ABI void compress(ArrayRef<uint8_t> Input,
SmallVectorImpl<uint8_t> &CompressedBuffer,
int Level = DefaultCompression);
-Error decompress(ArrayRef<uint8_t> Input, uint8_t *Output,
+LLVM_ABI Error decompress(ArrayRef<uint8_t> Input, uint8_t *Output,
size_t &UncompressedSize);
-Error decompress(ArrayRef<uint8_t> Input, SmallVectorImpl<uint8_t> &Output,
+LLVM_ABI Error decompress(ArrayRef<uint8_t> Input, SmallVectorImpl<uint8_t> &Output,
size_t UncompressedSize);
} // End of namespace zlib
@@ -59,16 +60,16 @@ constexpr int BestSpeedCompression = 1;
constexpr int DefaultCompression = 5;
constexpr int BestSizeCompression = 12;
-bool isAvailable();
+LLVM_ABI bool isAvailable();
-void compress(ArrayRef<uint8_t> Input,
+LLVM_ABI void compress(ArrayRef<uint8_t> Input,
SmallVectorImpl<uint8_t> &CompressedBuffer,
int Level = DefaultCompression, bool EnableLdm = false);
-Error decompress(ArrayRef<uint8_t> Input, uint8_t *Output,
+LLVM_ABI Error decompress(ArrayRef<uint8_t> Input, uint8_t *Output,
size_t &UncompressedSize);
-Error decompress(ArrayRef<uint8_t> Input, SmallVectorImpl<uint8_t> &Output,
+LLVM_ABI Error decompress(ArrayRef<uint8_t> Input, SmallVectorImpl<uint8_t> &Output,
size_t UncompressedSize);
} // End of namespace zstd
@@ -109,19 +110,19 @@ struct Params {
// Return nullptr if LLVM was built with support (LLVM_ENABLE_ZLIB,
// LLVM_ENABLE_ZSTD) for the specified compression format; otherwise
// return a string literal describing the reason.
-const char *getReasonIfUnsupported(Format F);
+LLVM_ABI const char *getReasonIfUnsupported(Format F);
// Compress Input with the specified format P.Format. If Level is -1, use
// *::DefaultCompression for the format.
-void compress(Params P, ArrayRef<uint8_t> Input,
+LLVM_ABI void compress(Params P, ArrayRef<uint8_t> Input,
SmallVectorImpl<uint8_t> &Output);
// Decompress Input. The uncompressed size must be available.
-Error decompress(DebugCompressionType T, ArrayRef<uint8_t> Input,
+LLVM_ABI Error decompress(DebugCompressionType T, ArrayRef<uint8_t> Input,
uint8_t *Output, size_t UncompressedSize);
-Error decompress(Format F, ArrayRef<uint8_t> Input,
+LLVM_ABI Error decompress(Format F, ArrayRef<uint8_t> Input,
SmallVectorImpl<uint8_t> &Output, size_t UncompressedSize);
-Error decompress(DebugCompressionType T, ArrayRef<uint8_t> Input,
+LLVM_ABI Error decompress(DebugCompressionType T, ArrayRef<uint8_t> Input,
SmallVectorImpl<uint8_t> &Output, size_t UncompressedSize);
} // End of namespace compression
diff --git a/llvm/include/llvm/Support/ConvertEBCDIC.h b/llvm/include/llvm/Support/ConvertEBCDIC.h
index ea761b31e022b7..30d98a837886db 100644
--- a/llvm/include/llvm/Support/ConvertEBCDIC.h
+++ b/llvm/include/llvm/Support/ConvertEBCDIC.h
@@ -15,14 +15,15 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include <system_error>
namespace llvm {
namespace ConverterEBCDIC {
-std::error_code convertToEBCDIC(StringRef Source,
+LLVM_ABI std::error_code convertToEBCDIC(StringRef Source,
SmallVectorImpl<char> &Result);
-void convertToUTF8(StringRef Source, SmallVectorImpl<char> &Result);
+LLVM_ABI void convertToUTF8(StringRef Source, SmallVectorImpl<char> &Result);
} // namespace ConverterEBCDIC
} // namespace llvm
diff --git a/llvm/include/llvm/Support/ConvertUTF.h b/llvm/include/llvm/Support/ConvertUTF.h
index c892bb3c03cb56..234e859d0fc2fa 100644
--- a/llvm/include/llvm/Support/ConvertUTF.h
+++ b/llvm/include/llvm/Support/ConvertUTF.h
@@ -105,6 +105,7 @@
#ifndef LLVM_SUPPORT_CONVERTUTF_H
#define LLVM_SUPPORT_CONVERTUTF_H
+#include "llvm/Support/Compiler.h"
#include <cstddef>
#include <string>
@@ -157,7 +158,7 @@ typedef enum {
lenientConversion
} ConversionFlags;
-ConversionResult ConvertUTF8toUTF16 (
+LLVM_ABI ConversionResult ConvertUTF8toUTF16 (
const UTF8** sourceStart, const UTF8* sourceEnd,
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
@@ -165,7 +166,7 @@ ConversionResult ConvertUTF8toUTF16 (
* Convert a partial UTF8 sequence to UTF32. If the sequence ends in an
* incomplete code unit sequence, returns \c sourceExhausted.
*/
-ConversionResult ConvertUTF8toUTF32Partial(
+LLVM_ABI ConversionResult ConvertUTF8toUTF32Partial(
const UTF8** sourceStart, const UTF8* sourceEnd,
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
@@ -173,33 +174,33 @@ ConversionResult ConvertUTF8toUTF32Partial(
* Convert a partial UTF8 sequence to UTF32. If the sequence ends in an
* incomplete code unit sequence, returns \c sourceIllegal.
*/
-ConversionResult ConvertUTF8toUTF32(
+LLVM_ABI ConversionResult ConvertUTF8toUTF32(
const UTF8** sourceStart, const UTF8* sourceEnd,
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
-ConversionResult ConvertUTF16toUTF8 (
+LLVM_ABI ConversionResult ConvertUTF16toUTF8 (
const UTF16** sourceStart, const UTF16* sourceEnd,
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-ConversionResult ConvertUTF32toUTF8 (
+LLVM_ABI ConversionResult ConvertUTF32toUTF8 (
const UTF32** sourceStart, const UTF32* sourceEnd,
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-ConversionResult ConvertUTF16toUTF32 (
+LLVM_ABI ConversionResult ConvertUTF16toUTF32 (
const UTF16** sourceStart, const UTF16* sourceEnd,
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
-ConversionResult ConvertUTF32toUTF16 (
+LLVM_ABI ConversionResult ConvertUTF32toUTF16 (
const UTF32** sourceStart, const UTF32* sourceEnd,
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
-Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
+LLVM_ABI Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
-Boolean isLegalUTF8String(const UTF8 **source, const UTF8 *sourceEnd);
+LLVM_ABI Boolean isLegalUTF8String(const UTF8 **source, const UTF8 *sourceEnd);
-unsigned getUTF8SequenceSize(const UTF8 *source, const UTF8 *sourceEnd);
+LLVM_ABI unsigned getUTF8SequenceSize(const UTF8 *source, const UTF8 *sourceEnd);
-unsigned getNumBytesForUTF8(UTF8 firstByte);
+LLVM_ABI unsigned getNumBytesForUTF8(UTF8 firstByte);
/*************************************************************************/
/* Below are LLVM-specific wrappers of the functions above. */
@@ -217,26 +218,26 @@ class StringRef;
* the first character which could not be converted.
* \return true on success.
*/
-bool ConvertUTF8toWide(unsigned WideCharWidth, llvm::StringRef Source,
+LLVM_ABI bool ConvertUTF8toWide(unsigned WideCharWidth, llvm::StringRef Source,
char *&ResultPtr, const UTF8 *&ErrorPtr);
/**
* Converts a UTF-8 StringRef to a std::wstring.
* \return true on success.
*/
-bool ConvertUTF8toWide(llvm::StringRef Source, std::wstring &Result);
+LLVM_ABI bool ConvertUTF8toWide(llvm::StringRef Source, std::wstring &Result);
/**
* Converts a UTF-8 C-string to a std::wstring.
* \return true on success.
*/
-bool ConvertUTF8toWide(const char *Source, std::wstring &Result);
+LLVM_ABI bool ConvertUTF8toWide(const char *Source, std::wstring &Result);
/**
* Converts a std::wstring to a UTF-8 encoded std::string.
* \return true on success.
*/
-bool convertWideToUTF8(const std::wstring &Source, std::string &Result);
+LLVM_ABI bool convertWideToUTF8(const std::wstring &Source, std::string &Result);
/**
@@ -249,7 +250,7 @@ bool convertWideToUTF8(const std::wstring &Source, std::string &Result);
*
* \returns true on success.
*/
-bool ConvertCodePointToUTF8(unsigned Source, char *&ResultPtr);
+LLVM_ABI bool ConvertCodePointToUTF8(unsigned Source, char *&ResultPtr);
/**
* Convert the first UTF8 sequence in the given source buffer to a UTF32
@@ -282,7 +283,7 @@ inline ConversionResult convertUTF8Sequence(const UTF8 **source,
* Returns true if a blob of text starts with a UTF-16 big or little endian byte
* order mark.
*/
-bool hasUTF16ByteOrderMark(ArrayRef<char> SrcBytes);
+LLVM_ABI bool hasUTF16ByteOrderMark(ArrayRef<char> SrcBytes);
/**
* Converts a stream of raw bytes assumed to be UTF16 into a UTF8 std::string.
@@ -291,7 +292,7 @@ bool hasUTF16ByteOrderMark(ArrayRef<char> SrcBytes);
* \param [out] Out Converted UTF-8 is stored here on success.
* \returns true on success
*/
-bool convertUTF16ToUTF8String(ArrayRef<char> SrcBytes, std::string &Out);
+LLVM_ABI bool convertUTF16ToUTF8String(ArrayRef<char> SrcBytes, std::string &Out);
/**
* Converts a UTF16 string into a UTF8 std::string.
@@ -300,7 +301,7 @@ bool convertUTF16ToUTF8String(ArrayRef<char> SrcBytes, std::string &Out);
* \param [out] Out Converted UTF-8 is stored here on success.
* \returns true on success
*/
-bool convertUTF16ToUTF8String(ArrayRef<UTF16> Src, std::string &Out);
+LLVM_ABI bool convertUTF16ToUTF8String(ArrayRef<UTF16> Src, std::string &Out);
/**
* Converts a stream of raw bytes assumed to be UTF32 into a UTF8 std::string.
@@ -309,7 +310,7 @@ bool convertUTF16ToUTF8String(ArrayRef<UTF16> Src, std::string &Out);
* \param [out] Out Converted UTF-8 is stored here on success.
* \returns true on success
*/
-bool convertUTF32ToUTF8String(ArrayRef<char> SrcBytes, std::string &Out);
+LLVM_ABI bool convertUTF32ToUTF8String(ArrayRef<char> SrcBytes, std::string &Out);
/**
* Converts a UTF32 string into a UTF8 std::string.
@@ -318,26 +319,26 @@ bool convertUTF32ToUTF8String(ArrayRef<char> SrcBytes, std::string &Out);
* \param [out] Out Converted UTF-8 is stored here on success.
* \returns true on success
*/
-bool convertUTF32ToUTF8String(ArrayRef<UTF32> Src, std::string &Out);
+LLVM_ABI bool convertUTF32ToUTF8String(ArrayRef<UTF32> Src, std::string &Out);
/**
* Converts a UTF-8 string into a UTF-16 string with native endianness.
*
* \returns true on success
*/
-bool convertUTF8ToUTF16String(StringRef SrcUTF8,
+LLVM_ABI bool convertUTF8ToUTF16String(StringRef SrcUTF8,
SmallVectorImpl<UTF16> &DstUTF16);
#if defined(_WIN32)
namespace sys {
namespace windows {
-std::error_code UTF8ToUTF16(StringRef utf8, SmallVectorImpl<wchar_t> &utf16);
+LLVM_ABI std::error_code UTF8ToUTF16(StringRef utf8, SmallVectorImpl<wchar_t> &utf16);
/// Convert to UTF16 from the current code page used in the system
-std::error_code CurCPToUTF16(StringRef utf8, SmallVectorImpl<wchar_t> &utf16);
-std::error_code UTF16ToUTF8(const wchar_t *utf16, size_t utf16_len,
+LLVM_ABI std::error_code CurCPToUTF16(StringRef utf8, SmallVectorImpl<wchar_t> &utf16);
+LLVM_ABI std::error_code UTF16ToUTF8(const wchar_t *utf16, size_t utf16_len,
SmallVectorImpl<char> &utf8);
/// Convert from UTF16 to the current code page used in the system
-std::error_code UTF16ToCurCP(const wchar_t *utf16, size_t utf16_len,
+LLVM_ABI std::error_code UTF16ToCurCP(const wchar_t *utf16, size_t utf16_len,
SmallVectorImpl<char> &utf8);
} // namespace windows
} // namespace sys
diff --git a/llvm/include/llvm/Support/CrashRecoveryContext.h b/llvm/include/llvm/Support/CrashRecoveryContext.h
index 26ddf97b3ef02e..73a842fad34ebe 100644
--- a/llvm/include/llvm/Support/CrashRecoveryContext.h
+++ b/llvm/include/llvm/Support/CrashRecoveryContext.h
@@ -10,6 +10,7 @@
#define LLVM_SUPPORT_CRASHRECOVERYCONTEXT_H
#include "llvm/ADT/STLFunctionalExtras.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
class CrashRecoveryContextCleanup;
@@ -43,7 +44,7 @@ class CrashRecoveryContextCleanup;
/// To assist recovery the class allows specifying set of actions that will be
/// executed in any case, whether crash occurs or not. These actions may be used
/// to reclaim resources in the case of crash.
-class CrashRecoveryContext {
+class LLVM_ABI CrashRecoveryContext {
void *Impl = nullptr;
CrashRecoveryContextCleanup *head = nullptr;
@@ -124,7 +125,7 @@ class CrashRecoveryContext {
///
/// Cleanup handlers are stored in a double list, which is owned and managed by
/// a crash recovery context.
-class CrashRecoveryContextCleanup {
+class LLVM_ABI CrashRecoveryContextCleanup {
protected:
CrashRecoveryContext *context = nullptr;
CrashRecoveryContextCleanup(CrashRecoveryContext *context)
diff --git a/llvm/include/llvm/Support/DJB.h b/llvm/include/llvm/Support/DJB.h
index 8a04a324a5dc6c..f36eaaf40e9601 100644
--- a/llvm/include/llvm/Support/DJB.h
+++ b/llvm/include/llvm/Support/DJB.h
@@ -14,6 +14,7 @@
#define LLVM_SUPPORT_DJB_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -26,7 +27,7 @@ inline uint32_t djbHash(StringRef Buffer, uint32_t H = 5381) {
/// Computes the Bernstein hash after folding the input according to the Dwarf 5
/// standard case folding rules.
-uint32_t caseFoldingDjbHash(StringRef Buffer, uint32_t H = 5381);
+LLVM_ABI uint32_t caseFoldingDjbHash(StringRef Buffer, uint32_t H = 5381);
} // namespace llvm
#endif // LLVM_SUPPORT_DJB_H
diff --git a/llvm/include/llvm/Support/DataExtractor.h b/llvm/include/llvm/Support/DataExtractor.h
index f4f5905d4bccd6..27d29e99844db7 100644
--- a/llvm/include/llvm/Support/DataExtractor.h
+++ b/llvm/include/llvm/Support/DataExtractor.h
@@ -10,6 +10,7 @@
#define LLVM_SUPPORT_DATAEXTRACTOR_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Error.h"
@@ -38,7 +39,7 @@ inline uint24_t getSwappedBytes(uint24_t C) {
return uint24_t(C.Bytes[2], C.Bytes[1], C.Bytes[0]);
}
-class DataExtractor {
+class LLVM_ABI DataExtractor {
StringRef Data;
uint8_t IsLittleEndian;
uint8_t AddressSize;
diff --git a/llvm/include/llvm/Support/Debug.h b/llvm/include/llvm/Support/Debug.h
index 3e2f0d9b43fc0d..3c4f6d5eb310bb 100644
--- a/llvm/include/llvm/Support/Debug.h
+++ b/llvm/include/llvm/Support/Debug.h
@@ -28,6 +28,7 @@
#ifndef LLVM_SUPPORT_DEBUG_H
#define LLVM_SUPPORT_DEBUG_H
+#include "llvm/Support/Compiler.h"
namespace llvm {
class raw_ostream;
@@ -38,19 +39,19 @@ class raw_ostream;
/// specified on the command line, or if none was specified on the command line
/// with the -debug-only=X option.
///
-bool isCurrentDebugType(const char *Type);
+LLVM_ABI bool isCurrentDebugType(const char *Type);
/// setCurrentDebugType - Set the current debug type, as if the -debug-only=X
/// option were specified. Note that DebugFlag also needs to be set to true for
/// debug output to be produced.
///
-void setCurrentDebugType(const char *Type);
+LLVM_ABI void setCurrentDebugType(const char *Type);
/// setCurrentDebugTypes - Set the current debug type, as if the
/// -debug-only=X,Y,Z option were specified. Note that DebugFlag
/// also needs to be set to true for debug output to be produced.
///
-void setCurrentDebugTypes(const char **Types, unsigned Count);
+LLVM_ABI void setCurrentDebugTypes(const char **Types, unsigned Count);
/// DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug
/// information. If the '-debug' option is specified on the commandline, and if
@@ -76,7 +77,7 @@ void setCurrentDebugTypes(const char **Types, unsigned Count);
/// is specified. This should probably not be referenced directly, instead, use
/// the DEBUG macro below.
///
-extern bool DebugFlag;
+LLVM_ABI extern bool DebugFlag;
/// EnableDebugBuffering - This defaults to false. If true, the debug
/// stream will install signal handlers to dump any buffered debug
@@ -84,12 +85,12 @@ extern bool DebugFlag;
/// to install signal handlers if they are certain there will be no
/// conflict.
///
-extern bool EnableDebugBuffering;
+LLVM_ABI extern bool EnableDebugBuffering;
/// dbgs() - This returns a reference to a raw_ostream for debugging
/// messages. If debugging is disabled it returns errs(). Use it
/// like: dbgs() << "foo" << "bar";
-raw_ostream &dbgs();
+LLVM_ABI raw_ostream &dbgs();
// DEBUG macro - This macro should be used by passes to emit debug information.
// If the '-debug' option is specified on the commandline, and if this is a
diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h
index e4345e5739e99d..60e129e52dba19 100644
--- a/llvm/include/llvm/Support/DebugCounter.h
+++ b/llvm/include/llvm/Support/DebugCounter.h
@@ -46,6 +46,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/UniqueVector.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include <string>
@@ -53,9 +54,9 @@ namespace llvm {
class raw_ostream;
-class DebugCounter {
+class LLVM_ABI DebugCounter {
public:
- struct Chunk {
+ struct LLVM_ABI Chunk {
int64_t Begin;
int64_t End;
void print(llvm::raw_ostream &OS);
diff --git a/llvm/include/llvm/Support/DivisionByConstantInfo.h b/llvm/include/llvm/Support/DivisionByConstantInfo.h
index caa0b35e714475..96474bce0f7864 100644
--- a/llvm/include/llvm/Support/DivisionByConstantInfo.h
+++ b/llvm/include/llvm/Support/DivisionByConstantInfo.h
@@ -14,18 +14,19 @@
#define LLVM_SUPPORT_DIVISIONBYCONSTANTINFO_H
#include "llvm/ADT/APInt.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
/// Magic data for optimising signed division by a constant.
-struct SignedDivisionByConstantInfo {
+struct LLVM_ABI SignedDivisionByConstantInfo {
static SignedDivisionByConstantInfo get(const APInt &D);
APInt Magic; ///< magic number
unsigned ShiftAmount; ///< shift amount
};
/// Magic data for optimising unsigned division by a constant.
-struct UnsignedDivisionByConstantInfo {
+struct LLVM_ABI UnsignedDivisionByConstantInfo {
static UnsignedDivisionByConstantInfo
get(const APInt &D, unsigned LeadingZeros = 0,
bool AllowEvenDivisorOptimization = true);
diff --git a/llvm/include/llvm/Support/DynamicLibrary.h b/llvm/include/llvm/Support/DynamicLibrary.h
index 94ee08c5938a05..3a6e320ea7b4fb 100644
--- a/llvm/include/llvm/Support/DynamicLibrary.h
+++ b/llvm/include/llvm/Support/DynamicLibrary.h
@@ -13,6 +13,7 @@
#ifndef LLVM_SUPPORT_DYNAMICLIBRARY_H
#define LLVM_SUPPORT_DYNAMICLIBRARY_H
+#include "llvm/Support/Compiler.h"
#include <string>
namespace llvm {
@@ -30,7 +31,7 @@ namespace sys {
/// It also allows for symbols to be defined which don't live in any library,
/// but rather the main program itself, useful on Windows where the main
/// executable cannot be searched.
-class DynamicLibrary {
+class LLVM_ABI DynamicLibrary {
// Placeholder whose address represents an invalid library.
// We use this instead of NULL or a pointer-int pair because the OS library
// might define 0 or 1 to be "special" handles, such as "search all".
diff --git a/llvm/include/llvm/Support/ELFAttributeParser.h b/llvm/include/llvm/Support/ELFAttributeParser.h
index ffb92468fb37eb..210892f6bee0ac 100644
--- a/llvm/include/llvm/Support/ELFAttributeParser.h
+++ b/llvm/include/llvm/Support/ELFAttributeParser.h
@@ -11,6 +11,7 @@
#include "ELFAttributes.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Error.h"
@@ -21,7 +22,7 @@ namespace llvm {
class StringRef;
class ScopedPrinter;
-class ELFAttributeParser {
+class LLVM_ABI ELFAttributeParser {
StringRef vendor;
std::unordered_map<unsigned, unsigned> attributes;
std::unordered_map<unsigned, StringRef> attributesStr;
diff --git a/llvm/include/llvm/Support/ELFAttributes.h b/llvm/include/llvm/Support/ELFAttributes.h
index 295d0f46698124..6b16731a8f5621 100644
--- a/llvm/include/llvm/Support/ELFAttributes.h
+++ b/llvm/include/llvm/Support/ELFAttributes.h
@@ -11,6 +11,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
namespace llvm {
@@ -26,9 +27,9 @@ namespace ELFAttrs {
enum AttrType : unsigned { File = 1, Section = 2, Symbol = 3 };
-StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap,
+LLVM_ABI StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap,
bool hasTagPrefix = true);
-std::optional<unsigned> attrTypeFromString(StringRef tag, TagNameMap tagNameMap);
+LLVM_ABI std::optional<unsigned> attrTypeFromString(StringRef tag, TagNameMap tagNameMap);
// Magic numbers for ELF attributes.
enum AttrMagic { Format_Version = 0x41 };
diff --git a/llvm/include/llvm/Support/Errno.h b/llvm/include/llvm/Support/Errno.h
index e095c66b908600..64817257141bbc 100644
--- a/llvm/include/llvm/Support/Errno.h
+++ b/llvm/include/llvm/Support/Errno.h
@@ -13,6 +13,7 @@
#ifndef LLVM_SUPPORT_ERRNO_H
#define LLVM_SUPPORT_ERRNO_H
+#include "llvm/Support/Compiler.h"
#include <cerrno>
#include <string>
@@ -23,10 +24,10 @@ namespace sys {
/// thread-safe variant of strerror() is available. Be sure to call this
/// immediately after the function that set errno, or errno may have been
/// overwritten by an intervening call.
-std::string StrError();
+LLVM_ABI std::string StrError();
/// Like the no-argument version above, but uses \p errnum instead of errno.
-std::string StrError(int errnum);
+LLVM_ABI std::string StrError(int errnum);
template <typename FailT, typename Fun, typename... Args>
inline decltype(auto) RetryAfterSignal(const FailT &Fail, const Fun &F,
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index cb06ac19f0bb7d..d9a492ed3529c2 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -42,7 +42,7 @@ class ErrorSuccess;
/// Base class for error info classes. Do not extend this directly: Extend
/// the ErrorInfo template subclass instead.
-class ErrorInfoBase {
+class LLVM_ABI ErrorInfoBase {
public:
virtual ~ErrorInfoBase() = default;
@@ -157,7 +157,7 @@ class ErrorInfoBase {
/// *All* Error instances must be checked before destruction, even if
/// they're moved-assigned or constructed from Success values that have already
/// been checked. This enforces checking through all levels of the call stack.
-class [[nodiscard]] Error {
+class LLVM_ABI [[nodiscard]] Error {
// ErrorList needs to be able to yank ErrorInfoBase pointers out of Errors
// to add to the error list. It can't rely on handleErrors for this, since
// handleErrors does not support ErrorList handlers.
@@ -367,7 +367,7 @@ class ErrorInfo : public ParentErrT {
/// Special ErrorInfo subclass representing a list of ErrorInfos.
/// Instances of this class are constructed by joinError.
-class ErrorList final : public ErrorInfo<ErrorList> {
+class LLVM_ABI ErrorList final : public ErrorInfo<ErrorList> {
// handleErrors needs to be able to iterate the payload list of an
// ErrorList.
template <typename... HandlerTs>
@@ -738,7 +738,7 @@ template <class T> class [[nodiscard]] Expected {
/// Report a serious error, calling any installed error handler. See
/// ErrorHandling.h.
-[[noreturn]] void report_fatal_error(Error Err, bool gen_crash_diag = true);
+[[noreturn]] void LLVM_ABI report_fatal_error(Error Err, bool gen_crash_diag = true);
/// Report a fatal error if Err is a failure value.
///
@@ -1049,15 +1049,15 @@ Expected<T> handleExpected(Expected<T> ValOrErr, RecoveryFtor &&RecoveryPath,
/// This is useful in the base level of your program to allow clean termination
/// (allowing clean deallocation of resources, etc.), while reporting error
/// information to the user.
-void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner = {});
+LLVM_ABI void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner = {});
/// Write all error messages (if any) in E to a string. The newline character
/// is used to separate error messages.
-std::string toString(Error E);
+LLVM_ABI std::string toString(Error E);
/// Like toString(), but does not consume the error. This can be used to print
/// a warning while retaining the original error object.
-std::string toStringWithoutConsuming(const Error &E);
+LLVM_ABI std::string toStringWithoutConsuming(const Error &E);
/// Consume a Error without doing anything. This method should be used
/// only where an error can be considered a reasonable and expected return
@@ -1171,8 +1171,8 @@ class ExpectedAsOutParameter {
/// This is useful if you're writing an interface that returns a Error
/// (or Expected) and you want to call code that still returns
/// std::error_codes.
-class ECError : public ErrorInfo<ECError> {
- friend Error errorCodeToError(std::error_code);
+class LLVM_ABI ECError : public ErrorInfo<ECError> {
+ friend LLVM_ABI Error errorCodeToError(std::error_code);
void anchor() override;
@@ -1197,16 +1197,16 @@ class ECError : public ErrorInfo<ECError> {
/// sensible conversion to std::error_code is available, as attempts to convert
/// to/from this error will result in a fatal error. (i.e. it is a programmatic
/// error to try to convert such a value).
-std::error_code inconvertibleErrorCode();
+LLVM_ABI std::error_code inconvertibleErrorCode();
/// Helper for converting an std::error_code to a Error.
-Error errorCodeToError(std::error_code EC);
+LLVM_ABI Error errorCodeToError(std::error_code EC);
/// Helper for converting an ECError to a std::error_code.
///
/// This method requires that Err be Error() or an ECError, otherwise it
/// will trigger a call to abort().
-std::error_code errorToErrorCode(Error Err);
+LLVM_ABI std::error_code errorToErrorCode(Error Err);
/// Helper to get errno as an std::error_code.
///
@@ -1260,7 +1260,7 @@ template <typename T> ErrorOr<T> expectedToErrorOr(Expected<T> &&E) {
/// }
/// @endcode
///
-class StringError : public ErrorInfo<StringError> {
+class LLVM_ABI StringError : public ErrorInfo<StringError> {
public:
static char ID;
@@ -1290,7 +1290,7 @@ inline Error createStringError(std::error_code EC, char const *Fmt,
return make_error<StringError>(Buffer, EC);
}
-Error createStringError(std::string &&Msg, std::error_code EC);
+LLVM_ABI Error createStringError(std::string &&Msg, std::error_code EC);
inline Error createStringError(std::error_code EC, const char *S) {
return createStringError(std::string(S), EC);
@@ -1320,7 +1320,7 @@ inline Error createStringError(std::errc EC, char const *Fmt,
///
/// In some cases, an error needs to live along a 'source' name, in order to
/// show more detailed information to the user.
-class FileError final : public ErrorInfo<FileError> {
+class LLVM_ABI FileError final : public ErrorInfo<FileError> {
friend Error createFileError(const Twine &, Error);
friend Error createFileError(const Twine &, size_t, Error);
diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h
index 9c8e3448f3a03e..602189d534f6de 100644
--- a/llvm/include/llvm/Support/ErrorHandling.h
+++ b/llvm/include/llvm/Support/ErrorHandling.h
@@ -41,11 +41,11 @@ namespace llvm {
///
/// \param user_data - An argument which will be passed to the install error
/// handler.
- void install_fatal_error_handler(fatal_error_handler_t handler,
+ LLVM_ABI void install_fatal_error_handler(fatal_error_handler_t handler,
void *user_data = nullptr);
/// Restores default error handling behaviour.
- void remove_fatal_error_handler();
+ LLVM_ABI void remove_fatal_error_handler();
/// ScopedFatalErrorHandler - This is a simple helper class which just
/// calls install_fatal_error_handler in its constructor and
@@ -68,11 +68,11 @@ namespace llvm {
/// After the error handler is called this function will call abort(), it
/// does not return.
/// NOTE: The std::string variant was removed to avoid a <string> dependency.
-[[noreturn]] void report_fatal_error(const char *reason,
+[[noreturn]] void LLVM_ABI report_fatal_error(const char *reason,
bool gen_crash_diag = true);
-[[noreturn]] void report_fatal_error(StringRef reason,
+[[noreturn]] void LLVM_ABI report_fatal_error(StringRef reason,
bool gen_crash_diag = true);
-[[noreturn]] void report_fatal_error(const Twine &reason,
+[[noreturn]] void LLVM_ABI report_fatal_error(const Twine &reason,
bool gen_crash_diag = true);
/// Installs a new bad alloc error handler that should be used whenever a
@@ -91,13 +91,13 @@ namespace llvm {
///
/// \param user_data - An argument which will be passed to the installed error
/// handler.
-void install_bad_alloc_error_handler(fatal_error_handler_t handler,
+LLVM_ABI void install_bad_alloc_error_handler(fatal_error_handler_t handler,
void *user_data = nullptr);
/// Restores default bad alloc error handling behavior.
-void remove_bad_alloc_error_handler();
+LLVM_ABI void remove_bad_alloc_error_handler();
-void install_out_of_memory_new_handler();
+LLVM_ABI void install_out_of_memory_new_handler();
/// Reports a bad alloc error, calling any user defined bad alloc
/// error handler. In contrast to the generic 'report_fatal_error'
@@ -111,14 +111,14 @@ void install_out_of_memory_new_handler();
/// If no error handler is installed (default), throws a bad_alloc exception
/// if LLVM is compiled with exception support. Otherwise prints the error
/// to standard error and calls abort().
-[[noreturn]] void report_bad_alloc_error(const char *Reason,
+[[noreturn]] void LLVM_ABI report_bad_alloc_error(const char *Reason,
bool GenCrashDiag = true);
/// This function calls abort(), and prints the optional message to stderr.
/// Use the llvm_unreachable macro (that adds location info), instead of
/// calling this function directly.
[[noreturn]] void
-llvm_unreachable_internal(const char *msg = nullptr, const char *file = nullptr,
+LLVM_ABI llvm_unreachable_internal(const char *msg = nullptr, const char *file = nullptr,
unsigned line = 0);
}
diff --git a/llvm/include/llvm/Support/ExponentialBackoff.h b/llvm/include/llvm/Support/ExponentialBackoff.h
index 8208a748eac2a6..86faf6aa79e4d9 100644
--- a/llvm/include/llvm/Support/ExponentialBackoff.h
+++ b/llvm/include/llvm/Support/ExponentialBackoff.h
@@ -13,6 +13,7 @@
#define LLVM_EXPONENTIALBACKOFF_H
#include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include <chrono>
#include <random>
@@ -30,7 +31,7 @@ namespace llvm {
/// } while (Backoff.waitForNextAttempt());
/// return Timeout;
/// \endcode
-class ExponentialBackoff {
+class LLVM_ABI ExponentialBackoff {
public:
using duration = std::chrono::steady_clock::duration;
using time_point = std::chrono::steady_clock::time_point;
diff --git a/llvm/include/llvm/Support/ExtensibleRTTI.h b/llvm/include/llvm/Support/ExtensibleRTTI.h
index d3193be6f529e1..adf47bc4cee3b6 100644
--- a/llvm/include/llvm/Support/ExtensibleRTTI.h
+++ b/llvm/include/llvm/Support/ExtensibleRTTI.h
@@ -60,13 +60,14 @@
#ifndef LLVM_SUPPORT_EXTENSIBLERTTI_H
#define LLVM_SUPPORT_EXTENSIBLERTTI_H
+#include "llvm/Support/Compiler.h"
namespace llvm {
/// Base class for the extensible RTTI hierarchy.
///
/// This class defines virtual methods, dynamicClassID and isA, that enable
/// type comparisons.
-class RTTIRoot {
+class LLVM_ABI RTTIRoot {
public:
virtual ~RTTIRoot() = default;
diff --git a/llvm/include/llvm/Support/FileCollector.h b/llvm/include/llvm/Support/FileCollector.h
index 232dc8658aa382..4f066d77a52c4a 100644
--- a/llvm/include/llvm/Support/FileCollector.h
+++ b/llvm/include/llvm/Support/FileCollector.h
@@ -11,6 +11,7 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSet.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/VirtualFileSystem.h"
#include <mutex>
#include <string>
@@ -19,7 +20,7 @@ namespace llvm {
class FileCollectorFileSystem;
class Twine;
-class FileCollectorBase {
+class LLVM_ABI FileCollectorBase {
public:
FileCollectorBase();
virtual ~FileCollectorBase();
@@ -66,11 +67,11 @@ class FileCollectorBase {
///
/// In order to preserve the relative topology of files we use their real paths
/// as relative paths inside of the Root.
-class FileCollector : public FileCollectorBase {
+class LLVM_ABI FileCollector : public FileCollectorBase {
public:
/// Helper utility that encapsulates the logic for canonicalizing a virtual
/// path and a path to copy from.
- class PathCanonicalizer {
+ class LLVM_ABI PathCanonicalizer {
public:
struct PathStorage {
SmallString<256> CopyFrom;
diff --git a/llvm/include/llvm/Support/FileOutputBuffer.h b/llvm/include/llvm/Support/FileOutputBuffer.h
index d4b73522115dbf..aaed4996f9d397 100644
--- a/llvm/include/llvm/Support/FileOutputBuffer.h
+++ b/llvm/include/llvm/Support/FileOutputBuffer.h
@@ -14,6 +14,7 @@
#define LLVM_SUPPORT_FILEOUTPUTBUFFER_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Error.h"
@@ -25,7 +26,7 @@ namespace llvm {
/// If the FileOutputBuffer is committed, the target file's content will become
/// the buffer content at the time of the commit. If the FileOutputBuffer is
/// not committed, the file will be deleted in the FileOutputBuffer destructor.
-class FileOutputBuffer {
+class LLVM_ABI FileOutputBuffer {
public:
enum {
/// Set the 'x' bit on the resulting file.
diff --git a/llvm/include/llvm/Support/FileSystem.h b/llvm/include/llvm/Support/FileSystem.h
index 9cf53360b4e966..cefdb21eb28cfe 100644
--- a/llvm/include/llvm/Support/FileSystem.h
+++ b/llvm/include/llvm/Support/FileSystem.h
@@ -31,6 +31,7 @@
#include "llvm/ADT/Twine.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Chrono.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ErrorOr.h"
@@ -59,7 +60,7 @@ using file_t = void *;
using file_t = int;
#endif
-extern const file_t kInvalidFile;
+LLVM_ABI extern const file_t kInvalidFile;
/// An enumeration for the file system's view of the type.
enum class file_type {
@@ -133,7 +134,7 @@ inline perms operator~(perms x) {
/// Represents the result of a call to directory_iterator::status(). This is a
/// subset of the information returned by a regular sys::fs::status() call, and
/// represents the information provided by Windows FileFirstFile/FindNextFile.
-class basic_file_status {
+class LLVM_ABI basic_file_status {
protected:
#if defined(LLVM_ON_UNIX)
time_t fs_st_atime = 0;
@@ -222,8 +223,8 @@ class basic_file_status {
};
/// Represents the result of a call to sys::fs::status().
-class file_status : public basic_file_status {
- friend bool equivalent(file_status A, file_status B);
+class LLVM_ABI file_status : public basic_file_status {
+ friend LLVM_ABI bool equivalent(file_status A, file_status B);
#if defined(LLVM_ON_UNIX)
dev_t fs_st_dev = 0;
@@ -278,7 +279,7 @@ class file_status : public basic_file_status {
/// relative/../path => <current-directory>/relative/../path
///
/// @param path A path that is modified to be an absolute path.
-void make_absolute(const Twine ¤t_directory, SmallVectorImpl<char> &path);
+LLVM_ABI void make_absolute(const Twine ¤t_directory, SmallVectorImpl<char> &path);
/// Make \a path an absolute path.
///
@@ -291,7 +292,7 @@ void make_absolute(const Twine ¤t_directory, SmallVectorImpl<char> &path);
/// @param path A path that is modified to be an absolute path.
/// @returns errc::success if \a path has been made absolute, otherwise a
/// platform-specific error_code.
-std::error_code make_absolute(SmallVectorImpl<char> &path);
+LLVM_ABI std::error_code make_absolute(SmallVectorImpl<char> &path);
/// Create all the non-existent directories in path.
///
@@ -299,7 +300,7 @@ std::error_code make_absolute(SmallVectorImpl<char> &path);
/// @returns errc::success if is_directory(path), otherwise a platform
/// specific error_code. If IgnoreExisting is false, also returns
/// error if the directory already existed.
-std::error_code create_directories(const Twine &path,
+LLVM_ABI std::error_code create_directories(const Twine &path,
bool IgnoreExisting = true,
perms Perms = owner_all | group_all);
@@ -309,7 +310,7 @@ std::error_code create_directories(const Twine &path,
/// @returns errc::success if is_directory(path), otherwise a platform
/// specific error_code. If IgnoreExisting is false, also returns
/// error if the directory already existed.
-std::error_code create_directory(const Twine &path, bool IgnoreExisting = true,
+LLVM_ABI std::error_code create_directory(const Twine &path, bool IgnoreExisting = true,
perms Perms = owner_all | group_all);
/// Create a link from \a from to \a to.
@@ -323,7 +324,7 @@ std::error_code create_directory(const Twine &path, bool IgnoreExisting = true,
/// @param from The path to hard link from. This is created.
/// @returns errc::success if the link was created, otherwise a platform
/// specific error_code.
-std::error_code create_link(const Twine &to, const Twine &from);
+LLVM_ABI std::error_code create_link(const Twine &to, const Twine &from);
/// Create a hard link from \a from to \a to, or return an error.
///
@@ -331,7 +332,7 @@ std::error_code create_link(const Twine &to, const Twine &from);
/// @param from The path to hard link from. This is created.
/// @returns errc::success if the link was created, otherwise a platform
/// specific error_code.
-std::error_code create_hard_link(const Twine &to, const Twine &from);
+LLVM_ABI std::error_code create_hard_link(const Twine &to, const Twine &from);
/// Collapse all . and .. patterns, resolve all symlinks, and optionally
/// expand ~ expressions to the user's home directory.
@@ -340,28 +341,28 @@ std::error_code create_hard_link(const Twine &to, const Twine &from);
/// @param output The location to store the resolved path.
/// @param expand_tilde If true, resolves ~ expressions to the user's home
/// directory.
-std::error_code real_path(const Twine &path, SmallVectorImpl<char> &output,
+LLVM_ABI std::error_code real_path(const Twine &path, SmallVectorImpl<char> &output,
bool expand_tilde = false);
/// Expands ~ expressions to the user's home directory. On Unix ~user
/// directories are resolved as well.
///
/// @param path The path to resolve.
-void expand_tilde(const Twine &path, SmallVectorImpl<char> &output);
+LLVM_ABI void expand_tilde(const Twine &path, SmallVectorImpl<char> &output);
/// Get the current path.
///
/// @param result Holds the current path on return.
/// @returns errc::success if the current path has been stored in result,
/// otherwise a platform-specific error_code.
-std::error_code current_path(SmallVectorImpl<char> &result);
+LLVM_ABI std::error_code current_path(SmallVectorImpl<char> &result);
/// Set the current path.
///
/// @param path The path to set.
/// @returns errc::success if the current path was successfully set,
/// otherwise a platform-specific error_code.
-std::error_code set_current_path(const Twine &path);
+LLVM_ABI std::error_code set_current_path(const Twine &path);
/// Remove path. Equivalent to POSIX remove().
///
@@ -369,14 +370,14 @@ std::error_code set_current_path(const Twine &path);
/// @returns errc::success if path has been removed or didn't exist, otherwise a
/// platform-specific error code. If IgnoreNonExisting is false, also
/// returns error if the file didn't exist.
-std::error_code remove(const Twine &path, bool IgnoreNonExisting = true);
+LLVM_ABI std::error_code remove(const Twine &path, bool IgnoreNonExisting = true);
/// Recursively delete a directory.
///
/// @param path Input path.
/// @returns errc::success if path has been removed or didn't exist, otherwise a
/// platform-specific error code.
-std::error_code remove_directories(const Twine &path, bool IgnoreErrors = true);
+LLVM_ABI std::error_code remove_directories(const Twine &path, bool IgnoreErrors = true);
/// Rename \a from to \a to.
///
@@ -386,19 +387,19 @@ std::error_code remove_directories(const Twine &path, bool IgnoreErrors = true);
///
/// @param from The path to rename from.
/// @param to The path to rename to. This is created.
-std::error_code rename(const Twine &from, const Twine &to);
+LLVM_ABI std::error_code rename(const Twine &from, const Twine &to);
/// Copy the contents of \a From to \a To.
///
/// @param From The path to copy from.
/// @param To The path to copy to. This is created.
-std::error_code copy_file(const Twine &From, const Twine &To);
+LLVM_ABI std::error_code copy_file(const Twine &From, const Twine &To);
/// Copy the contents of \a From to \a To.
///
/// @param From The path to copy from.
/// @param ToFD The open file descriptor of the destination file.
-std::error_code copy_file(const Twine &From, int ToFD);
+LLVM_ABI std::error_code copy_file(const Twine &From, int ToFD);
/// Resize path to size. File is resized as if by POSIX truncate().
///
@@ -406,7 +407,7 @@ std::error_code copy_file(const Twine &From, int ToFD);
/// @param Size Size to resize to.
/// @returns errc::success if \a path has been resized to \a size, otherwise a
/// platform-specific error_code.
-std::error_code resize_file(int FD, uint64_t Size);
+LLVM_ABI std::error_code resize_file(int FD, uint64_t Size);
/// Resize \p FD to \p Size before mapping \a mapped_file_region::readwrite. On
/// non-Windows, this calls \a resize_file(). On Windows, this is a no-op,
@@ -428,10 +429,10 @@ inline std::error_code resize_file_before_mapping_readwrite(int FD,
/// @param FD Input file descriptor.
/// @returns An MD5Result with the hash computed, if successful, otherwise a
/// std::error_code.
-ErrorOr<MD5::MD5Result> md5_contents(int FD);
+LLVM_ABI ErrorOr<MD5::MD5Result> md5_contents(int FD);
/// Version of compute_md5 that doesn't require an open file descriptor.
-ErrorOr<MD5::MD5Result> md5_contents(const Twine &Path);
+LLVM_ABI ErrorOr<MD5::MD5Result> md5_contents(const Twine &Path);
/// @}
/// @name Physical Observers
@@ -442,7 +443,7 @@ ErrorOr<MD5::MD5Result> md5_contents(const Twine &Path);
/// @param status A basic_file_status previously returned from stat.
/// @returns True if the file represented by status exists, false if it does
/// not.
-bool exists(const basic_file_status &status);
+LLVM_ABI bool exists(const basic_file_status &status);
enum class AccessMode { Exist, Write, Execute };
@@ -451,7 +452,7 @@ enum class AccessMode { Exist, Write, Execute };
/// @param Path Input path.
/// @returns errc::success if the path can be accessed, otherwise a
/// platform-specific error_code.
-std::error_code access(const Twine &Path, AccessMode Mode);
+LLVM_ABI std::error_code access(const Twine &Path, AccessMode Mode);
/// Does file exist?
///
@@ -465,7 +466,7 @@ inline bool exists(const Twine &Path) {
///
/// @param Path Input path.
/// @returns True if we can execute it, false otherwise.
-bool can_execute(const Twine &Path);
+LLVM_ABI bool can_execute(const Twine &Path);
/// Can we write this file?
///
@@ -484,7 +485,7 @@ inline bool can_write(const Twine &Path) {
///
/// @returns True if A and B both represent the same file system entity, false
/// otherwise.
-bool equivalent(file_status A, file_status B);
+LLVM_ABI bool equivalent(file_status A, file_status B);
/// Do paths represent the same thing?
///
@@ -496,7 +497,7 @@ bool equivalent(file_status A, file_status B);
/// inode (or equivalent).
/// @returns errc::success if result has been successfully set, otherwise a
/// platform-specific error_code.
-std::error_code equivalent(const Twine &A, const Twine &B, bool &result);
+LLVM_ABI std::error_code equivalent(const Twine &A, const Twine &B, bool &result);
/// Simpler version of equivalent for clients that don't need to
/// differentiate between an error and false.
@@ -512,10 +513,10 @@ inline bool equivalent(const Twine &A, const Twine &B) {
/// false if it is not.
/// @returns errc::success if result has been successfully set, otherwise a
/// platform specific error_code.
-std::error_code is_local(const Twine &path, bool &result);
+LLVM_ABI std::error_code is_local(const Twine &path, bool &result);
/// Version of is_local accepting an open file descriptor.
-std::error_code is_local(int FD, bool &result);
+LLVM_ABI std::error_code is_local(int FD, bool &result);
/// Simpler version of is_local for clients that don't need to
/// differentiate between an error and false.
@@ -537,13 +538,13 @@ inline bool is_local(int FD) {
/// @param Follow For symbolic links, indicates whether to return the file type
/// of the link itself, or of the target.
/// @returns A value from the file_type enumeration indicating the type of file.
-file_type get_file_type(const Twine &Path, bool Follow = true);
+LLVM_ABI file_type get_file_type(const Twine &Path, bool Follow = true);
/// Does status represent a directory?
///
/// @param status A basic_file_status previously returned from status.
/// @returns status.type() == file_type::directory_file.
-bool is_directory(const basic_file_status &status);
+LLVM_ABI bool is_directory(const basic_file_status &status);
/// Is path a directory?
///
@@ -552,7 +553,7 @@ bool is_directory(const basic_file_status &status);
/// symlinks, false if it is not. Undefined otherwise.
/// @returns errc::success if result has been successfully set, otherwise a
/// platform-specific error_code.
-std::error_code is_directory(const Twine &path, bool &result);
+LLVM_ABI std::error_code is_directory(const Twine &path, bool &result);
/// Simpler version of is_directory for clients that don't need to
/// differentiate between an error and false.
@@ -565,7 +566,7 @@ inline bool is_directory(const Twine &Path) {
///
/// @param status A basic_file_status previously returned from status.
/// @returns status_known(status) && status.type() == file_type::regular_file.
-bool is_regular_file(const basic_file_status &status);
+LLVM_ABI bool is_regular_file(const basic_file_status &status);
/// Is path a regular file?
///
@@ -574,7 +575,7 @@ bool is_regular_file(const basic_file_status &status);
/// symlinks), false if it is not. Undefined otherwise.
/// @returns errc::success if result has been successfully set, otherwise a
/// platform-specific error_code.
-std::error_code is_regular_file(const Twine &path, bool &result);
+LLVM_ABI std::error_code is_regular_file(const Twine &path, bool &result);
/// Simpler version of is_regular_file for clients that don't need to
/// differentiate between an error and false.
@@ -589,7 +590,7 @@ inline bool is_regular_file(const Twine &Path) {
///
/// @param status A basic_file_status previously returned from status.
/// @returns status_known(status) && status.type() == file_type::symlink_file.
-bool is_symlink_file(const basic_file_status &status);
+LLVM_ABI bool is_symlink_file(const basic_file_status &status);
/// Is path a symlink file?
///
@@ -598,7 +599,7 @@ bool is_symlink_file(const basic_file_status &status);
/// Undefined otherwise.
/// @returns errc::success if result has been successfully set, otherwise a
/// platform-specific error_code.
-std::error_code is_symlink_file(const Twine &path, bool &result);
+LLVM_ABI std::error_code is_symlink_file(const Twine &path, bool &result);
/// Simpler version of is_symlink_file for clients that don't need to
/// differentiate between an error and false.
@@ -614,7 +615,7 @@ inline bool is_symlink_file(const Twine &Path) {
///
/// @param status A basic_file_status previously returned from status.
/// @returns exists(s) && !is_regular_file(s) && !is_directory(s)
-bool is_other(const basic_file_status &status);
+LLVM_ABI bool is_other(const basic_file_status &status);
/// Is path something that exists but is not a directory,
/// regular file, or symlink?
@@ -624,7 +625,7 @@ bool is_other(const basic_file_status &status);
/// file, or a symlink, false if it does not. Undefined otherwise.
/// @returns errc::success if result has been successfully set, otherwise a
/// platform-specific error_code.
-std::error_code is_other(const Twine &path, bool &result);
+LLVM_ABI std::error_code is_other(const Twine &path, bool &result);
/// Get file status as if by POSIX stat().
///
@@ -634,15 +635,15 @@ std::error_code is_other(const Twine &path, bool &result);
/// statted.
/// @returns errc::success if result has been successfully set, otherwise a
/// platform-specific error_code.
-std::error_code status(const Twine &path, file_status &result,
+LLVM_ABI std::error_code status(const Twine &path, file_status &result,
bool follow = true);
/// A version for when a file descriptor is already available.
-std::error_code status(int FD, file_status &Result);
+LLVM_ABI std::error_code status(int FD, file_status &Result);
#ifdef _WIN32
/// A version for when a file descriptor is already available.
-std::error_code status(file_t FD, file_status &Result);
+LLVM_ABI std::error_code status(file_t FD, file_status &Result);
#endif
/// Get file creation mode mask of the process.
@@ -651,7 +652,7 @@ std::error_code status(file_t FD, file_status &Result);
/// @note There is no umask on Windows. This function returns 0 always
/// on Windows. This function does not return an error_code because
/// umask(2) never fails. It is not thread safe.
-unsigned getUmask();
+LLVM_ABI unsigned getUmask();
/// Set file permissions.
///
@@ -662,12 +663,12 @@ unsigned getUmask();
/// @note On Windows, all permissions except *_write are ignored. Using any of
/// owner_write, group_write, or all_write will make the file writable.
/// Otherwise, the file will be marked as read-only.
-std::error_code setPermissions(const Twine &Path, perms Permissions);
+LLVM_ABI std::error_code setPermissions(const Twine &Path, perms Permissions);
/// Vesion of setPermissions accepting a file descriptor.
/// TODO Delete the path based overload once we implement the FD based overload
/// on Windows.
-std::error_code setPermissions(int FD, perms Permissions);
+LLVM_ABI std::error_code setPermissions(int FD, perms Permissions);
/// Get file permissions.
///
@@ -677,7 +678,7 @@ std::error_code setPermissions(int FD, perms Permissions);
/// @note On Windows, if the file does not have the FILE_ATTRIBUTE_READONLY
/// attribute, all_all will be returned. Otherwise, all_read | all_exe
/// will be returned.
-ErrorOr<perms> getPermissions(const Twine &Path);
+LLVM_ABI ErrorOr<perms> getPermissions(const Twine &Path);
/// Get file size.
///
@@ -699,7 +700,7 @@ inline std::error_code file_size(const Twine &Path, uint64_t &Result) {
/// @returns errc::success if the file times were successfully set, otherwise a
/// platform-specific error_code or errc::function_not_supported on
/// platforms where the functionality isn't available.
-std::error_code setLastAccessAndModificationTime(int FD, TimePoint<> AccessTime,
+LLVM_ABI std::error_code setLastAccessAndModificationTime(int FD, TimePoint<> AccessTime,
TimePoint<> ModificationTime);
/// Simpler version that sets both file modification and access time to the same
@@ -713,7 +714,7 @@ inline std::error_code setLastAccessAndModificationTime(int FD,
///
/// @param s Input file status.
/// @returns True if status() != status_error.
-bool status_known(const basic_file_status &s);
+LLVM_ABI bool status_known(const basic_file_status &s);
/// Is status available?
///
@@ -721,7 +722,7 @@ bool status_known(const basic_file_status &s);
/// @param result Set to true if status() != status_error.
/// @returns errc::success if result has been successfully set, otherwise a
/// platform-specific error_code.
-std::error_code status_known(const Twine &path, bool &result);
+LLVM_ABI std::error_code status_known(const Twine &path, bool &result);
enum CreationDisposition : unsigned {
/// CD_CreateAlways - When opening a file:
@@ -800,7 +801,7 @@ enum OpenFlags : unsigned {
/// @param Model Name to base unique path off of.
/// @param ResultPath Set to the file's path.
/// @param MakeAbsolute Whether to use the system temp directory.
-void createUniquePath(const Twine &Model, SmallVectorImpl<char> &ResultPath,
+LLVM_ABI void createUniquePath(const Twine &Model, SmallVectorImpl<char> &ResultPath,
bool MakeAbsolute);
/// Create a uniquely named file.
@@ -826,14 +827,14 @@ void createUniquePath(const Twine &Model, SmallVectorImpl<char> &ResultPath,
/// @param Mode Set to the opened file's permissions.
/// @returns errc::success if Result{FD,Path} have been successfully set,
/// otherwise a platform-specific error_code.
-std::error_code createUniqueFile(const Twine &Model, int &ResultFD,
+LLVM_ABI std::error_code createUniqueFile(const Twine &Model, int &ResultFD,
SmallVectorImpl<char> &ResultPath,
OpenFlags Flags = OF_None,
unsigned Mode = all_read | all_write);
/// Simpler version for clients that don't want an open file. An empty
/// file will still be created.
-std::error_code createUniqueFile(const Twine &Model,
+LLVM_ABI std::error_code createUniqueFile(const Twine &Model,
SmallVectorImpl<char> &ResultPath,
unsigned Mode = all_read | all_write);
@@ -844,7 +845,7 @@ std::error_code createUniqueFile(const Twine &Model,
///
/// The destructor doesn't implicitly discard because there is no way to
/// properly handle errors in a destructor.
-class TempFile {
+class LLVM_ABI TempFile {
bool Done = false;
TempFile(StringRef Name, int FD);
@@ -889,18 +890,18 @@ class TempFile {
///
/// This should be used for things like a temporary .s that is removed after
/// running the assembler.
-std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix,
+LLVM_ABI std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix,
int &ResultFD,
SmallVectorImpl<char> &ResultPath,
OpenFlags Flags = OF_None);
/// Simpler version for clients that don't want an open file. An empty
/// file will still be created.
-std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix,
+LLVM_ABI std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix,
SmallVectorImpl<char> &ResultPath,
OpenFlags Flags = OF_None);
-std::error_code createUniqueDirectory(const Twine &Prefix,
+LLVM_ABI std::error_code createUniqueDirectory(const Twine &Prefix,
SmallVectorImpl<char> &ResultPath);
/// Get a unique name, not currently exisiting in the filesystem. Subject
@@ -910,7 +911,7 @@ std::error_code createUniqueDirectory(const Twine &Prefix,
/// checks if it exists. This function is subject to race conditions, if you
/// want to use the returned name to actually create a file, use
/// createUniqueFile instead.
-std::error_code getPotentiallyUniqueFileName(const Twine &Model,
+LLVM_ABI std::error_code getPotentiallyUniqueFileName(const Twine &Model,
SmallVectorImpl<char> &ResultPath);
/// Get a unique temporary file name, not currently exisiting in the
@@ -921,7 +922,7 @@ std::error_code getPotentiallyUniqueFileName(const Twine &Model,
/// checks if it exists. This function is subject to race conditions, if you
/// want to use the returned name to actually create a file, use
/// createTemporaryFile instead.
-std::error_code
+LLVM_ABI std::error_code
getPotentiallyUniqueTempFileName(const Twine &Prefix, StringRef Suffix,
SmallVectorImpl<char> &ResultPath);
@@ -959,7 +960,7 @@ inline FileAccess &operator|=(FileAccess &A, FileAccess B) {
/// @param Mode The access permissions of the file, represented in octal.
/// @returns errc::success if \a Name has been opened, otherwise a
/// platform-specific error_code.
-std::error_code openFile(const Twine &Name, int &ResultFD,
+LLVM_ABI std::error_code openFile(const Twine &Name, int &ResultFD,
CreationDisposition Disp, FileAccess Access,
OpenFlags Flags, unsigned Mode = 0666);
@@ -977,14 +978,14 @@ std::error_code openFile(const Twine &Name, int &ResultFD,
/// @param Mode The access permissions of the file, represented in octal.
/// @returns errc::success if \a Name has been opened, otherwise a
/// platform-specific error_code.
-Expected<file_t> openNativeFile(const Twine &Name, CreationDisposition Disp,
+LLVM_ABI Expected<file_t> openNativeFile(const Twine &Name, CreationDisposition Disp,
FileAccess Access, OpenFlags Flags,
unsigned Mode = 0666);
/// Converts from a Posix file descriptor number to a native file handle.
/// On Windows, this retreives the underlying handle. On non-Windows, this is a
/// no-op.
-file_t convertFDToNativeFile(int FD);
+LLVM_ABI file_t convertFDToNativeFile(int FD);
#ifndef _WIN32
inline file_t convertFDToNativeFile(int FD) { return FD; }
@@ -992,15 +993,15 @@ inline file_t convertFDToNativeFile(int FD) { return FD; }
/// Return an open handle to standard in. On Unix, this is typically FD 0.
/// Returns kInvalidFile when the stream is closed.
-file_t getStdinHandle();
+LLVM_ABI file_t getStdinHandle();
/// Return an open handle to standard out. On Unix, this is typically FD 1.
/// Returns kInvalidFile when the stream is closed.
-file_t getStdoutHandle();
+LLVM_ABI file_t getStdoutHandle();
/// Return an open handle to standard error. On Unix, this is typically FD 2.
/// Returns kInvalidFile when the stream is closed.
-file_t getStderrHandle();
+LLVM_ABI file_t getStderrHandle();
/// Reads \p Buf.size() bytes from \p FileHandle into \p Buf. Returns the number
/// of bytes actually read. On Unix, this is equivalent to `return ::read(FD,
@@ -1009,7 +1010,7 @@ file_t getStderrHandle();
/// @param FileHandle File to read from.
/// @param Buf Buffer to read into.
/// @returns The number of bytes read, or error.
-Expected<size_t> readNativeFile(file_t FileHandle, MutableArrayRef<char> Buf);
+LLVM_ABI Expected<size_t> readNativeFile(file_t FileHandle, MutableArrayRef<char> Buf);
/// Default chunk size for \a readNativeFileToEOF().
enum : size_t { DefaultReadChunkSize = 4 * 4096 };
@@ -1027,7 +1028,7 @@ enum : size_t { DefaultReadChunkSize = 4 * 4096 };
/// \param Buffer Where to put the file content.
/// \param ChunkSize Size of chunks.
/// \returns The error if EOF was not found.
-Error readNativeFileToEOF(file_t FileHandle, SmallVectorImpl<char> &Buffer,
+LLVM_ABI Error readNativeFileToEOF(file_t FileHandle, SmallVectorImpl<char> &Buffer,
ssize_t ChunkSize = DefaultReadChunkSize);
/// Reads \p Buf.size() bytes from \p FileHandle at offset \p Offset into \p
@@ -1039,7 +1040,7 @@ Error readNativeFileToEOF(file_t FileHandle, SmallVectorImpl<char> &Buffer,
/// @param Buf Buffer to read into.
/// @param Offset Offset into the file at which the read should occur.
/// @returns The number of bytes read, or error.
-Expected<size_t> readNativeFileSlice(file_t FileHandle,
+LLVM_ABI Expected<size_t> readNativeFileSlice(file_t FileHandle,
MutableArrayRef<char> Buf,
uint64_t Offset);
@@ -1141,7 +1142,7 @@ inline Expected<file_t> openNativeFileForReadWrite(const Twine &Name,
/// location.
/// @returns errc::success if \a Name has been opened, otherwise a
/// platform-specific error_code.
-std::error_code openFileForRead(const Twine &Name, int &ResultFD,
+LLVM_ABI std::error_code openFileForRead(const Twine &Name, int &ResultFD,
OpenFlags Flags = OF_None,
SmallVectorImpl<char> *RealPath = nullptr);
@@ -1157,7 +1158,7 @@ std::error_code openFileForRead(const Twine &Name, int &ResultFD,
/// location.
/// @returns a platform-specific file descriptor if \a Name has been opened,
/// otherwise an error object.
-Expected<file_t>
+LLVM_ABI Expected<file_t>
openNativeFileForRead(const Twine &Name, OpenFlags Flags = OF_None,
SmallVectorImpl<char> *RealPath = nullptr);
@@ -1182,21 +1183,21 @@ openNativeFileForRead(const Twine &Name, OpenFlags Flags = OF_None,
/// context, as it may not prevent other threads in the same process from
/// obtaining a lock on the same file, even if they are using a different file
/// descriptor.
-std::error_code
+LLVM_ABI std::error_code
tryLockFile(int FD,
std::chrono::milliseconds Timeout = std::chrono::milliseconds(0));
/// Lock the file.
///
/// This function acts as @ref tryLockFile but it waits infinitely.
-std::error_code lockFile(int FD);
+LLVM_ABI std::error_code lockFile(int FD);
/// Unlock the file.
///
/// @param FD The descriptor representing the file to unlock.
/// @returns errc::success if lock is successfully released or platform-specific
/// error_code otherwise.
-std::error_code unlockFile(int FD);
+LLVM_ABI std::error_code unlockFile(int FD);
/// @brief Close the file object. This should be used instead of ::close for
/// portability. On error, the caller should assume the file is closed, as is
@@ -1207,7 +1208,7 @@ std::error_code unlockFile(int FD);
///
/// @returns An error code if closing the file failed. Typically, an error here
/// means that the filesystem may have failed to perform some buffered writes.
-std::error_code closeFile(file_t &F);
+LLVM_ABI std::error_code closeFile(file_t &F);
#ifdef LLVM_ON_UNIX
/// @brief Change ownership of a file.
@@ -1248,7 +1249,7 @@ class FileLocker {
}
};
-std::error_code getUniqueID(const Twine Path, UniqueID &Result);
+LLVM_ABI std::error_code getUniqueID(const Twine Path, UniqueID &Result);
/// Get disk space usage information.
///
@@ -1259,11 +1260,11 @@ std::error_code getUniqueID(const Twine Path, UniqueID &Result);
/// @returns a space_info structure filled with the capacity, free, and
/// available space on the device \a Path is on. A platform specific error_code
/// is returned on error.
-ErrorOr<space_info> disk_space(const Twine &Path);
+LLVM_ABI ErrorOr<space_info> disk_space(const Twine &Path);
/// This class represents a memory mapped file. It is based on
/// boost::iostreams::mapped_file.
-class mapped_file_region {
+class LLVM_ABI mapped_file_region {
public:
enum mapmode {
readonly, ///< May only access map via const_data as read only.
@@ -1341,14 +1342,14 @@ class mapped_file_region {
/// Return the path to the main executable, given the value of argv[0] from
/// program startup and the address of main itself. In extremis, this function
/// may fail and return an empty path.
-std::string getMainExecutable(const char *argv0, void *MainExecAddr);
+LLVM_ABI std::string getMainExecutable(const char *argv0, void *MainExecAddr);
/// @}
/// @name Iterators
/// @{
/// directory_entry - A single entry in a directory.
-class directory_entry {
+class LLVM_ABI directory_entry {
// FIXME: different platforms make different information available "for free"
// when traversing a directory. The design of this class wraps most of the
// information in basic_file_status, so on platforms where we can't populate
@@ -1398,9 +1399,9 @@ namespace detail {
struct DirIterState;
- std::error_code directory_iterator_construct(DirIterState &, StringRef, bool);
- std::error_code directory_iterator_increment(DirIterState &);
- std::error_code directory_iterator_destruct(DirIterState &);
+ LLVM_ABI std::error_code directory_iterator_construct(DirIterState &, StringRef, bool);
+ LLVM_ABI std::error_code directory_iterator_increment(DirIterState &);
+ LLVM_ABI std::error_code directory_iterator_destruct(DirIterState &);
/// Keeps state for the directory_iterator.
struct DirIterState {
diff --git a/llvm/include/llvm/Support/FileUtilities.h b/llvm/include/llvm/Support/FileUtilities.h
index 9707724d631708..70b1b53958a852 100644
--- a/llvm/include/llvm/Support/FileUtilities.h
+++ b/llvm/include/llvm/Support/FileUtilities.h
@@ -15,6 +15,7 @@
#define LLVM_SUPPORT_FILEUTILITIES_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
@@ -29,7 +30,7 @@ namespace llvm {
/// option, it will set the string to an error message if an error occurs, or
/// if the files are different.
///
- int DiffFilesWithTolerance(StringRef FileA,
+ LLVM_ABI int DiffFilesWithTolerance(StringRef FileA,
StringRef FileB,
double AbsTol, double RelTol,
std::string *Error = nullptr);
@@ -79,7 +80,7 @@ namespace llvm {
/// FilePermssionsApplier helps to copy permissions from an input file to
/// an output one. It memorizes the status of the input file and can apply
/// permissions and dates to the output file.
- class FilePermissionsApplier {
+ class LLVM_ABI FilePermissionsApplier {
public:
static Expected<FilePermissionsApplier> create(StringRef InputFilename);
diff --git a/llvm/include/llvm/Support/Format.h b/llvm/include/llvm/Support/Format.h
index 89b6ae35ba5de3..2553002b378994 100644
--- a/llvm/include/llvm/Support/Format.h
+++ b/llvm/include/llvm/Support/Format.h
@@ -25,6 +25,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include <cassert>
#include <cstdio>
@@ -36,7 +37,7 @@ namespace llvm {
/// This is a helper class used for handling formatted output. It is the
/// abstract base class of a templated derived class.
-class format_object_base {
+class LLVM_ABI format_object_base {
protected:
const char *Fmt;
~format_object_base() = default; // Disallow polymorphic deletion.
diff --git a/llvm/include/llvm/Support/FormatVariadic.h b/llvm/include/llvm/Support/FormatVariadic.h
index d0e647e1403bdf..1844284a9c1a70 100644
--- a/llvm/include/llvm/Support/FormatVariadic.h
+++ b/llvm/include/llvm/Support/FormatVariadic.h
@@ -30,6 +30,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/FormatCommon.h"
#include "llvm/Support/FormatProviders.h"
#include "llvm/Support/FormatVariadicDetails.h"
@@ -62,7 +63,7 @@ struct ReplacementItem {
StringRef Options;
};
-class formatv_object_base {
+class LLVM_ABI formatv_object_base {
protected:
StringRef Fmt;
ArrayRef<support::detail::format_adapter *> Adapters;
diff --git a/llvm/include/llvm/Support/FormatVariadicDetails.h b/llvm/include/llvm/Support/FormatVariadicDetails.h
index a221fcadbd3c74..b85a4f6065195c 100644
--- a/llvm/include/llvm/Support/FormatVariadicDetails.h
+++ b/llvm/include/llvm/Support/FormatVariadicDetails.h
@@ -9,8 +9,9 @@
#ifndef LLVM_SUPPORT_FORMATVARIADICDETAILS_H
#define LLVM_SUPPORT_FORMATVARIADICDETAILS_H
-#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
#include <type_traits>
@@ -21,7 +22,7 @@ class Error;
namespace support {
namespace detail {
-class format_adapter {
+class LLVM_ABI format_adapter {
virtual void anchor();
protected:
diff --git a/llvm/include/llvm/Support/FormattedStream.h b/llvm/include/llvm/Support/FormattedStream.h
index 850a18dbb94121..011a6aea238e3a 100644
--- a/llvm/include/llvm/Support/FormattedStream.h
+++ b/llvm/include/llvm/Support/FormattedStream.h
@@ -15,6 +15,7 @@
#define LLVM_SUPPORT_FORMATTEDSTREAM_H
#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
#include <utility>
@@ -27,7 +28,7 @@ namespace llvm {
/// doesn't attempt to handle everything Unicode can do (combining characters,
/// right-to-left markers, etc), but should cover the cases likely to appear in
/// source code or diagnostic messages.
-class formatted_raw_ostream : public raw_ostream {
+class LLVM_ABI formatted_raw_ostream : public raw_ostream {
/// TheStream - The real stream we output to. We set it to be
/// unbuffered, since we're already doing our own buffering.
///
@@ -206,15 +207,15 @@ class formatted_raw_ostream : public raw_ostream {
/// fouts() - This returns a reference to a formatted_raw_ostream for
/// standard output. Use it like: fouts() << "foo" << "bar";
-formatted_raw_ostream &fouts();
+LLVM_ABI formatted_raw_ostream &fouts();
/// ferrs() - This returns a reference to a formatted_raw_ostream for
/// standard error. Use it like: ferrs() << "foo" << "bar";
-formatted_raw_ostream &ferrs();
+LLVM_ABI formatted_raw_ostream &ferrs();
/// fdbgs() - This returns a reference to a formatted_raw_ostream for
/// debug output. Use it like: fdbgs() << "foo" << "bar";
-formatted_raw_ostream &fdbgs();
+LLVM_ABI formatted_raw_ostream &fdbgs();
} // end llvm namespace
diff --git a/llvm/include/llvm/Support/GlobPattern.h b/llvm/include/llvm/Support/GlobPattern.h
index eff8957d1b682e..a5418b061805f7 100644
--- a/llvm/include/llvm/Support/GlobPattern.h
+++ b/llvm/include/llvm/Support/GlobPattern.h
@@ -16,6 +16,7 @@
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include <optional>
@@ -47,7 +48,7 @@ namespace llvm {
///
/// For example, \p "*[/\\\\]foo.{c,cpp}" (with two backslashes) will match
/// (unix or windows) paths to all files named \p "foo.c" or \p "foo.cpp".
-class GlobPattern {
+class LLVM_ABI GlobPattern {
public:
/// \param Pat the pattern to match against
/// \param MaxSubPatterns if provided limit the number of allowed subpatterns
@@ -71,7 +72,7 @@ class GlobPattern {
private:
StringRef Prefix;
- struct SubGlobPattern {
+ struct LLVM_ABI SubGlobPattern {
/// \param Pat the pattern to match against
static Expected<SubGlobPattern> create(StringRef Pat);
/// \returns \p true if \p S matches this glob pattern
diff --git a/llvm/include/llvm/Support/GraphWriter.h b/llvm/include/llvm/Support/GraphWriter.h
index 359b608626dffa..fdc537e701aec4 100644
--- a/llvm/include/llvm/Support/GraphWriter.h
+++ b/llvm/include/llvm/Support/GraphWriter.h
@@ -25,6 +25,7 @@
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DOTGraphTraits.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
@@ -37,11 +38,11 @@ namespace llvm {
namespace DOT { // Private functions...
-std::string EscapeString(const std::string &Label);
+LLVM_ABI std::string EscapeString(const std::string &Label);
/// Get a color string for this node number. Simply round-robin selects
/// from a reasonable number of colors.
-StringRef getColorString(unsigned NodeNumber);
+LLVM_ABI StringRef getColorString(unsigned NodeNumber);
} // end namespace DOT
@@ -57,7 +58,7 @@ enum Name {
} // end namespace GraphProgram
-bool DisplayGraph(StringRef Filename, bool wait = true,
+LLVM_ABI bool DisplayGraph(StringRef Filename, bool wait = true,
GraphProgram::Name program = GraphProgram::DOT);
template<typename GraphType>
@@ -368,7 +369,7 @@ raw_ostream &WriteGraph(raw_ostream &O, const GraphType &G,
return O;
}
-std::string createGraphFilename(const Twine &Name, int &FD);
+LLVM_ABI std::string createGraphFilename(const Twine &Name, int &FD);
/// Writes graph into a provided @c Filename.
/// If @c Filename is empty, generates a random one.
diff --git a/llvm/include/llvm/Support/HexagonAttributeParser.h b/llvm/include/llvm/Support/HexagonAttributeParser.h
index 1116dd42b1ad01..1fd3fd6aa29101 100644
--- a/llvm/include/llvm/Support/HexagonAttributeParser.h
+++ b/llvm/include/llvm/Support/HexagonAttributeParser.h
@@ -9,11 +9,12 @@
#ifndef LLVM_SUPPORT_HEXAGONATTRIBUTEPARSER_H
#define LLVM_SUPPORT_HEXAGONATTRIBUTEPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ELFAttributeParser.h"
#include "llvm/Support/HexagonAttributes.h"
namespace llvm {
-class HexagonAttributeParser : public ELFAttributeParser {
+class LLVM_ABI HexagonAttributeParser : public ELFAttributeParser {
struct DisplayHandler {
HexagonAttrs::AttrType Attribute;
Error (HexagonAttributeParser::*Routine)(unsigned);
diff --git a/llvm/include/llvm/Support/HexagonAttributes.h b/llvm/include/llvm/Support/HexagonAttributes.h
index 8a50d8993e633b..121daefec3d350 100644
--- a/llvm/include/llvm/Support/HexagonAttributes.h
+++ b/llvm/include/llvm/Support/HexagonAttributes.h
@@ -9,12 +9,13 @@
#ifndef LLVM_SUPPORT_HEXAGONATTRIBUTES_H
#define LLVM_SUPPORT_HEXAGONATTRIBUTES_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ELFAttributes.h"
namespace llvm {
namespace HexagonAttrs {
-const TagNameMap &getHexagonAttributeTags();
+LLVM_ABI const TagNameMap &getHexagonAttributeTags();
enum AttrType : unsigned {
ARCH = 4,
diff --git a/llvm/include/llvm/Support/InitLLVM.h b/llvm/include/llvm/Support/InitLLVM.h
index 172d13bf21a558..68a7cc58a753a8 100644
--- a/llvm/include/llvm/Support/InitLLVM.h
+++ b/llvm/include/llvm/Support/InitLLVM.h
@@ -11,6 +11,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/PrettyStackTrace.h"
#include <optional>
@@ -32,7 +33,7 @@
// InitLLVM calls llvm_shutdown() on destruction, which cleans up
// ManagedStatic objects.
namespace llvm {
-class InitLLVM {
+class LLVM_ABI InitLLVM {
public:
InitLLVM(int &Argc, const char **&Argv,
bool InstallPipeSignalExitHandler = true);
diff --git a/llvm/include/llvm/Support/InstructionCost.h b/llvm/include/llvm/Support/InstructionCost.h
index ada0b8962881d3..7b1a7d81d0347a 100644
--- a/llvm/include/llvm/Support/InstructionCost.h
+++ b/llvm/include/llvm/Support/InstructionCost.h
@@ -18,6 +18,7 @@
#ifndef LLVM_SUPPORT_INSTRUCTIONCOST_H
#define LLVM_SUPPORT_INSTRUCTIONCOST_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include <limits>
#include <optional>
@@ -26,7 +27,7 @@ namespace llvm {
class raw_ostream;
-class InstructionCost {
+class LLVM_ABI InstructionCost {
public:
using CostType = int64_t;
diff --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h
index 14a5c7142ed8ce..0067d7eef485ec 100644
--- a/llvm/include/llvm/Support/JSON.h
+++ b/llvm/include/llvm/Support/JSON.h
@@ -82,11 +82,11 @@ constexpr bool is_uint_64_bit_v =
/// Returns true if \p S is valid UTF-8, which is required for use as JSON.
/// If it returns false, \p Offset is set to a byte offset near the first error.
-bool isUTF8(llvm::StringRef S, size_t *ErrOffset = nullptr);
+LLVM_ABI bool isUTF8(llvm::StringRef S, size_t *ErrOffset = nullptr);
/// Replaces invalid UTF-8 sequences in \p S with the replacement character
/// (U+FFFD). The returned string is valid UTF-8.
/// This is much slower than isUTF8, so test that first.
-std::string fixUTF8(llvm::StringRef S);
+LLVM_ABI std::string fixUTF8(llvm::StringRef S);
class Array;
class ObjectKey;
@@ -95,7 +95,7 @@ template <typename T> Value toJSON(const std::optional<T> &Opt);
/// An Object is a JSON object, which maps strings to heterogenous JSON values.
/// It simulates DenseMap<ObjectKey, Value>. ObjectKey is a maybe-owned string.
-class Object {
+class LLVM_ABI Object {
using Storage = DenseMap<ObjectKey, Value, llvm::DenseMapInfo<StringRef>>;
Storage M;
@@ -154,14 +154,14 @@ class Object {
const json::Array *getArray(StringRef K) const;
json::Array *getArray(StringRef K);
};
-bool operator==(const Object &LHS, const Object &RHS);
+LLVM_ABI bool operator==(const Object &LHS, const Object &RHS);
inline bool operator!=(const Object &LHS, const Object &RHS) {
return !(LHS == RHS);
}
/// An Array is a JSON array, which contains heterogeneous JSON values.
/// It simulates std::vector<Value>.
-class Array {
+class LLVM_ABI Array {
std::vector<Value> V;
public:
@@ -285,7 +285,7 @@ inline bool operator!=(const Array &L, const Array &R) { return !(L == R); }
/// And parsed:
/// Expected<Value> E = json::parse("[1, 2, null]");
/// assert(E && E->kind() == Value::Array);
-class Value {
+class LLVM_ABI Value {
public:
enum Kind {
Null,
@@ -523,10 +523,10 @@ class Value {
llvm::StringRef, std::string, json::Array,
json::Object>
Union;
- friend bool operator==(const Value &, const Value &);
+ friend LLVM_ABI bool operator==(const Value &, const Value &);
};
-bool operator==(const Value &, const Value &);
+LLVM_ABI bool operator==(const Value &, const Value &);
inline bool operator!=(const Value &L, const Value &R) { return !(L == R); }
// Array Methods
@@ -647,12 +647,12 @@ inline bool Object::erase(StringRef K) {
return M.erase(ObjectKey(K));
}
-std::vector<const Object::value_type *> sortedElements(const Object &O);
+LLVM_ABI std::vector<const Object::value_type *> sortedElements(const Object &O);
/// A "cursor" marking a position within a Value.
/// The Value is a tree, and this is the path from the root to the current node.
/// This is used to associate errors with particular subobjects.
-class Path {
+class LLVM_ABI Path {
public:
class Root;
@@ -699,7 +699,7 @@ class Path {
/// The root is the trivial Path to the root value.
/// It also stores the latest reported error and the path where it occurred.
-class Path::Root {
+class LLVM_ABI Path::Root {
llvm::StringRef Name;
llvm::StringLiteral ErrorMessage;
std::vector<Path::Segment> ErrorPath; // Only valid in error state. Reversed.
@@ -890,9 +890,9 @@ class ObjectMapper {
/// Parses the provided JSON source, or returns a ParseError.
/// The returned Value is self-contained and owns its strings (they do not refer
/// to the original source).
-llvm::Expected<Value> parse(llvm::StringRef JSON);
+LLVM_ABI llvm::Expected<Value> parse(llvm::StringRef JSON);
-class ParseError : public llvm::ErrorInfo<ParseError> {
+class LLVM_ABI ParseError : public llvm::ErrorInfo<ParseError> {
const char *Msg;
unsigned Line, Column, Offset;
@@ -976,7 +976,7 @@ Expected<T> parse(const llvm::StringRef &JSON, const char *RootName = "") {
/// This can be mismatched begin()/end() pairs, trying to emit attributes inside
/// an array, and so on.
/// With asserts disabled, this is undefined behavior.
-class OStream {
+class LLVM_ABI OStream {
public:
using Block = llvm::function_ref<void()>;
// If IndentSize is nonzero, output is pretty-printed.
@@ -1095,7 +1095,7 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Value &V) {
/// Allow printing json::Value with formatv().
/// The default style is basic/compact formatting, like operator<<.
/// A format string like formatv("{0:2}", Value) pretty-prints with indent 2.
-template <> struct format_provider<llvm::json::Value> {
+template <> struct LLVM_ABI format_provider<llvm::json::Value> {
static void format(const llvm::json::Value &, raw_ostream &, StringRef);
};
} // namespace llvm
diff --git a/llvm/include/llvm/Support/KnownBits.h b/llvm/include/llvm/Support/KnownBits.h
index a4b554fa2a0b72..1a6ab37b8471f2 100644
--- a/llvm/include/llvm/Support/KnownBits.h
+++ b/llvm/include/llvm/Support/KnownBits.h
@@ -15,12 +15,13 @@
#define LLVM_SUPPORT_KNOWNBITS_H
#include "llvm/ADT/APInt.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
namespace llvm {
// Struct for tracking the known zeros and ones of a value.
-struct KnownBits {
+struct LLVM_ABI KnownBits {
APInt Zero;
APInt One;
diff --git a/llvm/include/llvm/Support/LEB128.h b/llvm/include/llvm/Support/LEB128.h
index a15b73bc14dcde..ce789cc49f295b 100644
--- a/llvm/include/llvm/Support/LEB128.h
+++ b/llvm/include/llvm/Support/LEB128.h
@@ -14,6 +14,7 @@
#ifndef LLVM_SUPPORT_LEB128_H
#define LLVM_SUPPORT_LEB128_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
@@ -221,10 +222,10 @@ inline uint64_t decodeULEB128AndIncUnsafe(const uint8_t *&p) {
}
/// Utility function to get the size of the ULEB128-encoded value.
-extern unsigned getULEB128Size(uint64_t Value);
+LLVM_ABI extern unsigned getULEB128Size(uint64_t Value);
/// Utility function to get the size of the SLEB128-encoded value.
-extern unsigned getSLEB128Size(int64_t Value);
+LLVM_ABI extern unsigned getSLEB128Size(int64_t Value);
} // namespace llvm
diff --git a/llvm/include/llvm/Support/LineIterator.h b/llvm/include/llvm/Support/LineIterator.h
index fc6871baf99a65..fe484c19408167 100644
--- a/llvm/include/llvm/Support/LineIterator.h
+++ b/llvm/include/llvm/Support/LineIterator.h
@@ -10,6 +10,7 @@
#define LLVM_SUPPORT_LINEITERATOR_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/MemoryBufferRef.h"
#include <iterator>
@@ -30,7 +31,7 @@ class MemoryBuffer;
/// character.
///
/// Note that this iterator requires the buffer to be nul terminated.
-class line_iterator {
+class LLVM_ABI line_iterator {
std::optional<MemoryBufferRef> Buffer;
char CommentMarker = '\0';
bool SkipBlanks = true;
diff --git a/llvm/include/llvm/Support/Locale.h b/llvm/include/llvm/Support/Locale.h
index f7a2c036ed5e11..e865dfb70de55c 100644
--- a/llvm/include/llvm/Support/Locale.h
+++ b/llvm/include/llvm/Support/Locale.h
@@ -1,14 +1,15 @@
#ifndef LLVM_SUPPORT_LOCALE_H
#define LLVM_SUPPORT_LOCALE_H
+#include "llvm/Support/Compiler.h"
namespace llvm {
class StringRef;
namespace sys {
namespace locale {
-int columnWidth(StringRef s);
-bool isPrint(int c);
+LLVM_ABI int columnWidth(StringRef s);
+LLVM_ABI bool isPrint(int c);
}
}
diff --git a/llvm/include/llvm/Support/LockFileManager.h b/llvm/include/llvm/Support/LockFileManager.h
index 92c7ceed6a929f..b5ecd1aaf892b8 100644
--- a/llvm/include/llvm/Support/LockFileManager.h
+++ b/llvm/include/llvm/Support/LockFileManager.h
@@ -9,6 +9,7 @@
#define LLVM_SUPPORT_LOCKFILEMANAGER_H
#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
#include <system_error>
#include <utility> // for std::pair
@@ -24,7 +25,7 @@ class StringRef;
/// system to ensure that only a single process can create that ".lock" file.
/// When the lock file is removed, the owning process has finished the
/// operation.
-class LockFileManager {
+class LLVM_ABI LockFileManager {
public:
/// Describes the state of a lock file.
enum LockFileState {
diff --git a/llvm/include/llvm/Support/MD5.h b/llvm/include/llvm/Support/MD5.h
index 0e9f22d3bfdb46..1dcff32554f11d 100644
--- a/llvm/include/llvm/Support/MD5.h
+++ b/llvm/include/llvm/Support/MD5.h
@@ -29,6 +29,7 @@
#define LLVM_SUPPORT_MD5_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Endian.h"
#include <array>
#include <cstdint>
@@ -38,9 +39,9 @@ namespace llvm {
template <unsigned N> class SmallString;
template <typename T> class ArrayRef;
-class MD5 {
+class LLVM_ABI MD5 {
public:
- struct MD5Result : public std::array<uint8_t, 16> {
+ struct LLVM_ABI MD5Result : public std::array<uint8_t, 16> {
SmallString<32> digest() const;
uint64_t low() const {
diff --git a/llvm/include/llvm/Support/MSP430AttributeParser.h b/llvm/include/llvm/Support/MSP430AttributeParser.h
index bc9b214944708f..a0a2cf7d3c87f0 100644
--- a/llvm/include/llvm/Support/MSP430AttributeParser.h
+++ b/llvm/include/llvm/Support/MSP430AttributeParser.h
@@ -14,11 +14,12 @@
#ifndef LLVM_SUPPORT_MSP430ATTRIBUTEPARSER_H
#define LLVM_SUPPORT_MSP430ATTRIBUTEPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ELFAttributeParser.h"
#include "llvm/Support/MSP430Attributes.h"
namespace llvm {
-class MSP430AttributeParser : public ELFAttributeParser {
+class LLVM_ABI MSP430AttributeParser : public ELFAttributeParser {
struct DisplayHandler {
MSP430Attrs::AttrType Attribute;
Error (MSP430AttributeParser::*Routine)(MSP430Attrs::AttrType);
diff --git a/llvm/include/llvm/Support/MSP430Attributes.h b/llvm/include/llvm/Support/MSP430Attributes.h
index fccd65e844c35d..4cd57b73c5ff9f 100644
--- a/llvm/include/llvm/Support/MSP430Attributes.h
+++ b/llvm/include/llvm/Support/MSP430Attributes.h
@@ -18,12 +18,13 @@
#ifndef LLVM_SUPPORT_MSP430ATTRIBUTES_H
#define LLVM_SUPPORT_MSP430ATTRIBUTES_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ELFAttributes.h"
namespace llvm {
namespace MSP430Attrs {
-const TagNameMap &getMSP430AttributeTags();
+LLVM_ABI const TagNameMap &getMSP430AttributeTags();
enum AttrType : unsigned {
// Attribute types in ELF/.MSP430.attributes.
diff --git a/llvm/include/llvm/Support/ManagedStatic.h b/llvm/include/llvm/Support/ManagedStatic.h
index f2b41422f13155..7f724e8632058e 100644
--- a/llvm/include/llvm/Support/ManagedStatic.h
+++ b/llvm/include/llvm/Support/ManagedStatic.h
@@ -13,6 +13,7 @@
#ifndef LLVM_SUPPORT_MANAGEDSTATIC_H
#define LLVM_SUPPORT_MANAGEDSTATIC_H
+#include "llvm/Support/Compiler.h"
#include <atomic>
#include <cstddef>
@@ -46,7 +47,7 @@ template <typename T, size_t N> struct object_deleter<T[N]> {
#endif
/// ManagedStaticBase - Common base class for ManagedStatic instances.
-class ManagedStaticBase {
+class LLVM_ABI ManagedStaticBase {
protected:
#ifdef LLVM_USE_CONSTEXPR_CTOR
mutable std::atomic<void *> Ptr{};
@@ -111,7 +112,7 @@ class ManagedStatic : public ManagedStaticBase {
};
/// llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
-void llvm_shutdown();
+LLVM_ABI void llvm_shutdown();
/// llvm_shutdown_obj - This is a simple helper class that calls
/// llvm_shutdown() when it is destroyed.
diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index a52a9f07bacd4b..645b3715c3cf9f 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -693,7 +693,7 @@ SaturatingMultiplyAdd(T X, T Y, T A, bool *ResultOverflowed = nullptr) {
}
/// Use this rather than HUGE_VALF; the latter causes warnings on MSVC.
-extern const float huge_valf;
+LLVM_ABI extern const float huge_valf;
/// Add two signed integers, computing the two's complement truncated result,
/// returning true if overflow occurred.
diff --git a/llvm/include/llvm/Support/MemAlloc.h b/llvm/include/llvm/Support/MemAlloc.h
index f3f378b7697a18..9222d84d5d46fb 100644
--- a/llvm/include/llvm/Support/MemAlloc.h
+++ b/llvm/include/llvm/Support/MemAlloc.h
@@ -71,7 +71,7 @@ LLVM_ATTRIBUTE_RETURNS_NONNULL inline void *safe_realloc(void *Ptr, size_t Sz) {
/// like posix_memalign due to portability. It is mostly intended to allow
/// compatibility with platforms that, after aligned allocation was added, use
/// reduced default alignment.
-LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void *
+LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ABI LLVM_ATTRIBUTE_RETURNS_NOALIAS void *
allocate_buffer(size_t Size, size_t Alignment);
/// Deallocate a buffer of memory with the given size and alignment.
@@ -81,7 +81,7 @@ allocate_buffer(size_t Size, size_t Alignment);
///
/// The pointer must have been allocated with the corresponding new operator,
/// most likely using the above helper.
-void deallocate_buffer(void *Ptr, size_t Size, size_t Alignment);
+LLVM_ABI void deallocate_buffer(void *Ptr, size_t Size, size_t Alignment);
} // namespace llvm
#endif
diff --git a/llvm/include/llvm/Support/Memory.h b/llvm/include/llvm/Support/Memory.h
index c02a3cc14dc7de..45adc411b419c7 100644
--- a/llvm/include/llvm/Support/Memory.h
+++ b/llvm/include/llvm/Support/Memory.h
@@ -13,6 +13,7 @@
#ifndef LLVM_SUPPORT_MEMORY_H
#define LLVM_SUPPORT_MEMORY_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include <system_error>
@@ -49,7 +50,7 @@ namespace sys {
/// MemoryBlock instances.
/// @since 1.4
/// An abstraction for memory operations.
- class Memory {
+ class LLVM_ABI Memory {
public:
enum ProtectionFlags {
MF_READ = 0x1000000,
@@ -170,10 +171,10 @@ namespace sys {
#ifndef NDEBUG
/// Debugging output for Memory::ProtectionFlags.
- raw_ostream &operator<<(raw_ostream &OS, const Memory::ProtectionFlags &PF);
+ LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Memory::ProtectionFlags &PF);
/// Debugging output for MemoryBlock.
- raw_ostream &operator<<(raw_ostream &OS, const MemoryBlock &MB);
+ LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const MemoryBlock &MB);
#endif // ifndef NDEBUG
} // end namespace sys
} // end namespace llvm
diff --git a/llvm/include/llvm/Support/MemoryBuffer.h b/llvm/include/llvm/Support/MemoryBuffer.h
index b3477f1db0e9a6..77b3815b804fd7 100644
--- a/llvm/include/llvm/Support/MemoryBuffer.h
+++ b/llvm/include/llvm/Support/MemoryBuffer.h
@@ -19,6 +19,7 @@
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/CBindingWrapping.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/MemoryBufferRef.h"
#include <cstddef>
@@ -48,7 +49,7 @@ using file_t = int;
/// be more efficient for clients which are reading all the data to stop
/// reading when they encounter a '\0' than to continually check the file
/// position to see if it has reached the end of the file.
-class MemoryBuffer {
+class LLVM_ABI MemoryBuffer {
const char *BufferStart; // Start of the buffer.
const char *BufferEnd; // End of the buffer.
@@ -178,7 +179,7 @@ class MemoryBuffer {
/// access to the underlying contents. It only supports creation methods that
/// are guaranteed to produce a writable buffer. For example, mapping a file
/// read-only is not supported.
-class WritableMemoryBuffer : public MemoryBuffer {
+class LLVM_ABI WritableMemoryBuffer : public MemoryBuffer {
protected:
WritableMemoryBuffer() = default;
@@ -242,7 +243,7 @@ class WritableMemoryBuffer : public MemoryBuffer {
/// the underlying contents and committing those changes to the original source.
/// It only supports creation methods that are guaranteed to produce a writable
/// buffer. For example, mapping a file read-only is not supported.
-class WriteThroughMemoryBuffer : public MemoryBuffer {
+class LLVM_ABI WriteThroughMemoryBuffer : public MemoryBuffer {
protected:
WriteThroughMemoryBuffer() = default;
diff --git a/llvm/include/llvm/Support/MemoryBufferRef.h b/llvm/include/llvm/Support/MemoryBufferRef.h
index b38a1f3b65651a..80d9e364d2f513 100644
--- a/llvm/include/llvm/Support/MemoryBufferRef.h
+++ b/llvm/include/llvm/Support/MemoryBufferRef.h
@@ -14,12 +14,13 @@
#define LLVM_SUPPORT_MEMORYBUFFERREF_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
class MemoryBuffer;
-class MemoryBufferRef {
+class LLVM_ABI MemoryBufferRef {
StringRef Buffer;
StringRef Identifier;
diff --git a/llvm/include/llvm/Support/ModRef.h b/llvm/include/llvm/Support/ModRef.h
index 5a9d80c87ae27a..a9cb7814ecd4a8 100644
--- a/llvm/include/llvm/Support/ModRef.h
+++ b/llvm/include/llvm/Support/ModRef.h
@@ -16,6 +16,7 @@
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/Sequence.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
@@ -53,7 +54,7 @@ enum class ModRefInfo : uint8_t {
}
/// Debug print ModRefInfo.
-raw_ostream &operator<<(raw_ostream &OS, ModRefInfo MR);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, ModRefInfo MR);
/// The locations at which a function might access memory.
enum class IRMemLocation {
@@ -268,7 +269,7 @@ template <typename LocationEnum> class MemoryEffectsBase {
using MemoryEffects = MemoryEffectsBase<IRMemLocation>;
/// Debug print MemoryEffects.
-raw_ostream &operator<<(raw_ostream &OS, MemoryEffects RMRB);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, MemoryEffects RMRB);
// Legacy alias.
using FunctionModRefBehavior = MemoryEffects;
diff --git a/llvm/include/llvm/Support/NativeFormatting.h b/llvm/include/llvm/Support/NativeFormatting.h
index ab85ae20161c20..425d0e46e8cb25 100644
--- a/llvm/include/llvm/Support/NativeFormatting.h
+++ b/llvm/include/llvm/Support/NativeFormatting.h
@@ -9,6 +9,7 @@
#ifndef LLVM_SUPPORT_NATIVEFORMATTING_H
#define LLVM_SUPPORT_NATIVEFORMATTING_H
+#include "llvm/Support/Compiler.h"
#include <cstdint>
#include <optional>
@@ -21,25 +22,25 @@ enum class IntegerStyle {
};
enum class HexPrintStyle { Upper, Lower, PrefixUpper, PrefixLower };
-size_t getDefaultPrecision(FloatStyle Style);
+LLVM_ABI size_t getDefaultPrecision(FloatStyle Style);
-bool isPrefixedHexStyle(HexPrintStyle S);
+LLVM_ABI bool isPrefixedHexStyle(HexPrintStyle S);
-void write_integer(raw_ostream &S, unsigned int N, size_t MinDigits,
+LLVM_ABI void write_integer(raw_ostream &S, unsigned int N, size_t MinDigits,
IntegerStyle Style);
-void write_integer(raw_ostream &S, int N, size_t MinDigits, IntegerStyle Style);
-void write_integer(raw_ostream &S, unsigned long N, size_t MinDigits,
+LLVM_ABI void write_integer(raw_ostream &S, int N, size_t MinDigits, IntegerStyle Style);
+LLVM_ABI void write_integer(raw_ostream &S, unsigned long N, size_t MinDigits,
IntegerStyle Style);
-void write_integer(raw_ostream &S, long N, size_t MinDigits,
+LLVM_ABI void write_integer(raw_ostream &S, long N, size_t MinDigits,
IntegerStyle Style);
-void write_integer(raw_ostream &S, unsigned long long N, size_t MinDigits,
+LLVM_ABI void write_integer(raw_ostream &S, unsigned long long N, size_t MinDigits,
IntegerStyle Style);
-void write_integer(raw_ostream &S, long long N, size_t MinDigits,
+LLVM_ABI void write_integer(raw_ostream &S, long long N, size_t MinDigits,
IntegerStyle Style);
-void write_hex(raw_ostream &S, uint64_t N, HexPrintStyle Style,
+LLVM_ABI void write_hex(raw_ostream &S, uint64_t N, HexPrintStyle Style,
std::optional<size_t> Width = std::nullopt);
-void write_double(raw_ostream &S, double D, FloatStyle Style,
+LLVM_ABI void write_double(raw_ostream &S, double D, FloatStyle Style,
std::optional<size_t> Precision = std::nullopt);
}
diff --git a/llvm/include/llvm/Support/OptimizedStructLayout.h b/llvm/include/llvm/Support/OptimizedStructLayout.h
index 619990d132beba..452abca2aab14a 100644
--- a/llvm/include/llvm/Support/OptimizedStructLayout.h
+++ b/llvm/include/llvm/Support/OptimizedStructLayout.h
@@ -35,8 +35,9 @@
#ifndef LLVM_SUPPORT_OPTIMIZEDSTRUCTLAYOUT_H
#define LLVM_SUPPORT_OPTIMIZEDSTRUCTLAYOUT_H
-#include "llvm/Support/Alignment.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Alignment.h"
+#include "llvm/Support/Compiler.h"
#include <utility>
namespace llvm {
@@ -135,7 +136,7 @@ struct OptimizedStructLayoutField {
/// The return value is the total size of the struct and its required
/// alignment. Note that the total size is not rounded up to a multiple
/// of the required alignment; clients which require this can do so easily.
-std::pair<uint64_t, Align> performOptimizedStructLayout(
+LLVM_ABI std::pair<uint64_t, Align> performOptimizedStructLayout(
MutableArrayRef<OptimizedStructLayoutField> Fields);
} // namespace llvm
diff --git a/llvm/include/llvm/Support/OptionStrCmp.h b/llvm/include/llvm/Support/OptionStrCmp.h
index f3d3c2adb902f3..4dd3ef9772e9b5 100644
--- a/llvm/include/llvm/Support/OptionStrCmp.h
+++ b/llvm/include/llvm/Support/OptionStrCmp.h
@@ -11,6 +11,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -20,11 +21,11 @@ namespace llvm {
// precede any other options which prefix them). Additionally, if two options
// are identical ignoring case, they are ordered according to case sensitive
// ordering if `FallbackCaseSensitive` is true.
-int StrCmpOptionName(StringRef A, StringRef B,
+LLVM_ABI int StrCmpOptionName(StringRef A, StringRef B,
bool FallbackCaseSensitive = true);
// Comparison function for Option prefixes.
-int StrCmpOptionPrefixes(ArrayRef<StringRef> APrefixes,
+LLVM_ABI int StrCmpOptionPrefixes(ArrayRef<StringRef> APrefixes,
ArrayRef<StringRef> BPrefixes);
} // namespace llvm
diff --git a/llvm/include/llvm/Support/PGOOptions.h b/llvm/include/llvm/Support/PGOOptions.h
index de981abf187058..648d6125ff8048 100644
--- a/llvm/include/llvm/Support/PGOOptions.h
+++ b/llvm/include/llvm/Support/PGOOptions.h
@@ -15,6 +15,7 @@
#define LLVM_SUPPORT_PGOOPTIONS_H
#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
namespace llvm {
@@ -24,7 +25,7 @@ class FileSystem;
} // namespace vfs
/// A struct capturing PGO tunables.
-struct PGOOptions {
+struct LLVM_ABI PGOOptions {
enum PGOAction { NoAction, IRInstr, IRUse, SampleUse };
enum CSPGOAction { NoCSAction, CSIRInstr, CSIRUse };
enum class ColdFuncOpt { Default, OptSize, MinSize, OptNone };
diff --git a/llvm/include/llvm/Support/Parallel.h b/llvm/include/llvm/Support/Parallel.h
index c34619ab7d96e6..0fb8ab45c7daa7 100644
--- a/llvm/include/llvm/Support/Parallel.h
+++ b/llvm/include/llvm/Support/Parallel.h
@@ -11,6 +11,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Config/llvm-config.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Threading.h"
@@ -27,7 +28,7 @@ namespace parallel {
// Strategy for the default executor used by the parallel routines provided by
// this file. It defaults to using all hardware threads and should be
// initialized before the first use of parallel routines.
-extern ThreadPoolStrategy strategy;
+LLVM_ABI extern ThreadPoolStrategy strategy;
#if LLVM_ENABLE_THREADS
#define GET_THREAD_INDEX_IMPL \
@@ -41,7 +42,7 @@ extern ThreadPoolStrategy strategy;
#ifdef _WIN32
// Direct access to thread_local variables from a different DLL isn't
// possible with Windows Native TLS.
-unsigned getThreadIndex();
+LLVM_ABI unsigned getThreadIndex();
#else
// Don't access this directly, use the getThreadIndex wrapper.
extern thread_local unsigned threadIndex;
@@ -49,7 +50,7 @@ extern thread_local unsigned threadIndex;
inline unsigned getThreadIndex() { GET_THREAD_INDEX_IMPL; }
#endif
-size_t getThreadCount();
+LLVM_ABI size_t getThreadCount();
#else
inline unsigned getThreadIndex() { return 0; }
inline size_t getThreadCount() { return 1; }
@@ -86,7 +87,7 @@ class Latch {
};
} // namespace detail
-class TaskGroup {
+class LLVM_ABI TaskGroup {
detail::Latch L;
bool Parallel;
@@ -225,7 +226,7 @@ void parallelSort(RandomAccessIterator Start, RandomAccessIterator End,
llvm::sort(Start, End, Comp);
}
-void parallelFor(size_t Begin, size_t End, function_ref<void(size_t)> Fn);
+LLVM_ABI void parallelFor(size_t Begin, size_t End, function_ref<void(size_t)> Fn);
template <class IterTy, class FuncTy>
void parallelForEach(IterTy Begin, IterTy End, FuncTy Fn) {
diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h
index ce69f32b6cc81b..f70405d3e7312d 100644
--- a/llvm/include/llvm/Support/Path.h
+++ b/llvm/include/llvm/Support/Path.h
@@ -17,6 +17,7 @@
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/iterator.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include <iterator>
@@ -70,7 +71,7 @@ constexpr bool is_style_windows(Style S) { return !is_style_posix(S); }
/// ../ => ..,.
/// C:\foo\bar => C:,\,foo,bar
/// @endcode
-class const_iterator
+class LLVM_ABI const_iterator
: public iterator_facade_base<const_iterator, std::input_iterator_tag,
const StringRef> {
StringRef Path; ///< The entire path.
@@ -79,8 +80,8 @@ class const_iterator
Style S = Style::native; ///< The path style to use.
// An end iterator has Position = Path.size() + 1.
- friend const_iterator begin(StringRef path, Style style);
- friend const_iterator end(StringRef path);
+ friend LLVM_ABI const_iterator begin(StringRef path, Style style);
+ friend LLVM_ABI const_iterator end(StringRef path);
public:
reference operator*() const { return Component; }
@@ -96,7 +97,7 @@ class const_iterator
/// This is an input iterator that iterates over the individual components in
/// \a path in reverse order. The traversal order is exactly reversed from that
/// of \a const_iterator
-class reverse_iterator
+class LLVM_ABI reverse_iterator
: public iterator_facade_base<reverse_iterator, std::input_iterator_tag,
const StringRef> {
StringRef Path; ///< The entire path.
@@ -104,8 +105,8 @@ class reverse_iterator
size_t Position = 0; ///< The iterators current position within Path.
Style S = Style::native; ///< The path style to use.
- friend reverse_iterator rbegin(StringRef path, Style style);
- friend reverse_iterator rend(StringRef path);
+ friend LLVM_ABI reverse_iterator rbegin(StringRef path, Style style);
+ friend LLVM_ABI reverse_iterator rend(StringRef path);
public:
reference operator*() const { return Component; }
@@ -119,22 +120,22 @@ class reverse_iterator
/// Get begin iterator over \a path.
/// @param path Input path.
/// @returns Iterator initialized with the first component of \a path.
-const_iterator begin(StringRef path, Style style = Style::native);
+LLVM_ABI const_iterator begin(StringRef path, Style style = Style::native);
/// Get end iterator over \a path.
/// @param path Input path.
/// @returns Iterator initialized to the end of \a path.
-const_iterator end(StringRef path);
+LLVM_ABI const_iterator end(StringRef path);
/// Get reverse begin iterator over \a path.
/// @param path Input path.
/// @returns Iterator initialized with the first reverse component of \a path.
-reverse_iterator rbegin(StringRef path, Style style = Style::native);
+LLVM_ABI reverse_iterator rbegin(StringRef path, Style style = Style::native);
/// Get reverse end iterator over \a path.
/// @param path Input path.
/// @returns Iterator initialized to the reverse end of \a path.
-reverse_iterator rend(StringRef path);
+LLVM_ABI reverse_iterator rend(StringRef path);
/// @}
/// @name Lexical Modifiers
@@ -152,7 +153,7 @@ reverse_iterator rend(StringRef path);
/// @endcode
///
/// @param path A path that is modified to not have a file component.
-void remove_filename(SmallVectorImpl<char> &path, Style style = Style::native);
+LLVM_ABI void remove_filename(SmallVectorImpl<char> &path, Style style = Style::native);
/// Replace the file extension of \a path with \a extension.
///
@@ -166,7 +167,7 @@ void remove_filename(SmallVectorImpl<char> &path, Style style = Style::native);
/// @param extension The extension to be added. It may be empty. It may also
/// optionally start with a '.', if it does not, one will be
/// prepended.
-void replace_extension(SmallVectorImpl<char> &path, const Twine &extension,
+LLVM_ABI void replace_extension(SmallVectorImpl<char> &path, const Twine &extension,
Style style = Style::native);
/// Replace matching path prefix with another path.
@@ -191,7 +192,7 @@ void replace_extension(SmallVectorImpl<char> &path, const Twine &extension,
/// @param style The style used to match the prefix. Exact match using
/// Posix style, case/separator insensitive match for Windows style.
/// @result true if \a Path begins with OldPrefix
-bool replace_path_prefix(SmallVectorImpl<char> &Path, StringRef OldPrefix,
+LLVM_ABI bool replace_path_prefix(SmallVectorImpl<char> &Path, StringRef OldPrefix,
StringRef NewPrefix,
Style style = Style::native);
@@ -199,7 +200,7 @@ bool replace_path_prefix(SmallVectorImpl<char> &Path, StringRef OldPrefix,
///
/// @param path Input path.
/// @result The cleaned-up \a path.
-StringRef remove_leading_dotslash(StringRef path, Style style = Style::native);
+LLVM_ABI StringRef remove_leading_dotslash(StringRef path, Style style = Style::native);
/// In-place remove any './' and optionally '../' components from a path.
///
@@ -207,7 +208,7 @@ StringRef remove_leading_dotslash(StringRef path, Style style = Style::native);
/// @param remove_dot_dot specify if '../' (except for leading "../") should be
/// removed
/// @result True if path was changed
-bool remove_dots(SmallVectorImpl<char> &path, bool remove_dot_dot = false,
+LLVM_ABI bool remove_dots(SmallVectorImpl<char> &path, bool remove_dot_dot = false,
Style style = Style::native);
/// Append to path.
@@ -220,12 +221,12 @@ bool remove_dots(SmallVectorImpl<char> &path, bool remove_dot_dot = false,
///
/// @param path Set to \a path + \a component.
/// @param a The component to be appended to \a path.
-void append(SmallVectorImpl<char> &path, const Twine &a,
+LLVM_ABI void append(SmallVectorImpl<char> &path, const Twine &a,
const Twine &b = "",
const Twine &c = "",
const Twine &d = "");
-void append(SmallVectorImpl<char> &path, Style style, const Twine &a,
+LLVM_ABI void append(SmallVectorImpl<char> &path, Style style, const Twine &a,
const Twine &b = "", const Twine &c = "", const Twine &d = "");
/// Append to path.
@@ -239,7 +240,7 @@ void append(SmallVectorImpl<char> &path, Style style, const Twine &a,
/// @param path Set to \a path + [\a begin, \a end).
/// @param begin Start of components to append.
/// @param end One past the end of components to append.
-void append(SmallVectorImpl<char> &path, const_iterator begin,
+LLVM_ABI void append(SmallVectorImpl<char> &path, const_iterator begin,
const_iterator end, Style style = Style::native);
/// @}
@@ -252,7 +253,7 @@ void append(SmallVectorImpl<char> &path, const_iterator begin,
///
/// @param path A path that is transformed to native format.
/// @param result Holds the result of the transformation.
-void native(const Twine &path, SmallVectorImpl<char> &result,
+LLVM_ABI void native(const Twine &path, SmallVectorImpl<char> &result,
Style style = Style::native);
/// Convert path to the native form in place. This is used to give paths to
@@ -260,7 +261,7 @@ void native(const Twine &path, SmallVectorImpl<char> &result,
/// on Windows all '/' are converted to '\'.
///
/// @param path A path that is transformed to native format.
-void native(SmallVectorImpl<char> &path, Style style = Style::native);
+LLVM_ABI void native(SmallVectorImpl<char> &path, Style style = Style::native);
/// For Windows path styles, convert path to use the preferred path separators.
/// For other styles, do nothing.
@@ -279,7 +280,7 @@ inline void make_preferred(SmallVectorImpl<char> &path,
/// @result The result of replacing backslashes with forward slashes if Windows.
/// On Unix, this function is a no-op because backslashes are valid path
/// chracters.
-std::string convert_to_slash(StringRef path, Style style = Style::native);
+LLVM_ABI std::string convert_to_slash(StringRef path, Style style = Style::native);
/// @}
/// @name Lexical Observers
@@ -295,7 +296,7 @@ std::string convert_to_slash(StringRef path, Style style = Style::native);
///
/// @param path Input path.
/// @result The root name of \a path if it has one, otherwise "".
-StringRef root_name(StringRef path, Style style = Style::native);
+LLVM_ABI StringRef root_name(StringRef path, Style style = Style::native);
/// Get root directory.
///
@@ -308,7 +309,7 @@ StringRef root_name(StringRef path, Style style = Style::native);
/// @param path Input path.
/// @result The root directory of \a path if it has one, otherwise
/// "".
-StringRef root_directory(StringRef path, Style style = Style::native);
+LLVM_ABI StringRef root_directory(StringRef path, Style style = Style::native);
/// Get root path.
///
@@ -316,7 +317,7 @@ StringRef root_directory(StringRef path, Style style = Style::native);
///
/// @param path Input path.
/// @result The root path of \a path if it has one, otherwise "".
-StringRef root_path(StringRef path, Style style = Style::native);
+LLVM_ABI StringRef root_path(StringRef path, Style style = Style::native);
/// Get relative path.
///
@@ -328,7 +329,7 @@ StringRef root_path(StringRef path, Style style = Style::native);
///
/// @param path Input path.
/// @result The path starting after root_path if one exists, otherwise "".
-StringRef relative_path(StringRef path, Style style = Style::native);
+LLVM_ABI StringRef relative_path(StringRef path, Style style = Style::native);
/// Get parent path.
///
@@ -340,7 +341,7 @@ StringRef relative_path(StringRef path, Style style = Style::native);
///
/// @param path Input path.
/// @result The parent path of \a path if one exists, otherwise "".
-StringRef parent_path(StringRef path, Style style = Style::native);
+LLVM_ABI StringRef parent_path(StringRef path, Style style = Style::native);
/// Get filename.
///
@@ -354,7 +355,7 @@ StringRef parent_path(StringRef path, Style style = Style::native);
/// @param path Input path.
/// @result The filename part of \a path. This is defined as the last component
/// of \a path. Similar to the POSIX "basename" utility.
-StringRef filename(StringRef path, Style style = Style::native);
+LLVM_ABI StringRef filename(StringRef path, Style style = Style::native);
/// Get stem.
///
@@ -372,7 +373,7 @@ StringRef filename(StringRef path, Style style = Style::native);
///
/// @param path Input path.
/// @result The stem of \a path.
-StringRef stem(StringRef path, Style style = Style::native);
+LLVM_ABI StringRef stem(StringRef path, Style style = Style::native);
/// Get extension.
///
@@ -388,18 +389,18 @@ StringRef stem(StringRef path, Style style = Style::native);
///
/// @param path Input path.
/// @result The extension of \a path.
-StringRef extension(StringRef path, Style style = Style::native);
+LLVM_ABI StringRef extension(StringRef path, Style style = Style::native);
/// Check whether the given char is a path separator on the host OS.
///
/// @param value a character
/// @result true if \a value is a path separator character on the host OS
-bool is_separator(char value, Style style = Style::native);
+LLVM_ABI bool is_separator(char value, Style style = Style::native);
/// Return the preferred separator for this platform.
///
/// @result StringRef of the preferred separator, null-terminated.
-StringRef get_separator(Style style = Style::native);
+LLVM_ABI StringRef get_separator(Style style = Style::native);
/// Get the typical temporary directory for the system, e.g.,
/// "/var/tmp" or "C:/TEMP"
@@ -410,27 +411,27 @@ StringRef get_separator(Style style = Style::native);
/// (e.g., TEMP on Windows, TMPDIR on *nix) to specify a temporary directory.
///
/// @param result Holds the resulting path name.
-void system_temp_directory(bool erasedOnReboot, SmallVectorImpl<char> &result);
+LLVM_ABI void system_temp_directory(bool erasedOnReboot, SmallVectorImpl<char> &result);
/// Get the user's home directory.
///
/// @param result Holds the resulting path name.
/// @result True if a home directory is set, false otherwise.
-bool home_directory(SmallVectorImpl<char> &result);
+LLVM_ABI bool home_directory(SmallVectorImpl<char> &result);
/// Get the directory where packages should read user-specific configurations.
/// e.g. $XDG_CONFIG_HOME.
///
/// @param result Holds the resulting path name.
/// @result True if the appropriate path was determined, it need not exist.
-bool user_config_directory(SmallVectorImpl<char> &result);
+LLVM_ABI bool user_config_directory(SmallVectorImpl<char> &result);
/// Get the directory where installed packages should put their
/// machine-local cache, e.g. $XDG_CACHE_HOME.
///
/// @param result Holds the resulting path name.
/// @result True if the appropriate path was determined, it need not exist.
-bool cache_directory(SmallVectorImpl<char> &result);
+LLVM_ABI bool cache_directory(SmallVectorImpl<char> &result);
/// Has root name?
///
@@ -438,7 +439,7 @@ bool cache_directory(SmallVectorImpl<char> &result);
///
/// @param path Input path.
/// @result True if the path has a root name, false otherwise.
-bool has_root_name(const Twine &path, Style style = Style::native);
+LLVM_ABI bool has_root_name(const Twine &path, Style style = Style::native);
/// Has root directory?
///
@@ -446,7 +447,7 @@ bool has_root_name(const Twine &path, Style style = Style::native);
///
/// @param path Input path.
/// @result True if the path has a root directory, false otherwise.
-bool has_root_directory(const Twine &path, Style style = Style::native);
+LLVM_ABI bool has_root_directory(const Twine &path, Style style = Style::native);
/// Has root path?
///
@@ -454,7 +455,7 @@ bool has_root_directory(const Twine &path, Style style = Style::native);
///
/// @param path Input path.
/// @result True if the path has a root path, false otherwise.
-bool has_root_path(const Twine &path, Style style = Style::native);
+LLVM_ABI bool has_root_path(const Twine &path, Style style = Style::native);
/// Has relative path?
///
@@ -462,7 +463,7 @@ bool has_root_path(const Twine &path, Style style = Style::native);
///
/// @param path Input path.
/// @result True if the path has a relative path, false otherwise.
-bool has_relative_path(const Twine &path, Style style = Style::native);
+LLVM_ABI bool has_relative_path(const Twine &path, Style style = Style::native);
/// Has parent path?
///
@@ -470,7 +471,7 @@ bool has_relative_path(const Twine &path, Style style = Style::native);
///
/// @param path Input path.
/// @result True if the path has a parent path, false otherwise.
-bool has_parent_path(const Twine &path, Style style = Style::native);
+LLVM_ABI bool has_parent_path(const Twine &path, Style style = Style::native);
/// Has filename?
///
@@ -478,7 +479,7 @@ bool has_parent_path(const Twine &path, Style style = Style::native);
///
/// @param path Input path.
/// @result True if the path has a filename, false otherwise.
-bool has_filename(const Twine &path, Style style = Style::native);
+LLVM_ABI bool has_filename(const Twine &path, Style style = Style::native);
/// Has stem?
///
@@ -486,7 +487,7 @@ bool has_filename(const Twine &path, Style style = Style::native);
///
/// @param path Input path.
/// @result True if the path has a stem, false otherwise.
-bool has_stem(const Twine &path, Style style = Style::native);
+LLVM_ABI bool has_stem(const Twine &path, Style style = Style::native);
/// Has extension?
///
@@ -494,7 +495,7 @@ bool has_stem(const Twine &path, Style style = Style::native);
///
/// @param path Input path.
/// @result True if the path has a extension, false otherwise.
-bool has_extension(const Twine &path, Style style = Style::native);
+LLVM_ABI bool has_extension(const Twine &path, Style style = Style::native);
/// Is path absolute?
///
@@ -513,7 +514,7 @@ bool has_extension(const Twine &path, Style style = Style::native);
///
/// @param path Input path.
/// @result True if the path is absolute, false if it is not.
-bool is_absolute(const Twine &path, Style style = Style::native);
+LLVM_ABI bool is_absolute(const Twine &path, Style style = Style::native);
/// Is path absolute using GNU rules?
///
@@ -538,13 +539,13 @@ bool is_absolute(const Twine &path, Style style = Style::native);
/// means to derive the style from the host.
/// @result True if the path is absolute following GNU rules, false if it is
/// not.
-bool is_absolute_gnu(const Twine &path, Style style = Style::native);
+LLVM_ABI bool is_absolute_gnu(const Twine &path, Style style = Style::native);
/// Is path relative?
///
/// @param path Input path.
/// @result True if the path is relative, false if it is not.
-bool is_relative(const Twine &path, Style style = Style::native);
+LLVM_ABI bool is_relative(const Twine &path, Style style = Style::native);
} // end namespace path
} // end namespace sys
diff --git a/llvm/include/llvm/Support/PluginLoader.h b/llvm/include/llvm/Support/PluginLoader.h
index bdd36366d1cf97..0db6817309b1f3 100644
--- a/llvm/include/llvm/Support/PluginLoader.h
+++ b/llvm/include/llvm/Support/PluginLoader.h
@@ -16,6 +16,7 @@
#ifndef LLVM_SUPPORT_PLUGINLOADER_H
#define LLVM_SUPPORT_PLUGINLOADER_H
+#include "llvm/Support/Compiler.h"
#ifndef DONT_GET_PLUGIN_LOADER_OPTION
#include "llvm/Support/CommandLine.h"
#endif
@@ -23,7 +24,7 @@
#include <string>
namespace llvm {
- struct PluginLoader {
+ struct LLVM_ABI PluginLoader {
void operator=(const std::string &Filename);
static unsigned getNumPlugins();
static std::string& getPlugin(unsigned num);
diff --git a/llvm/include/llvm/Support/PrettyStackTrace.h b/llvm/include/llvm/Support/PrettyStackTrace.h
index ac25cffde051c9..a757d1c37460b3 100644
--- a/llvm/include/llvm/Support/PrettyStackTrace.h
+++ b/llvm/include/llvm/Support/PrettyStackTrace.h
@@ -24,7 +24,7 @@ namespace llvm {
/// Enables dumping a "pretty" stack trace when the program crashes.
///
/// \see PrettyStackTraceEntry
- void EnablePrettyStackTrace();
+ LLVM_ABI void EnablePrettyStackTrace();
/// Enables (or disables) dumping a "pretty" stack trace when the user sends
/// SIGINFO or SIGUSR1 to the current process.
@@ -35,22 +35,22 @@ namespace llvm {
///
/// \see EnablePrettyStackTrace
/// \see PrettyStackTraceEntry
- void EnablePrettyStackTraceOnSigInfoForThisThread(bool ShouldEnable = true);
+ LLVM_ABI void EnablePrettyStackTraceOnSigInfoForThisThread(bool ShouldEnable = true);
/// Replaces the generic bug report message that is output upon
/// a crash.
- void setBugReportMsg(const char *Msg);
+ LLVM_ABI void setBugReportMsg(const char *Msg);
/// Get the bug report message that will be output upon a crash.
- const char *getBugReportMsg();
+ LLVM_ABI const char *getBugReportMsg();
/// PrettyStackTraceEntry - This class is used to represent a frame of the
/// "pretty" stack trace that is dumped when a program crashes. You can define
/// subclasses of this and declare them on the program stack: when they are
/// constructed and destructed, they will add their symbolic frames to a
/// virtual stack trace. This gets dumped out if the program crashes.
- class PrettyStackTraceEntry {
- friend PrettyStackTraceEntry *ReverseStackTrace(PrettyStackTraceEntry *);
+ class LLVM_ABI PrettyStackTraceEntry {
+ friend LLVM_ABI PrettyStackTraceEntry *ReverseStackTrace(PrettyStackTraceEntry *);
PrettyStackTraceEntry *NextEntry;
PrettyStackTraceEntry(const PrettyStackTraceEntry &) = delete;
@@ -69,7 +69,7 @@ namespace llvm {
/// PrettyStackTraceString - This object prints a specified string (which
/// should not contain newlines) to the stream as the stack trace when a crash
/// occurs.
- class PrettyStackTraceString : public PrettyStackTraceEntry {
+ class LLVM_ABI PrettyStackTraceString : public PrettyStackTraceEntry {
const char *Str;
public:
PrettyStackTraceString(const char *str) : Str(str) {}
@@ -79,7 +79,7 @@ namespace llvm {
/// PrettyStackTraceFormat - This object prints a string (which may use
/// printf-style formatting but should not contain newlines) to the stream
/// as the stack trace when a crash occurs.
- class PrettyStackTraceFormat : public PrettyStackTraceEntry {
+ class LLVM_ABI PrettyStackTraceFormat : public PrettyStackTraceEntry {
llvm::SmallVector<char, 32> Str;
public:
PrettyStackTraceFormat(const char *Format, ...);
@@ -88,7 +88,7 @@ namespace llvm {
/// PrettyStackTraceProgram - This object prints a specified program arguments
/// to the stream as the stack trace when a crash occurs.
- class PrettyStackTraceProgram : public PrettyStackTraceEntry {
+ class LLVM_ABI PrettyStackTraceProgram : public PrettyStackTraceEntry {
int ArgC;
const char *const *ArgV;
public:
@@ -100,7 +100,7 @@ namespace llvm {
};
/// Returns the topmost element of the "pretty" stack state.
- const void *SavePrettyStackState();
+ LLVM_ABI const void *SavePrettyStackState();
/// Restores the topmost element of the "pretty" stack state to State, which
/// should come from a previous call to SavePrettyStackState(). This is
@@ -109,7 +109,7 @@ namespace llvm {
/// happens after a crash that's been recovered by CrashRecoveryContext
/// doesn't have frames on it that were added in code unwound by the
/// CrashRecoveryContext.
- void RestorePrettyStackState(const void *State);
+ LLVM_ABI void RestorePrettyStackState(const void *State);
} // end namespace llvm
diff --git a/llvm/include/llvm/Support/Process.h b/llvm/include/llvm/Support/Process.h
index 83f1fcd8b2abca..b7f86b1669c14a 100644
--- a/llvm/include/llvm/Support/Process.h
+++ b/llvm/include/llvm/Support/Process.h
@@ -25,6 +25,7 @@
#define LLVM_SUPPORT_PROCESS_H
#include "llvm/Support/Chrono.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Program.h"
@@ -40,7 +41,7 @@ namespace sys {
/// A collection of legacy interfaces for querying information about the
/// current executing process.
-class Process {
+class LLVM_ABI Process {
public:
using Pid = int32_t;
diff --git a/llvm/include/llvm/Support/Program.h b/llvm/include/llvm/Support/Program.h
index 9df94eb604c7d6..ce539643f098a1 100644
--- a/llvm/include/llvm/Support/Program.h
+++ b/llvm/include/llvm/Support/Program.h
@@ -16,6 +16,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Config/llvm-config.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem.h"
#include <chrono>
@@ -43,7 +44,7 @@ namespace sys {
#endif
/// This struct encapsulates information about a process.
- struct ProcessInfo {
+ struct LLVM_ABI ProcessInfo {
enum : procid_t { InvalidPid = 0 };
procid_t Pid; /// The process identifier.
@@ -75,20 +76,20 @@ namespace sys {
///
/// \returns The fully qualified path to the first \p Name in \p Paths if it
/// exists. \p Name if \p Name has slashes in it. Otherwise an error.
- ErrorOr<std::string>
+ LLVM_ABI ErrorOr<std::string>
findProgramByName(StringRef Name, ArrayRef<StringRef> Paths = {});
// These functions change the specified standard stream (stdin or stdout) mode
// based on the Flags. They return errc::success if the specified stream was
// changed. Otherwise, a platform dependent error is returned.
- std::error_code ChangeStdinMode(fs::OpenFlags Flags);
- std::error_code ChangeStdoutMode(fs::OpenFlags Flags);
+ LLVM_ABI std::error_code ChangeStdinMode(fs::OpenFlags Flags);
+ LLVM_ABI std::error_code ChangeStdoutMode(fs::OpenFlags Flags);
// These functions change the specified standard stream (stdin or stdout) to
// binary mode. They return errc::success if the specified stream
// was changed. Otherwise a platform dependent error is returned.
- std::error_code ChangeStdinToBinary();
- std::error_code ChangeStdoutToBinary();
+ LLVM_ABI std::error_code ChangeStdinToBinary();
+ LLVM_ABI std::error_code ChangeStdoutToBinary();
/// This function executes the program using the arguments provided. The
/// invoked program will inherit the stdin, stdout, and stderr file
@@ -101,7 +102,7 @@ namespace sys {
/// A zero or positive value indicates the result code of the program.
/// -1 indicates failure to execute
/// -2 indicates a crash during execution or timeout
- int ExecuteAndWait(
+ LLVM_ABI int ExecuteAndWait(
StringRef Program, ///< Path of the program to be executed. It is
///< presumed this is the result of the findProgramByName method.
ArrayRef<StringRef> Args, ///< An array of strings that are passed to the
@@ -146,7 +147,7 @@ namespace sys {
/// \note On Microsoft Windows systems, users will need to either call
/// \ref Wait until the process has finished executing or win32's CloseHandle
/// API on ProcessInfo.ProcessHandle to avoid memory leaks.
- ProcessInfo ExecuteNoWait(
+ LLVM_ABI ProcessInfo ExecuteNoWait(
StringRef Program, ArrayRef<StringRef> Args,
std::optional<ArrayRef<StringRef>> Env,
ArrayRef<std::optional<StringRef>> Redirects = {},
@@ -159,12 +160,12 @@ namespace sys {
/// Return true if the given arguments fit within system-specific
/// argument length limits.
- bool commandLineFitsWithinSystemLimits(StringRef Program,
+ LLVM_ABI bool commandLineFitsWithinSystemLimits(StringRef Program,
ArrayRef<StringRef> Args);
/// Return true if the given arguments fit within system-specific
/// argument length limits.
- bool commandLineFitsWithinSystemLimits(StringRef Program,
+ LLVM_ABI bool commandLineFitsWithinSystemLimits(StringRef Program,
ArrayRef<const char *> Args);
/// File encoding options when writing contents that a non-UTF8 tool will
@@ -197,7 +198,7 @@ namespace sys {
/// should be changed as soon as binutils fix this to support UTF16 on mingw.
///
/// \returns non-zero error_code if failed
- std::error_code
+ LLVM_ABI std::error_code
writeFileWithEncoding(StringRef FileName, StringRef Contents,
WindowsEncodingMethod Encoding = WEM_UTF8);
@@ -208,7 +209,7 @@ namespace sys {
/// \li 0 if the child process has not changed state.
/// \note Users of this function should always check the ReturnCode member of
/// the \see ProcessInfo returned from this function.
- ProcessInfo
+ LLVM_ABI ProcessInfo
Wait(const ProcessInfo &PI, ///< The child process that should be waited on.
std::optional<unsigned> SecondsToWait, ///< If std::nullopt, waits until
///< child has terminated.
@@ -232,14 +233,14 @@ namespace sys {
);
/// Print a command argument, and optionally quote it.
- void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote);
+ LLVM_ABI void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote);
#if defined(_WIN32)
/// Given a list of command line arguments, quote and escape them as necessary
/// to build a single flat command line appropriate for calling CreateProcess
/// on
/// Windows.
- ErrorOr<std::wstring> flattenWindowsCommandLine(ArrayRef<StringRef> Args);
+ LLVM_ABI ErrorOr<std::wstring> flattenWindowsCommandLine(ArrayRef<StringRef> Args);
#endif
}
}
diff --git a/llvm/include/llvm/Support/RISCVAttributeParser.h b/llvm/include/llvm/Support/RISCVAttributeParser.h
index 9f295504de959e..301f1f1d923c33 100644
--- a/llvm/include/llvm/Support/RISCVAttributeParser.h
+++ b/llvm/include/llvm/Support/RISCVAttributeParser.h
@@ -9,11 +9,12 @@
#ifndef LLVM_SUPPORT_RISCVATTRIBUTEPARSER_H
#define LLVM_SUPPORT_RISCVATTRIBUTEPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ELFAttributeParser.h"
#include "llvm/Support/RISCVAttributes.h"
namespace llvm {
-class RISCVAttributeParser : public ELFAttributeParser {
+class LLVM_ABI RISCVAttributeParser : public ELFAttributeParser {
struct DisplayHandler {
RISCVAttrs::AttrType attribute;
Error (RISCVAttributeParser::*routine)(unsigned);
diff --git a/llvm/include/llvm/Support/RISCVAttributes.h b/llvm/include/llvm/Support/RISCVAttributes.h
index 07476e818cb77e..3388c5288a02c7 100644
--- a/llvm/include/llvm/Support/RISCVAttributes.h
+++ b/llvm/include/llvm/Support/RISCVAttributes.h
@@ -17,12 +17,13 @@
#ifndef LLVM_SUPPORT_RISCVATTRIBUTES_H
#define LLVM_SUPPORT_RISCVATTRIBUTES_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ELFAttributes.h"
namespace llvm {
namespace RISCVAttrs {
-const TagNameMap &getRISCVAttributeTags();
+LLVM_ABI const TagNameMap &getRISCVAttributeTags();
enum AttrType : unsigned {
// Attribute types in ELF/.riscv.attributes.
diff --git a/llvm/include/llvm/Support/RISCVISAUtils.h b/llvm/include/llvm/Support/RISCVISAUtils.h
index 77f8c3e45f1ab5..165bb08d66431f 100644
--- a/llvm/include/llvm/Support/RISCVISAUtils.h
+++ b/llvm/include/llvm/Support/RISCVISAUtils.h
@@ -14,6 +14,7 @@
#define LLVM_SUPPORT_RISCVISAUTILS_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include <map>
#include <string>
@@ -28,7 +29,7 @@ struct ExtensionVersion {
unsigned Minor;
};
-bool compareExtension(const std::string &LHS, const std::string &RHS);
+LLVM_ABI bool compareExtension(const std::string &LHS, const std::string &RHS);
/// Helper class for OrderedExtensionMap.
struct ExtensionComparator {
diff --git a/llvm/include/llvm/Support/RandomNumberGenerator.h b/llvm/include/llvm/Support/RandomNumberGenerator.h
index 55d6876cc5e41f..284ec59461ee11 100644
--- a/llvm/include/llvm/Support/RandomNumberGenerator.h
+++ b/llvm/include/llvm/Support/RandomNumberGenerator.h
@@ -29,7 +29,7 @@ class StringRef;
/// seed should be set by passing the -rng-seed=<uint64> option. Use
/// Module::createRNG to create a new RNG instance for use with that
/// module.
-class RandomNumberGenerator {
+class LLVM_ABI RandomNumberGenerator {
// 64-bit Mersenne Twister by Matsumoto and Nishimura, 2000
// http://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine
@@ -63,7 +63,7 @@ class RandomNumberGenerator {
};
// Get random vector of specified size
-std::error_code getRandomBytes(void *Buffer, size_t Size);
+LLVM_ABI std::error_code getRandomBytes(void *Buffer, size_t Size);
}
#endif
diff --git a/llvm/include/llvm/Support/Recycler.h b/llvm/include/llvm/Support/Recycler.h
index bbd9ae321ae30c..e2548cc7c59615 100644
--- a/llvm/include/llvm/Support/Recycler.h
+++ b/llvm/include/llvm/Support/Recycler.h
@@ -16,6 +16,7 @@
#include "llvm/ADT/ilist.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
@@ -24,7 +25,7 @@ namespace llvm {
/// PrintRecyclingAllocatorStats - Helper for RecyclingAllocator for
/// printing statistics.
///
-void PrintRecyclerStats(size_t Size, size_t Align, size_t FreeListSize);
+LLVM_ABI void PrintRecyclerStats(size_t Size, size_t Align, size_t FreeListSize);
/// Recycler - This class manages a linked-list of deallocated nodes
/// and facilitates reusing deallocated memory in place of allocating
diff --git a/llvm/include/llvm/Support/Regex.h b/llvm/include/llvm/Support/Regex.h
index bb7a8009b6bd0c..c9c07be96edee7 100644
--- a/llvm/include/llvm/Support/Regex.h
+++ b/llvm/include/llvm/Support/Regex.h
@@ -17,6 +17,7 @@
#define LLVM_SUPPORT_REGEX_H
#include "llvm/ADT/BitmaskEnum.h"
+#include "llvm/Support/Compiler.h"
#include <string>
struct llvm_regex;
@@ -25,7 +26,7 @@ namespace llvm {
class StringRef;
template<typename T> class SmallVectorImpl;
- class Regex {
+ class LLVM_ABI Regex {
public:
enum RegexFlags : unsigned {
NoFlags = 0,
diff --git a/llvm/include/llvm/Support/SHA1.h b/llvm/include/llvm/Support/SHA1.h
index ae6d62aed723aa..e0a6136e3da2a1 100644
--- a/llvm/include/llvm/Support/SHA1.h
+++ b/llvm/include/llvm/Support/SHA1.h
@@ -15,6 +15,7 @@
#ifndef LLVM_SUPPORT_SHA1_H
#define LLVM_SUPPORT_SHA1_H
+#include "llvm/Support/Compiler.h"
#include <array>
#include <cstdint>
@@ -23,7 +24,7 @@ template <typename T> class ArrayRef;
class StringRef;
/// A class that wrap the SHA1 algorithm.
-class SHA1 {
+class LLVM_ABI SHA1 {
public:
SHA1() { init(); }
diff --git a/llvm/include/llvm/Support/SHA256.h b/llvm/include/llvm/Support/SHA256.h
index 68b32c7b483489..30d8c3586d100c 100644
--- a/llvm/include/llvm/Support/SHA256.h
+++ b/llvm/include/llvm/Support/SHA256.h
@@ -22,6 +22,7 @@
#ifndef LLVM_SUPPORT_SHA256_H
#define LLVM_SUPPORT_SHA256_H
+#include "llvm/Support/Compiler.h"
#include <array>
#include <cstdint>
@@ -30,7 +31,7 @@ namespace llvm {
template <typename T> class ArrayRef;
class StringRef;
-class SHA256 {
+class LLVM_ABI SHA256 {
public:
explicit SHA256() { init(); }
diff --git a/llvm/include/llvm/Support/SMTAPI.h b/llvm/include/llvm/Support/SMTAPI.h
index a2a89674414f4d..87ba9f4645c8a7 100644
--- a/llvm/include/llvm/Support/SMTAPI.h
+++ b/llvm/include/llvm/Support/SMTAPI.h
@@ -17,13 +17,14 @@
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/FoldingSet.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
#include <memory>
namespace llvm {
/// Generic base class for SMT sorts
-class SMTSort {
+class LLVM_ABI SMTSort {
public:
SMTSort() = default;
virtual ~SMTSort() = default;
@@ -97,7 +98,7 @@ class SMTSort {
using SMTSortRef = const SMTSort *;
/// Generic base class for SMT exprs
-class SMTExpr {
+class LLVM_ABI SMTExpr {
public:
SMTExpr() = default;
virtual ~SMTExpr() = default;
@@ -125,7 +126,7 @@ class SMTExpr {
virtual bool equal_to(SMTExpr const &other) const = 0;
};
-class SMTSolverStatistics {
+class LLVM_ABI SMTSolverStatistics {
public:
SMTSolverStatistics() = default;
virtual ~SMTSolverStatistics() = default;
@@ -146,7 +147,7 @@ using SMTExprRef = const SMTExpr *;
/// This class is responsible for wrapping all sorts and expression generation,
/// through the mk* methods. It also provides methods to create SMT expressions
/// straight from clang's AST, through the from* methods.
-class SMTSolver {
+class LLVM_ABI SMTSolver {
public:
SMTSolver() = default;
virtual ~SMTSolver() = default;
@@ -459,7 +460,7 @@ class SMTSolver {
using SMTSolverRef = std::shared_ptr<SMTSolver>;
/// Convenience method to create and Z3Solver object
-SMTSolverRef CreateZ3Solver();
+LLVM_ABI SMTSolverRef CreateZ3Solver();
} // namespace llvm
diff --git a/llvm/include/llvm/Support/ScaledNumber.h b/llvm/include/llvm/Support/ScaledNumber.h
index faf3ce351c3e52..7c1765582b0fca 100644
--- a/llvm/include/llvm/Support/ScaledNumber.h
+++ b/llvm/include/llvm/Support/ScaledNumber.h
@@ -21,6 +21,7 @@
#ifndef LLVM_SUPPORT_SCALEDNUMBER_H
#define LLVM_SUPPORT_SCALEDNUMBER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cstdint>
@@ -105,7 +106,7 @@ inline std::pair<uint64_t, int16_t> getAdjusted64(uint64_t Digits,
/// Multiply two 64-bit integers to create a 64-bit scaled number.
///
/// Implemented with four 64-bit integer multiplies.
-std::pair<uint64_t, int16_t> multiply64(uint64_t LHS, uint64_t RHS);
+LLVM_ABI std::pair<uint64_t, int16_t> multiply64(uint64_t LHS, uint64_t RHS);
/// Multiply two 32-bit integers to create a 32-bit scaled number.
///
@@ -135,14 +136,14 @@ inline std::pair<uint64_t, int16_t> getProduct64(uint64_t LHS, uint64_t RHS) {
/// Implemented with long division.
///
/// \pre \c Dividend and \c Divisor are non-zero.
-std::pair<uint64_t, int16_t> divide64(uint64_t Dividend, uint64_t Divisor);
+LLVM_ABI std::pair<uint64_t, int16_t> divide64(uint64_t Dividend, uint64_t Divisor);
/// Divide two 32-bit integers to create a 32-bit scaled number.
///
/// Implemented with one 64-bit integer divide/remainder pair.
///
/// \pre \c Dividend and \c Divisor are non-zero.
-std::pair<uint32_t, int16_t> divide32(uint32_t Dividend, uint32_t Divisor);
+LLVM_ABI std::pair<uint32_t, int16_t> divide32(uint32_t Dividend, uint32_t Divisor);
/// Divide two 32-bit numbers to create a 32-bit scaled number.
///
@@ -242,7 +243,7 @@ template <class DigitsT> int32_t getLgCeiling(DigitsT Digits, int16_t Scale) {
/// 1, and 0 for less than, greater than, and equal, respectively.
///
/// \pre 0 <= ScaleDiff < 64.
-int compareImpl(uint64_t L, uint64_t R, int ScaleDiff);
+LLVM_ABI int compareImpl(uint64_t L, uint64_t R, int ScaleDiff);
/// Compare two scaled numbers.
///
@@ -417,7 +418,7 @@ inline std::pair<uint64_t, int16_t> getDifference64(uint64_t LDigits,
namespace llvm {
class raw_ostream;
-class ScaledNumberBase {
+class LLVM_ABI ScaledNumberBase {
public:
static constexpr int DefaultPrecision = 10;
diff --git a/llvm/include/llvm/Support/ScopedPrinter.h b/llvm/include/llvm/Support/ScopedPrinter.h
index 419ab97366796e..38733a1d073c04 100644
--- a/llvm/include/llvm/Support/ScopedPrinter.h
+++ b/llvm/include/llvm/Support/ScopedPrinter.h
@@ -14,6 +14,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/JSON.h"
@@ -80,7 +81,7 @@ struct FlagEntry {
uint64_t Value;
};
-raw_ostream &operator<<(raw_ostream &OS, const HexNumber &Value);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const HexNumber &Value);
template <class T> std::string to_string(const T &Value) {
std::string number;
@@ -97,7 +98,7 @@ std::string enumToString(T Value, ArrayRef<EnumEntry<TEnum>> EnumValues) {
return utohexstr(Value, true);
}
-class ScopedPrinter {
+class LLVM_ABI ScopedPrinter {
public:
enum class ScopedPrinterKind {
Base,
@@ -541,7 +542,7 @@ ScopedPrinter::printHex<support::ulittle16_t>(StringRef Label,
struct DelimitedScope;
-class JSONScopedPrinter : public ScopedPrinter {
+class LLVM_ABI JSONScopedPrinter : public ScopedPrinter {
private:
enum class Scope {
Array,
@@ -838,7 +839,7 @@ class JSONScopedPrinter : public ScopedPrinter {
}
};
-struct DelimitedScope {
+struct LLVM_ABI DelimitedScope {
DelimitedScope(ScopedPrinter &W) : W(&W) {}
DelimitedScope() : W(nullptr) {}
virtual ~DelimitedScope() = default;
diff --git a/llvm/include/llvm/Support/Signals.h b/llvm/include/llvm/Support/Signals.h
index 70749ce30184a7..41b2ea15847da6 100644
--- a/llvm/include/llvm/Support/Signals.h
+++ b/llvm/include/llvm/Support/Signals.h
@@ -14,6 +14,7 @@
#ifndef LLVM_SUPPORT_SIGNALS_H
#define LLVM_SUPPORT_SIGNALS_H
+#include "llvm/Support/Compiler.h"
#include <cstdint>
#include <string>
@@ -25,16 +26,16 @@ namespace sys {
/// This function runs all the registered interrupt handlers, including the
/// removal of files registered by RemoveFileOnSignal.
- void RunInterruptHandlers();
+ LLVM_ABI void RunInterruptHandlers();
/// This function registers signal handlers to ensure that if a signal gets
/// delivered that the named file is removed.
/// Remove a file if a fatal signal occurs.
- bool RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg = nullptr);
+ LLVM_ABI bool RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg = nullptr);
/// This function removes a file from the list of files to be removed on
/// signal delivery.
- void DontRemoveFileOnSignal(StringRef Filename);
+ LLVM_ABI void DontRemoveFileOnSignal(StringRef Filename);
/// When an error signal (such as SIGABRT or SIGSEGV) is delivered to the
/// process, print a stack trace and then exit.
@@ -44,26 +45,26 @@ namespace sys {
/// StringRef(), in which case we will only search $PATH.
/// \param DisableCrashReporting if \c true, disable the normal crash
/// reporting mechanisms on the underlying operating system.
- void PrintStackTraceOnErrorSignal(StringRef Argv0,
+ LLVM_ABI void PrintStackTraceOnErrorSignal(StringRef Argv0,
bool DisableCrashReporting = false);
/// Disable all system dialog boxes that appear when the process crashes.
- void DisableSystemDialogsOnCrash();
+ LLVM_ABI void DisableSystemDialogsOnCrash();
/// Print the stack trace using the given \c raw_ostream object.
/// \param Depth refers to the number of stackframes to print. If not
/// specified, the entire frame is printed.
- void PrintStackTrace(raw_ostream &OS, int Depth = 0);
+ LLVM_ABI void PrintStackTrace(raw_ostream &OS, int Depth = 0);
// Run all registered signal handlers.
- void RunSignalHandlers();
+ LLVM_ABI void RunSignalHandlers();
using SignalHandlerCallback = void (*)(void *);
/// Add a function to be called when an abort/kill signal is delivered to the
/// process. The handler can have a cookie passed to it to identify what
/// instance of the handler it is.
- void AddSignalHandler(SignalHandlerCallback FnPtr, void *Cookie);
+ LLVM_ABI void AddSignalHandler(SignalHandlerCallback FnPtr, void *Cookie);
/// This function registers a function to be called when the user "interrupts"
/// the program (typically by pressing ctrl-c). When the user interrupts the
@@ -74,7 +75,7 @@ namespace sys {
/// functions. An null interrupt function pointer disables the current
/// installed function. Note also that the handler may be executed on a
/// different thread on some platforms.
- void SetInterruptFunction(void (*IF)());
+ LLVM_ABI void SetInterruptFunction(void (*IF)());
/// Registers a function to be called when an "info" signal is delivered to
/// the process.
@@ -86,7 +87,7 @@ namespace sys {
/// functions. An null function pointer disables the current installed
/// function. Note also that the handler may be executed on a different
/// thread on some platforms.
- void SetInfoSignalFunction(void (*Handler)());
+ LLVM_ABI void SetInfoSignalFunction(void (*Handler)());
/// Registers a function to be called in a "one-shot" manner when a pipe
/// signal is delivered to the process (i.e., on a failed write to a pipe).
@@ -102,15 +103,15 @@ namespace sys {
/// functions. A null handler pointer disables the current installed
/// function. Note also that the handler may be executed on a
/// different thread on some platforms.
- void SetOneShotPipeSignalFunction(void (*Handler)());
+ LLVM_ABI void SetOneShotPipeSignalFunction(void (*Handler)());
/// On Unix systems and Windows, this function exits with an "IO error" exit
/// code.
- void DefaultOneShotPipeSignalHandler();
+ LLVM_ABI void DefaultOneShotPipeSignalHandler();
#ifdef _WIN32
/// Windows does not support signals and this handler must be called manually.
- void CallOneShotPipeSignalHandler();
+ LLVM_ABI void CallOneShotPipeSignalHandler();
#endif
/// This function does the following:
@@ -120,9 +121,9 @@ namespace sys {
/// - create a core/mini dump of the exception context whenever possible
/// Context is a system-specific failure context: it is the signal type on
/// Unix; the ExceptionContext on Windows.
- void CleanupOnSignal(uintptr_t Context);
+ LLVM_ABI void CleanupOnSignal(uintptr_t Context);
- void unregisterHandlers();
+ LLVM_ABI void unregisterHandlers();
} // End sys namespace
} // End llvm namespace
diff --git a/llvm/include/llvm/Support/Signposts.h b/llvm/include/llvm/Support/Signposts.h
index 37089bd1c17d3c..8d45e1f2f598df 100644
--- a/llvm/include/llvm/Support/Signposts.h
+++ b/llvm/include/llvm/Support/Signposts.h
@@ -16,6 +16,7 @@
#ifndef LLVM_SUPPORT_SIGNPOSTS_H
#define LLVM_SUPPORT_SIGNPOSTS_H
+#include "llvm/Support/Compiler.h"
#include <memory>
namespace llvm {
@@ -24,7 +25,7 @@ class StringRef;
/// Manages the emission of signposts into the recording method supported by
/// the OS.
-class SignpostEmitter {
+class LLVM_ABI SignpostEmitter {
std::unique_ptr<SignpostEmitterImpl> Impl;
public:
diff --git a/llvm/include/llvm/Support/SipHash.h b/llvm/include/llvm/Support/SipHash.h
index ab05ff38769eb9..5f202d5cac2cf8 100644
--- a/llvm/include/llvm/Support/SipHash.h
+++ b/llvm/include/llvm/Support/SipHash.h
@@ -17,6 +17,7 @@
#ifndef LLVM_SUPPORT_SIPHASH_H
#define LLVM_SUPPORT_SIPHASH_H
+#include "llvm/Support/Compiler.h"
#include <cstdint>
namespace llvm {
@@ -25,11 +26,11 @@ template <typename T> class ArrayRef;
class StringRef;
/// Computes a SipHash-2-4 64-bit result.
-void getSipHash_2_4_64(ArrayRef<uint8_t> In, const uint8_t (&K)[16],
+LLVM_ABI void getSipHash_2_4_64(ArrayRef<uint8_t> In, const uint8_t (&K)[16],
uint8_t (&Out)[8]);
/// Computes a SipHash-2-4 128-bit result.
-void getSipHash_2_4_128(ArrayRef<uint8_t> In, const uint8_t (&K)[16],
+LLVM_ABI void getSipHash_2_4_128(ArrayRef<uint8_t> In, const uint8_t (&K)[16],
uint8_t (&Out)[16]);
/// Compute a stable non-zero 16-bit hash of the given string.
@@ -45,7 +46,7 @@ void getSipHash_2_4_128(ArrayRef<uint8_t> In, const uint8_t (&K)[16],
/// 16 bits is also sufficiently compact to not inflate a loader relocation.
/// We disallow zero to guarantee a different discriminator from the places
/// in the ABI that use a constant zero.
-uint16_t getPointerAuthStableSipHash(StringRef S);
+LLVM_ABI uint16_t getPointerAuthStableSipHash(StringRef S);
} // end namespace llvm
diff --git a/llvm/include/llvm/Support/SmallVectorMemoryBuffer.h b/llvm/include/llvm/Support/SmallVectorMemoryBuffer.h
index f7f2d4e54e705d..da096d103f753f 100644
--- a/llvm/include/llvm/Support/SmallVectorMemoryBuffer.h
+++ b/llvm/include/llvm/Support/SmallVectorMemoryBuffer.h
@@ -15,6 +15,7 @@
#define LLVM_SUPPORT_SMALLVECTORMEMORYBUFFER_H
#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
@@ -26,7 +27,7 @@ namespace llvm {
/// instances. This is useful for MCJIT and Orc, where object files are streamed
/// into SmallVectors, then inspected using ObjectFile (which takes a
/// MemoryBuffer).
-class SmallVectorMemoryBuffer : public MemoryBuffer {
+class LLVM_ABI SmallVectorMemoryBuffer : public MemoryBuffer {
public:
/// Construct a SmallVectorMemoryBuffer from the given SmallVector r-value.
SmallVectorMemoryBuffer(SmallVectorImpl<char> &&SV,
diff --git a/llvm/include/llvm/Support/SourceMgr.h b/llvm/include/llvm/Support/SourceMgr.h
index 7a4b6de1162da4..98b43c9bd53cd7 100644
--- a/llvm/include/llvm/Support/SourceMgr.h
+++ b/llvm/include/llvm/Support/SourceMgr.h
@@ -16,6 +16,7 @@
#define LLVM_SUPPORT_SOURCEMGR_H
#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SMLoc.h"
#include <vector>
@@ -28,7 +29,7 @@ class SMFixIt;
/// This owns the files read by a parser, handles include stacks,
/// and handles diagnostic wrangling.
-class SourceMgr {
+class LLVM_ABI SourceMgr {
public:
enum DiagKind {
DK_Error,
@@ -43,7 +44,7 @@ class SourceMgr {
using DiagHandlerTy = void (*)(const SMDiagnostic &, void *Context);
private:
- struct SrcBuffer {
+ struct LLVM_ABI SrcBuffer {
/// The memory buffer for the file.
std::unique_ptr<MemoryBuffer> Buffer;
@@ -253,7 +254,7 @@ class SourceMgr {
};
/// Represents a single fixit, a replacement of one range of text with another.
-class SMFixIt {
+class LLVM_ABI SMFixIt {
SMRange Range;
std::string Text;
@@ -278,7 +279,7 @@ class SMFixIt {
/// Instances of this class encapsulate one diagnostic report, allowing
/// printing to a raw_ostream as a caret diagnostic.
-class SMDiagnostic {
+class LLVM_ABI SMDiagnostic {
const SourceMgr *SM = nullptr;
SMLoc Loc;
std::string Filename;
diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h
index 6dc1a29c5a281d..dc928ee7ecf0bb 100644
--- a/llvm/include/llvm/Support/SpecialCaseList.h
+++ b/llvm/include/llvm/Support/SpecialCaseList.h
@@ -13,6 +13,7 @@
#define LLVM_SUPPORT_SPECIALCASELIST_H
#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/GlobPattern.h"
#include "llvm/Support/Regex.h"
#include <memory>
@@ -66,7 +67,7 @@ class FileSystem;
/// fun:cos=functional
/// fun:sin=functional
/// ---
-class SpecialCaseList {
+class LLVM_ABI SpecialCaseList {
public:
/// Parses the special case list entries from files. On failure, returns
/// 0 and writes an error message to string.
@@ -115,7 +116,7 @@ class SpecialCaseList {
SpecialCaseList &operator=(SpecialCaseList const &) = delete;
/// Represents a set of globs and their line numbers
- class Matcher {
+ class LLVM_ABI Matcher {
public:
Error insert(StringRef Pattern, unsigned LineNumber, bool UseRegex);
// Returns the line number in the source file that this query matches to.
diff --git a/llvm/include/llvm/Support/StringSaver.h b/llvm/include/llvm/Support/StringSaver.h
index 95ace0e0e29a02..cd7543ebd9a524 100644
--- a/llvm/include/llvm/Support/StringSaver.h
+++ b/llvm/include/llvm/Support/StringSaver.h
@@ -13,12 +13,13 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
/// Saves strings in the provided stable storage and returns a
/// StringRef with a stable character pointer.
-class StringSaver final {
+class LLVM_ABI StringSaver final {
BumpPtrAllocator &Alloc;
public:
@@ -41,7 +42,7 @@ class StringSaver final {
///
/// Compared to StringPool, it performs fewer allocations but doesn't support
/// refcounting/deletion.
-class UniqueStringSaver final {
+class LLVM_ABI UniqueStringSaver final {
StringSaver Strings;
llvm::DenseSet<llvm::StringRef> Unique;
diff --git a/llvm/include/llvm/Support/SuffixTree.h b/llvm/include/llvm/Support/SuffixTree.h
index 37b73666404300..3b9a151a50f7bc 100644
--- a/llvm/include/llvm/Support/SuffixTree.h
+++ b/llvm/include/llvm/Support/SuffixTree.h
@@ -34,10 +34,11 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/SuffixTreeNode.h"
namespace llvm {
-class SuffixTree {
+class LLVM_ABI SuffixTree {
public:
/// Each element is an integer representing an instruction in the module.
ArrayRef<unsigned> Str;
@@ -156,7 +157,7 @@ class SuffixTree {
bool OutlinerLeafDescendants = false);
/// Iterator for finding all repeated substrings in the suffix tree.
- struct RepeatedSubstringIterator {
+ struct LLVM_ABI RepeatedSubstringIterator {
private:
/// The current node we're visiting.
SuffixTreeNode *N = nullptr;
diff --git a/llvm/include/llvm/Support/SuffixTreeNode.h b/llvm/include/llvm/Support/SuffixTreeNode.h
index 84b590f2deb0cd..0ef8caeb155c30 100644
--- a/llvm/include/llvm/Support/SuffixTreeNode.h
+++ b/llvm/include/llvm/Support/SuffixTreeNode.h
@@ -26,11 +26,12 @@
#ifndef LLVM_SUPPORT_SUFFIXTREE_NODE_H
#define LLVM_SUPPORT_SUFFIXTREE_NODE_H
#include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
/// A node in a suffix tree which represents a substring or suffix.
-struct SuffixTreeNode {
+struct LLVM_ABI SuffixTreeNode {
public:
/// Represents an undefined index in the suffix tree.
static const unsigned EmptyIdx = -1;
@@ -94,7 +95,7 @@ struct SuffixTreeNode {
};
// A node with two or more children, or the root.
-struct SuffixTreeInternalNode : SuffixTreeNode {
+struct LLVM_ABI SuffixTreeInternalNode : SuffixTreeNode {
private:
/// The end index of this node's substring in the main string.
///
@@ -158,7 +159,7 @@ struct SuffixTreeInternalNode : SuffixTreeNode {
};
// A node representing a suffix.
-struct SuffixTreeLeafNode : SuffixTreeNode {
+struct LLVM_ABI SuffixTreeLeafNode : SuffixTreeNode {
private:
/// The start index of the suffix represented by this leaf.
unsigned SuffixIdx = EmptyIdx;
diff --git a/llvm/include/llvm/Support/SystemUtils.h b/llvm/include/llvm/Support/SystemUtils.h
index 786bea3fcfae68..e453c88698b238 100644
--- a/llvm/include/llvm/Support/SystemUtils.h
+++ b/llvm/include/llvm/Support/SystemUtils.h
@@ -14,6 +14,7 @@
#ifndef LLVM_SUPPORT_SYSTEMUTILS_H
#define LLVM_SUPPORT_SYSTEMUTILS_H
+#include "llvm/Support/Compiler.h"
namespace llvm {
class raw_ostream;
@@ -21,7 +22,7 @@ class raw_ostream;
/// generate a warning message to errs() advising against display of bitcode
/// and return true. Otherwise just return false.
/// Check for output written to a console
-bool CheckBitcodeOutputToConsole(
+LLVM_ABI bool CheckBitcodeOutputToConsole(
raw_ostream &stream_to_check ///< The stream to be checked
);
diff --git a/llvm/include/llvm/Support/TarWriter.h b/llvm/include/llvm/Support/TarWriter.h
index 48d810ac65e351..572392a9d59a45 100644
--- a/llvm/include/llvm/Support/TarWriter.h
+++ b/llvm/include/llvm/Support/TarWriter.h
@@ -11,11 +11,12 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
-class TarWriter {
+class LLVM_ABI TarWriter {
public:
static Expected<std::unique_ptr<TarWriter>> create(StringRef OutputPath,
StringRef BaseDir);
diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h
index 014b7a09d7c8ba..9272760fc140ab 100644
--- a/llvm/include/llvm/Support/ThreadPool.h
+++ b/llvm/include/llvm/Support/ThreadPool.h
@@ -15,6 +15,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/Config/llvm-config.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/RWMutex.h"
#include "llvm/Support/Threading.h"
#include "llvm/Support/thread.h"
@@ -46,7 +47,7 @@ class ThreadPoolTaskGroup;
/// available threads are used up by tasks waiting for a task that has no thread
/// left to run on (this includes waiting on the returned future). It should be
/// generally safe to wait() for a group as long as groups do not form a cycle.
-class ThreadPoolInterface {
+class LLVM_ABI ThreadPoolInterface {
/// The actual method to enqueue a task to be defined by the concrete
/// implementation.
virtual void asyncEnqueue(std::function<void()> Task,
@@ -121,7 +122,7 @@ class ThreadPoolInterface {
///
/// The pool keeps a vector of threads alive, waiting on a condition variable
/// for some work to become available.
-class StdThreadPool : public ThreadPoolInterface {
+class LLVM_ABI StdThreadPool : public ThreadPoolInterface {
public:
/// Construct a pool using the hardware strategy \p S for mapping hardware
/// execution resources (threads, cores, CPUs)
@@ -215,7 +216,7 @@ class StdThreadPool : public ThreadPoolInterface {
#endif // LLVM_ENABLE_THREADS
/// A non-threaded implementation.
-class SingleThreadExecutor : public ThreadPoolInterface {
+class LLVM_ABI SingleThreadExecutor : public ThreadPoolInterface {
public:
/// Construct a non-threaded pool, ignoring using the hardware strategy.
SingleThreadExecutor(ThreadPoolStrategy ignored = {});
diff --git a/llvm/include/llvm/Support/Threading.h b/llvm/include/llvm/Support/Threading.h
index d8e2cb0514ddd7..0122f9ca07f306 100644
--- a/llvm/include/llvm/Support/Threading.h
+++ b/llvm/include/llvm/Support/Threading.h
@@ -113,7 +113,7 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; }
}
/// This tells how a thread pool will be used
- class ThreadPoolStrategy {
+ class LLVM_ABI ThreadPoolStrategy {
public:
// The default value (0) means all available threads should be used,
// taking the affinity mask into account. If set, this value only represents
@@ -149,7 +149,7 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; }
/// strategy, we attempt to equally allocate the threads on all CPU sockets.
/// "0" or an empty string will return the \p Default strategy.
/// "all" for using all hardware threads.
- std::optional<ThreadPoolStrategy>
+ LLVM_ABI std::optional<ThreadPoolStrategy>
get_threadpool_strategy(StringRef Num, ThreadPoolStrategy Default = {});
/// Returns a thread strategy for tasks requiring significant memory or other
@@ -214,11 +214,11 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; }
/// Note that not all platforms guarantee that the value returned will be
/// unique across the entire system, so portable code should not assume
/// this.
- uint64_t get_threadid();
+ LLVM_ABI uint64_t get_threadid();
/// Get the maximum length of a thread name on this platform.
/// A value of 0 means there is no limit.
- uint32_t get_max_thread_name_length();
+ LLVM_ABI uint32_t get_max_thread_name_length();
/// Set the name of the current thread. Setting a thread's name can
/// be helpful for enabling useful diagnostics under a debugger or when
@@ -226,7 +226,7 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; }
/// wildly across operating systems, and we only make a best effort to
/// perform the operation on supported platforms. No indication of success
/// or failure is returned.
- void set_thread_name(const Twine &Name);
+ LLVM_ABI void set_thread_name(const Twine &Name);
/// Get the name of the current thread. The level of support for
/// getting a thread's name varies wildly across operating systems, and it
@@ -234,20 +234,20 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; }
/// that you can later get it back. This function is intended for diagnostic
/// purposes, and as with setting a thread's name no indication of whether
/// the operation succeeded or failed is returned.
- void get_thread_name(SmallVectorImpl<char> &Name);
+ LLVM_ABI void get_thread_name(SmallVectorImpl<char> &Name);
/// Returns a mask that represents on which hardware thread, core, CPU, NUMA
/// group, the calling thread can be executed. On Windows, threads cannot
/// cross CPU sockets boundaries.
- llvm::BitVector get_thread_affinity_mask();
+ LLVM_ABI llvm::BitVector get_thread_affinity_mask();
/// Returns how many physical CPUs or NUMA groups the system has.
- unsigned get_cpus();
+ LLVM_ABI unsigned get_cpus();
/// Returns how many physical cores (as opposed to logical cores returned from
/// thread::hardware_concurrency(), which includes hyperthreads).
/// Returns -1 if unknown for the current host system.
- int get_physical_cores();
+ LLVM_ABI int get_physical_cores();
enum class ThreadPriority {
/// Lower the current thread's priority as much as possible. Can be used
@@ -265,7 +265,7 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; }
Default = 2,
};
enum class SetThreadPriorityResult { FAILURE, SUCCESS };
- SetThreadPriorityResult set_thread_priority(ThreadPriority Priority);
+ LLVM_ABI SetThreadPriorityResult set_thread_priority(ThreadPriority Priority);
}
#endif
diff --git a/llvm/include/llvm/Support/TimeProfiler.h b/llvm/include/llvm/Support/TimeProfiler.h
index 8c0ecf9b7c911f..f85865023a2112 100644
--- a/llvm/include/llvm/Support/TimeProfiler.h
+++ b/llvm/include/llvm/Support/TimeProfiler.h
@@ -77,6 +77,7 @@
#define LLVM_SUPPORT_TIMEPROFILER_H
#include "llvm/ADT/STLFunctionalExtras.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
namespace llvm {
@@ -106,24 +107,24 @@ struct TimeTraceMetadata {
};
struct TimeTraceProfiler;
-TimeTraceProfiler *getTimeTraceProfilerInstance();
+LLVM_ABI TimeTraceProfiler *getTimeTraceProfilerInstance();
-bool isTimeTraceVerbose();
+LLVM_ABI bool isTimeTraceVerbose();
struct TimeTraceProfilerEntry;
/// Initialize the time trace profiler.
/// This sets up the global \p TimeTraceProfilerInstance
/// variable to be the profiler instance.
-void timeTraceProfilerInitialize(unsigned TimeTraceGranularity,
+LLVM_ABI void timeTraceProfilerInitialize(unsigned TimeTraceGranularity,
StringRef ProcName,
bool TimeTraceVerbose = false);
/// Cleanup the time trace profiler, if it was initialized.
-void timeTraceProfilerCleanup();
+LLVM_ABI void timeTraceProfilerCleanup();
/// Finish a time trace profiler running on a worker thread.
-void timeTraceProfilerFinishThread();
+LLVM_ABI void timeTraceProfilerFinishThread();
/// Is the time trace profiler enabled, i.e. initialized?
inline bool timeTraceProfilerEnabled() {
@@ -133,27 +134,27 @@ inline bool timeTraceProfilerEnabled() {
/// Write profiling data to output stream.
/// Data produced is JSON, in Chrome "Trace Event" format, see
/// https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
-void timeTraceProfilerWrite(raw_pwrite_stream &OS);
+LLVM_ABI void timeTraceProfilerWrite(raw_pwrite_stream &OS);
/// Write profiling data to a file.
/// The function will write to \p PreferredFileName if provided, if not
/// then will write to \p FallbackFileName appending .time-trace.
/// Returns a StringError indicating a failure if the function is
/// unable to open the file for writing.
-Error timeTraceProfilerWrite(StringRef PreferredFileName,
+LLVM_ABI Error timeTraceProfilerWrite(StringRef PreferredFileName,
StringRef FallbackFileName);
/// Manually begin a time section, with the given \p Name and \p Detail.
/// Profiler copies the string data, so the pointers can be given into
/// temporaries. Time sections can be hierarchical; every Begin must have a
/// matching End pair but they can nest.
-TimeTraceProfilerEntry *timeTraceProfilerBegin(StringRef Name,
+LLVM_ABI TimeTraceProfilerEntry *timeTraceProfilerBegin(StringRef Name,
StringRef Detail);
-TimeTraceProfilerEntry *
+LLVM_ABI TimeTraceProfilerEntry *
timeTraceProfilerBegin(StringRef Name,
llvm::function_ref<std::string()> Detail);
-TimeTraceProfilerEntry *
+LLVM_ABI TimeTraceProfilerEntry *
timeTraceProfilerBegin(StringRef Name,
llvm::function_ref<TimeTraceMetadata()> MetaData);
@@ -162,16 +163,16 @@ timeTraceProfilerBegin(StringRef Name,
/// separately from other traces. See
/// https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#heading=h.jh64i9l3vwa1
/// for more details.
-TimeTraceProfilerEntry *timeTraceAsyncProfilerBegin(StringRef Name,
+LLVM_ABI TimeTraceProfilerEntry *timeTraceAsyncProfilerBegin(StringRef Name,
StringRef Detail);
// Mark an instant event.
-void timeTraceAddInstantEvent(StringRef Name,
+LLVM_ABI void timeTraceAddInstantEvent(StringRef Name,
llvm::function_ref<std::string()> Detail);
/// Manually end the last time section.
-void timeTraceProfilerEnd();
-void timeTraceProfilerEnd(TimeTraceProfilerEntry *E);
+LLVM_ABI void timeTraceProfilerEnd();
+LLVM_ABI void timeTraceProfilerEnd(TimeTraceProfilerEntry *E);
/// The TimeTraceScope is a helper class to call the begin and end functions
/// of the time trace profiler. When the object is constructed, it begins
diff --git a/llvm/include/llvm/Support/Timer.h b/llvm/include/llvm/Support/Timer.h
index 1a32832b6c6536..a26d341a7a80a6 100644
--- a/llvm/include/llvm/Support/Timer.h
+++ b/llvm/include/llvm/Support/Timer.h
@@ -11,6 +11,7 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include <cassert>
#include <memory>
@@ -22,7 +23,7 @@ namespace llvm {
class TimerGroup;
class raw_ostream;
-class TimeRecord {
+class LLVM_ABI TimeRecord {
double WallTime = 0.0; ///< Wall clock time elapsed in seconds.
double UserTime = 0.0; ///< User time elapsed.
double SystemTime = 0.0; ///< System time elapsed.
@@ -76,7 +77,7 @@ class TimeRecord {
/// when the last timer is destroyed, otherwise it is printed when its
/// TimerGroup is destroyed. Timers do not print their information if they are
/// never started.
-class Timer {
+class LLVM_ABI Timer {
TimeRecord Time; ///< The total time captured.
TimeRecord StartTime; ///< The time startTimer() was last called.
std::string Name; ///< The name of this time variable.
@@ -160,7 +161,7 @@ class TimeRegion {
/// you to declare a new timer, AND specify the region to time, all in one
/// statement. All timers with the same name are merged. This is primarily
/// used for debugging and for hunting performance problems.
-struct NamedRegionTimer : public TimeRegion {
+struct LLVM_ABI NamedRegionTimer : public TimeRegion {
explicit NamedRegionTimer(StringRef Name, StringRef Description,
StringRef GroupName,
StringRef GroupDescription, bool Enabled = true);
@@ -170,7 +171,7 @@ struct NamedRegionTimer : public TimeRegion {
/// report that is printed when the TimerGroup is destroyed. It is illegal to
/// destroy a TimerGroup object before all of the Timers in it are gone. A
/// TimerGroup can be specified for a newly created timer in its constructor.
-class TimerGroup {
+class LLVM_ABI TimerGroup {
struct PrintRecord {
TimeRecord Time;
std::string Name;
@@ -240,7 +241,7 @@ class TimerGroup {
private:
friend class Timer;
- friend void PrintStatisticsJSON(raw_ostream &OS);
+ friend LLVM_ABI void PrintStatisticsJSON(raw_ostream &OS);
void addTimer(Timer &T);
void removeTimer(Timer &T);
void prepareToPrintList(bool reset_time = false);
diff --git a/llvm/include/llvm/Support/ToolOutputFile.h b/llvm/include/llvm/Support/ToolOutputFile.h
index c16fb03d9b22b9..5b492af3566284 100644
--- a/llvm/include/llvm/Support/ToolOutputFile.h
+++ b/llvm/include/llvm/Support/ToolOutputFile.h
@@ -13,12 +13,13 @@
#ifndef LLVM_SUPPORT_TOOLOUTPUTFILE_H
#define LLVM_SUPPORT_TOOLOUTPUTFILE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
namespace llvm {
-class CleanupInstaller {
+class LLVM_ABI CleanupInstaller {
public:
/// The name of the file.
std::string Filename;
@@ -36,7 +37,7 @@ class CleanupInstaller {
/// - The file is automatically deleted if the process is killed.
/// - The file is automatically deleted when the ToolOutputFile
/// object is destroyed unless the client calls keep().
-class ToolOutputFile {
+class LLVM_ABI ToolOutputFile {
/// This class is declared before the raw_fd_ostream so that it is constructed
/// before the raw_fd_ostream is constructed and destructed after the
/// raw_fd_ostream is destructed. It installs cleanups in its constructor and
diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h
index bae833ecca7d49..266c498cd58422 100644
--- a/llvm/include/llvm/Support/TypeSize.h
+++ b/llvm/include/llvm/Support/TypeSize.h
@@ -15,6 +15,7 @@
#ifndef LLVM_SUPPORT_TYPESIZE_H
#define LLVM_SUPPORT_TYPESIZE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
@@ -27,7 +28,7 @@ namespace llvm {
/// Reports a diagnostic message to indicate an invalid size request has been
/// done on a scalable vector. This function may not return.
-void reportInvalidSizeRequest(const char *Msg);
+LLVM_ABI void reportInvalidSizeRequest(const char *Msg);
/// StackOffset holds a fixed and a scalable offset in bytes.
class StackOffset {
@@ -331,7 +332,7 @@ class ElementCount
// Stores the size of a type. If the type is of fixed size, it will represent
// the exact size. If the type is a scalable vector, it will represent the known
// minimum size.
-class TypeSize : public details::FixedOrScalableQuantity<TypeSize, uint64_t> {
+class LLVM_ABI TypeSize : public details::FixedOrScalableQuantity<TypeSize, uint64_t> {
TypeSize(const FixedOrScalableQuantity<TypeSize, uint64_t> &V)
: FixedOrScalableQuantity(V) {}
diff --git a/llvm/include/llvm/Support/Unicode.h b/llvm/include/llvm/Support/Unicode.h
index 861548728d4f85..9b3a42932c6ff7 100644
--- a/llvm/include/llvm/Support/Unicode.h
+++ b/llvm/include/llvm/Support/Unicode.h
@@ -15,6 +15,7 @@
#define LLVM_SUPPORT_UNICODE_H
#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
#include <string>
@@ -36,10 +37,10 @@ enum ColumnWidthErrors {
///
/// Printable codepoints are those in the categories L, M, N, P, S and Zs
/// \return true if the character is considered printable.
-bool isPrintable(int UCS);
+LLVM_ABI bool isPrintable(int UCS);
// Formatting codepoints are codepoints in the Cf category.
-bool isFormatting(int UCS);
+LLVM_ABI bool isFormatting(int UCS);
/// Gets the number of positions the UTF8-encoded \p Text is likely to occupy
/// when output on a terminal ("character width"). This depends on the
@@ -55,11 +56,11 @@ bool isFormatting(int UCS);
/// * 0 for each non-spacing and enclosing combining mark;
/// * 2 for each CJK character excluding halfwidth forms;
/// * 1 for each of the remaining characters.
-int columnWidthUTF8(StringRef Text);
+LLVM_ABI int columnWidthUTF8(StringRef Text);
/// Fold input unicode character according the Simple unicode case folding
/// rules.
-int foldCharSimple(int C);
+LLVM_ABI int foldCharSimple(int C);
/// Maps the name or the alias of a Unicode character to its associated
/// codepoints.
@@ -67,14 +68,14 @@ int foldCharSimple(int C);
/// For compatibility with the semantics of named character escape sequences in
/// C++, this mapping does an exact match sensitive to casing and spacing.
/// \return The codepoint of the corresponding character, if any.
-std::optional<char32_t> nameToCodepointStrict(StringRef Name);
+LLVM_ABI std::optional<char32_t> nameToCodepointStrict(StringRef Name);
struct LooseMatchingResult {
char32_t CodePoint;
SmallString<64> Name;
};
-std::optional<LooseMatchingResult> nameToCodepointLooseMatching(StringRef Name);
+LLVM_ABI std::optional<LooseMatchingResult> nameToCodepointLooseMatching(StringRef Name);
struct MatchForCodepointName {
std::string Name;
@@ -82,7 +83,7 @@ struct MatchForCodepointName {
char32_t Value = 0;
};
-SmallVector<MatchForCodepointName>
+LLVM_ABI SmallVector<MatchForCodepointName>
nearestMatchesForCodepointName(StringRef Pattern, std::size_t MaxMatchesCount);
} // namespace unicode
diff --git a/llvm/include/llvm/Support/Valgrind.h b/llvm/include/llvm/Support/Valgrind.h
index 1e14dfec9a6186..a3c490c7295c4e 100644
--- a/llvm/include/llvm/Support/Valgrind.h
+++ b/llvm/include/llvm/Support/Valgrind.h
@@ -15,16 +15,17 @@
#ifndef LLVM_SUPPORT_VALGRIND_H
#define LLVM_SUPPORT_VALGRIND_H
+#include "llvm/Support/Compiler.h"
#include <cstddef>
namespace llvm {
namespace sys {
// True if Valgrind is controlling this process.
- bool RunningOnValgrind();
+ LLVM_ABI bool RunningOnValgrind();
// Discard valgrind's translation of code in the range [Addr .. Addr + Len).
// Otherwise valgrind may continue to execute the old version of the code.
- void ValgrindDiscardTranslations(const void *Addr, size_t Len);
+ LLVM_ABI void ValgrindDiscardTranslations(const void *Addr, size_t Len);
} // namespace sys
} // end namespace llvm
diff --git a/llvm/include/llvm/Support/VersionTuple.h b/llvm/include/llvm/Support/VersionTuple.h
index 0a4623f049d288..46a9ae17410050 100644
--- a/llvm/include/llvm/Support/VersionTuple.h
+++ b/llvm/include/llvm/Support/VersionTuple.h
@@ -16,6 +16,7 @@
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/Hashing.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
#include <string>
#include <tuple>
@@ -26,7 +27,7 @@ class raw_ostream;
class StringRef;
/// Represents a version number in the form major[.minor[.subminor[.build]]].
-class VersionTuple {
+class LLVM_ABI VersionTuple {
unsigned Major : 32;
unsigned Minor : 31;
@@ -188,7 +189,7 @@ class VersionTuple {
};
/// Print a version number.
-raw_ostream &operator<<(raw_ostream &Out, const VersionTuple &V);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &Out, const VersionTuple &V);
// Provide DenseMapInfo for version tuples.
template <> struct DenseMapInfo<VersionTuple> {
diff --git a/llvm/include/llvm/Support/VirtualFileSystem.h b/llvm/include/llvm/Support/VirtualFileSystem.h
index 2531c075f262d7..7accdc7993af29 100644
--- a/llvm/include/llvm/Support/VirtualFileSystem.h
+++ b/llvm/include/llvm/Support/VirtualFileSystem.h
@@ -19,6 +19,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Chrono.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorOr.h"
@@ -45,7 +46,7 @@ class Twine;
namespace vfs {
/// The result of a \p status operation.
-class Status {
+class LLVM_ABI Status {
std::string Name;
llvm::sys::fs::UniqueID UID;
llvm::sys::TimePoint<> MTime;
@@ -108,7 +109,7 @@ class Status {
};
/// Represents an open file.
-class File {
+class LLVM_ABI File {
public:
/// Destroy the file after closing it (if open).
/// Sub-classes should generally call close() inside their destructors. We
@@ -162,7 +163,7 @@ namespace detail {
/// An interface for virtual file systems to provide an iterator over the
/// (non-recursive) contents of a directory.
-struct DirIterImpl {
+struct LLVM_ABI DirIterImpl {
virtual ~DirIterImpl();
/// Sets \c CurrentEntry to the next entry in the directory on success,
@@ -226,7 +227,7 @@ struct RecDirIterState {
/// An input iterator over the recursive contents of a virtual path,
/// similar to llvm::sys::fs::recursive_directory_iterator.
-class recursive_directory_iterator {
+class LLVM_ABI recursive_directory_iterator {
FileSystem *FS;
std::shared_ptr<detail::RecDirIterState>
State; // Input iterator semantics on copy.
@@ -262,7 +263,7 @@ class recursive_directory_iterator {
};
/// The virtual file system interface.
-class FileSystem : public llvm::ThreadSafeRefCountedBase<FileSystem>,
+class LLVM_ABI FileSystem : public llvm::ThreadSafeRefCountedBase<FileSystem>,
public RTTIExtends<FileSystem, RTTIRoot> {
public:
static const char ID;
@@ -357,13 +358,13 @@ class FileSystem : public llvm::ThreadSafeRefCountedBase<FileSystem>,
/// the operating system.
/// The working directory is linked to the process's working directory.
/// (This is usually thread-hostile).
-IntrusiveRefCntPtr<FileSystem> getRealFileSystem();
+LLVM_ABI IntrusiveRefCntPtr<FileSystem> getRealFileSystem();
/// Create an \p vfs::FileSystem for the 'real' file system, as seen by
/// the operating system.
/// It has its own working directory, independent of (but initially equal to)
/// that of the process.
-std::unique_ptr<FileSystem> createPhysicalFileSystem();
+LLVM_ABI std::unique_ptr<FileSystem> createPhysicalFileSystem();
/// A file system that allows overlaying one \p AbstractFileSystem on top
/// of another.
@@ -375,7 +376,7 @@ std::unique_ptr<FileSystem> createPhysicalFileSystem();
/// top-most (most recently added) directory are used. When there is a file
/// that exists in more than one file system, the file in the top-most file
/// system overrides the other(s).
-class OverlayFileSystem : public RTTIExtends<OverlayFileSystem, FileSystem> {
+class LLVM_ABI OverlayFileSystem : public RTTIExtends<OverlayFileSystem, FileSystem> {
using FileSystemList = SmallVector<IntrusiveRefCntPtr<FileSystem>, 1>;
/// The stack of file systems, implemented as a list in order of
@@ -435,7 +436,7 @@ class OverlayFileSystem : public RTTIExtends<OverlayFileSystem, FileSystem> {
/// By default, this delegates all calls to the underlying file system. This
/// is useful when derived file systems want to override some calls and still
/// proxy other calls.
-class ProxyFileSystem : public RTTIExtends<ProxyFileSystem, FileSystem> {
+class LLVM_ABI ProxyFileSystem : public RTTIExtends<ProxyFileSystem, FileSystem> {
public:
static const char ID;
explicit ProxyFileSystem(IntrusiveRefCntPtr<FileSystem> FS)
@@ -486,7 +487,7 @@ namespace detail {
class InMemoryDirectory;
class InMemoryNode;
-struct NewInMemoryNodeInfo {
+struct LLVM_ABI NewInMemoryNodeInfo {
llvm::sys::fs::UniqueID DirUID;
StringRef Path;
StringRef Name;
@@ -521,7 +522,7 @@ class NamedNodeOrError {
} // namespace detail
/// An in-memory file system.
-class InMemoryFileSystem : public RTTIExtends<InMemoryFileSystem, FileSystem> {
+class LLVM_ABI InMemoryFileSystem : public RTTIExtends<InMemoryFileSystem, FileSystem> {
std::unique_ptr<detail::InMemoryDirectory> Root;
std::string WorkingDirectory;
bool UseNormalizedPaths = true;
@@ -638,11 +639,11 @@ class InMemoryFileSystem : public RTTIExtends<InMemoryFileSystem, FileSystem> {
};
/// Get a globally unique ID for a virtual file or directory.
-llvm::sys::fs::UniqueID getNextVirtualUniqueID();
+LLVM_ABI llvm::sys::fs::UniqueID getNextVirtualUniqueID();
/// Gets a \p FileSystem for a virtual file system described in YAML
/// format.
-std::unique_ptr<FileSystem>
+LLVM_ABI std::unique_ptr<FileSystem>
getVFSFromYAML(std::unique_ptr<llvm::MemoryBuffer> Buffer,
llvm::SourceMgr::DiagHandlerTy DiagHandler,
StringRef YAMLFilePath, void *DiagContext = nullptr,
@@ -761,7 +762,7 @@ class RedirectingFileSystemParser;
/// FIXME: 'use-external-name' causes behaviour that's inconsistent with how
/// "real" filesystems behave. Maybe there should be a separate channel for
/// this information.
-class RedirectingFileSystem
+class LLVM_ABI RedirectingFileSystem
: public RTTIExtends<RedirectingFileSystem, vfs::FileSystem> {
public:
static const char ID;
@@ -895,7 +896,7 @@ class RedirectingFileSystem
};
/// Represents the result of a path lookup into the RedirectingFileSystem.
- struct LookupResult {
+ struct LLVM_ABI LookupResult {
/// Chain of parent directory entries for \c E.
llvm::SmallVector<Entry *, 32> Parents;
@@ -1094,14 +1095,14 @@ class RedirectingFileSystem
/// Collect all pairs of <virtual path, real path> entries from the
/// \p YAMLFilePath. This is used by the module dependency collector to forward
/// the entries into the reproducer output VFS YAML file.
-void collectVFSFromYAML(
+LLVM_ABI void collectVFSFromYAML(
std::unique_ptr<llvm::MemoryBuffer> Buffer,
llvm::SourceMgr::DiagHandlerTy DiagHandler, StringRef YAMLFilePath,
SmallVectorImpl<YAMLVFSEntry> &CollectedEntries,
void *DiagContext = nullptr,
IntrusiveRefCntPtr<FileSystem> ExternalFS = getRealFileSystem());
-class YAMLVFSWriter {
+class LLVM_ABI YAMLVFSWriter {
std::vector<YAMLVFSEntry> Mappings;
std::optional<bool> IsCaseSensitive;
std::optional<bool> IsOverlayRelative;
@@ -1135,7 +1136,7 @@ class YAMLVFSWriter {
/// File system that tracks the number of calls to the underlying file system.
/// This is particularly useful when wrapped around \c RealFileSystem to add
/// lightweight tracking of expensive syscalls.
-class TracingFileSystem
+class LLVM_ABI TracingFileSystem
: public llvm::RTTIExtends<TracingFileSystem, ProxyFileSystem> {
public:
static const char ID;
diff --git a/llvm/include/llvm/Support/Watchdog.h b/llvm/include/llvm/Support/Watchdog.h
index 281595e8f27225..080edb3bd692cc 100644
--- a/llvm/include/llvm/Support/Watchdog.h
+++ b/llvm/include/llvm/Support/Watchdog.h
@@ -22,7 +22,7 @@ namespace llvm {
/// that must complete in a given amount of time. Failure to complete before
/// the timeout is an unrecoverable situation and no mechanisms to attempt
/// to handle it are provided.
- class Watchdog {
+ class LLVM_ABI Watchdog {
public:
Watchdog(unsigned int seconds);
~Watchdog();
diff --git a/llvm/include/llvm/Support/Windows/WindowsSupport.h b/llvm/include/llvm/Support/Windows/WindowsSupport.h
index 6f5aae2485c525..beca3e196a2a3e 100644
--- a/llvm/include/llvm/Support/Windows/WindowsSupport.h
+++ b/llvm/include/llvm/Support/Windows/WindowsSupport.h
@@ -55,18 +55,18 @@ namespace llvm {
/// reimplements one of the helpers in the Windows 8.1 SDK, which are intended
/// to supercede raw calls to GetVersionEx. Old SDKs, Cygwin, and MinGW don't
/// yet have VersionHelpers.h, so we have our own helper.
-bool RunningWindows8OrGreater();
+LLVM_ABI bool RunningWindows8OrGreater();
/// Determines if the program is running on Windows 11 or Windows Server 2022.
-bool RunningWindows11OrGreater();
+LLVM_ABI bool RunningWindows11OrGreater();
/// Returns the Windows version as Major.Minor.0.BuildNumber. Uses
/// RtlGetVersion or GetVersionEx under the hood depending on what is available.
/// GetVersionEx is deprecated, but this API exposes the build number which can
/// be useful for working around certain kernel bugs.
-llvm::VersionTuple GetWindowsOSVersion();
+LLVM_ABI llvm::VersionTuple GetWindowsOSVersion();
-bool MakeErrMsg(std::string *ErrMsg, const std::string &prefix);
+LLVM_ABI bool MakeErrMsg(std::string *ErrMsg, const std::string &prefix);
// Include GetLastError() in a fatal error message.
[[noreturn]] inline void ReportLastErrorFatal(const char *Msg) {
@@ -235,12 +235,12 @@ namespace windows {
// Returns command line arguments. Unlike arguments given to main(),
// this function guarantees that the returned arguments are encoded in
// UTF-8 regardless of the current code page setting.
-std::error_code GetCommandLineArguments(SmallVectorImpl<const char *> &Args,
+LLVM_ABI std::error_code GetCommandLineArguments(SmallVectorImpl<const char *> &Args,
BumpPtrAllocator &Alloc);
/// Convert UTF-8 path to a suitable UTF-16 path for use with the Win32 Unicode
/// File API.
-std::error_code widenPath(const Twine &Path8, SmallVectorImpl<wchar_t> &Path16,
+LLVM_ABI std::error_code widenPath(const Twine &Path8, SmallVectorImpl<wchar_t> &Path16,
size_t MaxPathLen = MAX_PATH);
} // end namespace windows
diff --git a/llvm/include/llvm/Support/WindowsError.h b/llvm/include/llvm/Support/WindowsError.h
index d11e9019f58156..f42c61bbb032c6 100644
--- a/llvm/include/llvm/Support/WindowsError.h
+++ b/llvm/include/llvm/Support/WindowsError.h
@@ -9,11 +9,12 @@
#ifndef LLVM_SUPPORT_WINDOWSERROR_H
#define LLVM_SUPPORT_WINDOWSERROR_H
+#include "llvm/Support/Compiler.h"
#include <system_error>
namespace llvm {
-std::error_code mapLastWindowsError();
-std::error_code mapWindowsError(unsigned EV);
+LLVM_ABI std::error_code mapLastWindowsError();
+LLVM_ABI std::error_code mapWindowsError(unsigned EV);
}
#endif
diff --git a/llvm/include/llvm/Support/WithColor.h b/llvm/include/llvm/Support/WithColor.h
index e80e5d469363db..8dadb5e6765a47 100644
--- a/llvm/include/llvm/Support/WithColor.h
+++ b/llvm/include/llvm/Support/WithColor.h
@@ -21,7 +21,7 @@ namespace cl {
class OptionCategory;
}
-extern cl::OptionCategory &getColorCategory();
+LLVM_ABI extern cl::OptionCategory &getColorCategory();
// Symbolic names for various syntax elements.
enum class HighlightColor {
@@ -51,7 +51,7 @@ enum class ColorMode {
/// An RAII object that temporarily switches an output stream to a specific
/// color.
-class WithColor {
+class LLVM_ABI WithColor {
public:
using AutoDetectFunctionType = bool (*)(const raw_ostream &OS);
diff --git a/llvm/include/llvm/Support/YAMLParser.h b/llvm/include/llvm/Support/YAMLParser.h
index 9d95a1e13a0dff..4f9f3cd91d6a12 100644
--- a/llvm/include/llvm/Support/YAMLParser.h
+++ b/llvm/include/llvm/Support/YAMLParser.h
@@ -38,6 +38,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SourceMgr.h"
#include <cassert>
@@ -65,25 +66,25 @@ struct Token;
/// Dump all the tokens in this stream to OS.
/// \returns true if there was an error, false otherwise.
-bool dumpTokens(StringRef Input, raw_ostream &);
+LLVM_ABI bool dumpTokens(StringRef Input, raw_ostream &);
/// Scans all tokens in input without outputting anything. This is used
/// for benchmarking the tokenizer.
/// \returns true if there was an error, false otherwise.
-bool scanTokens(StringRef Input);
+LLVM_ABI bool scanTokens(StringRef Input);
/// Escape \a Input for a double quoted scalar; if \p EscapePrintable
/// is true, all UTF8 sequences will be escaped, if \p EscapePrintable is
/// false, those UTF8 sequences encoding printable unicode scalars will not be
/// escaped, but emitted verbatim.
-std::string escape(StringRef Input, bool EscapePrintable = true);
+LLVM_ABI std::string escape(StringRef Input, bool EscapePrintable = true);
/// Parse \p S as a bool according to https://yaml.org/type/bool.html.
-std::optional<bool> parseBool(StringRef S);
+LLVM_ABI std::optional<bool> parseBool(StringRef S);
/// This class represents a YAML stream potentially containing multiple
/// documents.
-class Stream {
+class LLVM_ABI Stream {
public:
/// This keeps a reference to the string referenced by \p Input.
Stream(StringRef Input, SourceMgr &, bool ShowColors = true,
@@ -116,7 +117,7 @@ class Stream {
};
/// Abstract base class for all Nodes.
-class Node {
+class LLVM_ABI Node {
virtual void anchor();
public:
@@ -194,7 +195,7 @@ class Node {
///
/// Example:
/// !!null null
-class NullNode final : public Node {
+class LLVM_ABI NullNode final : public Node {
void anchor() override;
public:
@@ -209,7 +210,7 @@ class NullNode final : public Node {
///
/// Example:
/// Adena
-class ScalarNode final : public Node {
+class LLVM_ABI ScalarNode final : public Node {
void anchor() override;
public:
@@ -257,7 +258,7 @@ class ScalarNode final : public Node {
/// |
/// Hello
/// World
-class BlockScalarNode final : public Node {
+class LLVM_ABI BlockScalarNode final : public Node {
void anchor() override;
public:
@@ -287,7 +288,7 @@ class BlockScalarNode final : public Node {
///
/// Example:
/// Section: .text
-class KeyValueNode final : public Node {
+class LLVM_ABI KeyValueNode final : public Node {
void anchor() override;
public:
@@ -416,7 +417,7 @@ template <class CollectionType> void skip(CollectionType &C) {
/// Example:
/// Name: _main
/// Scope: Global
-class MappingNode final : public Node {
+class LLVM_ABI MappingNode final : public Node {
void anchor() override;
public:
@@ -464,7 +465,7 @@ class MappingNode final : public Node {
/// Example:
/// - Hello
/// - World
-class SequenceNode final : public Node {
+class LLVM_ABI SequenceNode final : public Node {
void anchor() override;
public:
@@ -516,7 +517,7 @@ class SequenceNode final : public Node {
///
/// Example:
/// *AnchorName
-class AliasNode final : public Node {
+class LLVM_ABI AliasNode final : public Node {
void anchor() override;
public:
@@ -533,7 +534,7 @@ class AliasNode final : public Node {
/// A YAML Stream is a sequence of Documents. A document contains a root
/// node.
-class Document {
+class LLVM_ABI Document {
public:
Document(Stream &ParentStream);
diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h
index 1d04783753d5cd..23474986180c4a 100644
--- a/llvm/include/llvm/Support/YAMLTraits.h
+++ b/llvm/include/llvm/Support/YAMLTraits.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/Twine.h"
#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SourceMgr.h"
@@ -774,7 +775,7 @@ struct unvalidatedMappingTraits
!has_MappingValidateTraits<T, Context>::value> {};
// Base class for Input and Output.
-class IO {
+class LLVM_ABI IO {
public:
IO(void *Ctxt = nullptr);
virtual ~IO();
@@ -1202,91 +1203,91 @@ yamlize(IO &io, T &Seq, bool, Context &Ctx) {
}
template<>
-struct ScalarTraits<bool> {
+struct LLVM_ABI ScalarTraits<bool> {
static void output(const bool &, void* , raw_ostream &);
static StringRef input(StringRef, void *, bool &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<StringRef> {
+struct LLVM_ABI ScalarTraits<StringRef> {
static void output(const StringRef &, void *, raw_ostream &);
static StringRef input(StringRef, void *, StringRef &);
static QuotingType mustQuote(StringRef S) { return needsQuotes(S); }
};
template<>
-struct ScalarTraits<std::string> {
+struct LLVM_ABI ScalarTraits<std::string> {
static void output(const std::string &, void *, raw_ostream &);
static StringRef input(StringRef, void *, std::string &);
static QuotingType mustQuote(StringRef S) { return needsQuotes(S); }
};
template<>
-struct ScalarTraits<uint8_t> {
+struct LLVM_ABI ScalarTraits<uint8_t> {
static void output(const uint8_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, uint8_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<uint16_t> {
+struct LLVM_ABI ScalarTraits<uint16_t> {
static void output(const uint16_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, uint16_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<uint32_t> {
+struct LLVM_ABI ScalarTraits<uint32_t> {
static void output(const uint32_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, uint32_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<uint64_t> {
+struct LLVM_ABI ScalarTraits<uint64_t> {
static void output(const uint64_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, uint64_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<int8_t> {
+struct LLVM_ABI ScalarTraits<int8_t> {
static void output(const int8_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, int8_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<int16_t> {
+struct LLVM_ABI ScalarTraits<int16_t> {
static void output(const int16_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, int16_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<int32_t> {
+struct LLVM_ABI ScalarTraits<int32_t> {
static void output(const int32_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, int32_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<int64_t> {
+struct LLVM_ABI ScalarTraits<int64_t> {
static void output(const int64_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, int64_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<float> {
+struct LLVM_ABI ScalarTraits<float> {
static void output(const float &, void *, raw_ostream &);
static StringRef input(StringRef, void *, float &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<double> {
+struct LLVM_ABI ScalarTraits<double> {
static void output(const double &, void *, raw_ostream &);
static StringRef input(StringRef, void *, double &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
@@ -1431,7 +1432,7 @@ struct MappingNormalizationHeap {
/// the mapRequired() method calls may not be in the same order
/// as the keys in the document.
///
-class Input : public IO {
+class LLVM_ABI Input : public IO {
public:
// Construct a yaml Input object from a StringRef and optional
// user-data. The DiagHandler can be specified to provide
@@ -1589,7 +1590,7 @@ class Input : public IO {
/// The Output class is used to generate a yaml document from in-memory structs
/// and vectors.
///
-class Output : public IO {
+class LLVM_ABI Output : public IO {
public:
Output(raw_ostream &, void *Ctxt = nullptr, int WrapColumn = 70);
~Output() override;
@@ -1747,34 +1748,34 @@ LLVM_YAML_STRONG_TYPEDEF(uint32_t, Hex32)
LLVM_YAML_STRONG_TYPEDEF(uint64_t, Hex64)
template<>
-struct ScalarTraits<Hex8> {
+struct LLVM_ABI ScalarTraits<Hex8> {
static void output(const Hex8 &, void *, raw_ostream &);
static StringRef input(StringRef, void *, Hex8 &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<Hex16> {
+struct LLVM_ABI ScalarTraits<Hex16> {
static void output(const Hex16 &, void *, raw_ostream &);
static StringRef input(StringRef, void *, Hex16 &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<Hex32> {
+struct LLVM_ABI ScalarTraits<Hex32> {
static void output(const Hex32 &, void *, raw_ostream &);
static StringRef input(StringRef, void *, Hex32 &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template<>
-struct ScalarTraits<Hex64> {
+struct LLVM_ABI ScalarTraits<Hex64> {
static void output(const Hex64 &, void *, raw_ostream &);
static StringRef input(StringRef, void *, Hex64 &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template <> struct ScalarTraits<VersionTuple> {
+template <> struct LLVM_ABI ScalarTraits<VersionTuple> {
static void output(const VersionTuple &Value, void *, llvm::raw_ostream &Out);
static StringRef input(StringRef, void *, VersionTuple &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
diff --git a/llvm/include/llvm/Support/circular_raw_ostream.h b/llvm/include/llvm/Support/circular_raw_ostream.h
index 17fb8fa0e476f6..7ecf6b75ca1980 100644
--- a/llvm/include/llvm/Support/circular_raw_ostream.h
+++ b/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/Compiler.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
@@ -21,7 +22,7 @@ namespace llvm {
/// 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 LLVM_ABI 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
diff --git a/llvm/include/llvm/Support/raw_os_ostream.h b/llvm/include/llvm/Support/raw_os_ostream.h
index c51a94da3a28d2..72091438f94f35 100644
--- a/llvm/include/llvm/Support/raw_os_ostream.h
+++ b/llvm/include/llvm/Support/raw_os_ostream.h
@@ -13,6 +13,7 @@
#ifndef LLVM_SUPPORT_RAW_OS_OSTREAM_H
#define LLVM_SUPPORT_RAW_OS_OSTREAM_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
#include <iosfwd>
@@ -21,7 +22,7 @@ namespace llvm {
/// raw_os_ostream - A raw_ostream that writes to an std::ostream. This is a
/// simple adaptor class. It does not check for output errors; clients should
/// use the underlying stream to detect errors.
-class raw_os_ostream : public raw_ostream {
+class LLVM_ABI raw_os_ostream : public raw_ostream {
std::ostream &OS;
/// write_impl - See raw_ostream::write_impl.
diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h
index d3b411590e7fd7..e58732b49dc54b 100644
--- a/llvm/include/llvm/Support/raw_ostream.h
+++ b/llvm/include/llvm/Support/raw_ostream.h
@@ -15,6 +15,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include <cassert>
#include <cstddef>
@@ -49,7 +50,7 @@ class FileLocker;
/// output to a stream. It does not support seeking, reopening, rewinding, line
/// buffered disciplines etc. It is a simple buffer that outputs
/// a chunk at a time.
-class raw_ostream {
+class LLVM_ABI raw_ostream {
public:
// Class kinds to support LLVM-style RTTI.
enum class OStreamKind {
@@ -431,7 +432,7 @@ operator<<(OStream &&OS, const T &Value) {
/// An abstract base class for streams implementations that also support a
/// pwrite operation. This is useful for code that can mostly stream out data,
/// but needs to patch in a header that needs to know the output size.
-class raw_pwrite_stream : public raw_ostream {
+class LLVM_ABI raw_pwrite_stream : public raw_ostream {
virtual void pwrite_impl(const char *Ptr, size_t Size, uint64_t Offset) = 0;
void anchor() override;
@@ -457,7 +458,7 @@ class raw_pwrite_stream : public raw_ostream {
/// A raw_ostream that writes to a file descriptor.
///
-class raw_fd_ostream : public raw_pwrite_stream {
+class LLVM_ABI raw_fd_ostream : public raw_pwrite_stream {
int FD;
bool ShouldClose;
bool SupportsSeeking = false;
@@ -607,17 +608,17 @@ class raw_fd_ostream : public raw_pwrite_stream {
/// This returns a reference to a raw_fd_ostream for standard output. Use it
/// like: outs() << "foo" << "bar";
-raw_fd_ostream &outs();
+LLVM_ABI raw_fd_ostream &outs();
/// This returns a reference to a raw_ostream for standard error.
/// Use it like: errs() << "foo" << "bar";
/// By default, the stream is tied to stdout to ensure stdout is flushed before
/// stderr is written, to ensure the error messages are written in their
/// expected place.
-raw_fd_ostream &errs();
+LLVM_ABI raw_fd_ostream &errs();
/// This returns a reference to a raw_ostream which simply discards output.
-raw_ostream &nulls();
+LLVM_ABI raw_ostream &nulls();
//===----------------------------------------------------------------------===//
// File Streams
@@ -625,7 +626,7 @@ raw_ostream &nulls();
/// A raw_ostream of a file for reading/writing/seeking.
///
-class raw_fd_stream : public raw_fd_ostream {
+class LLVM_ABI raw_fd_stream : public raw_fd_ostream {
public:
/// Open the specified file for reading/writing/seeking. If an error occurs,
/// information about the error is put into EC, and the stream should be
@@ -658,7 +659,7 @@ class raw_fd_stream : public raw_fd_ostream {
/// raw_string_ostream operates without a buffer, delegating all memory
/// management to the std::string. Thus the std::string is always up-to-date,
/// may be used directly and there is no need to call flush().
-class raw_string_ostream : public raw_ostream {
+class LLVM_ABI raw_string_ostream : public raw_ostream {
std::string &OS;
/// See raw_ostream::write_impl.
@@ -688,7 +689,7 @@ class raw_string_ostream : public raw_ostream {
/// raw_svector_ostream operates without a buffer, delegating all memory
/// management to the SmallString. Thus the SmallString is always up-to-date,
/// may be used directly and there is no need to call flush().
-class raw_svector_ostream : public raw_pwrite_stream {
+class LLVM_ABI raw_svector_ostream : public raw_pwrite_stream {
SmallVectorImpl<char> &OS;
/// See raw_ostream::write_impl.
@@ -728,7 +729,7 @@ class raw_svector_ostream : public raw_pwrite_stream {
};
/// A raw_ostream that discards all output.
-class raw_null_ostream : public raw_pwrite_stream {
+class LLVM_ABI raw_null_ostream : public raw_pwrite_stream {
/// See raw_ostream::write_impl.
void write_impl(const char *Ptr, size_t size) override;
void pwrite_impl(const char *Ptr, size_t Size, uint64_t Offset) override;
@@ -742,7 +743,7 @@ class raw_null_ostream : public raw_pwrite_stream {
~raw_null_ostream() override;
};
-class buffer_ostream : public raw_svector_ostream {
+class LLVM_ABI buffer_ostream : public raw_svector_ostream {
raw_ostream &OS;
SmallVector<char, 0> Buffer;
@@ -753,7 +754,7 @@ class buffer_ostream : public raw_svector_ostream {
~buffer_ostream() override { OS << str(); }
};
-class buffer_unique_ostream : public raw_svector_ostream {
+class LLVM_ABI buffer_unique_ostream : public raw_svector_ostream {
std::unique_ptr<raw_ostream> OS;
SmallVector<char, 0> Buffer;
@@ -835,10 +836,10 @@ class Error;
/// for other names. For raw_fd_ostream instances, the stream writes to
/// a temporary file. The final output file is atomically replaced with the
/// temporary file after the \p Write function is finished.
-Error writeToOutput(StringRef OutputFileName,
+LLVM_ABI Error writeToOutput(StringRef OutputFileName,
std::function<Error(raw_ostream &)> Write);
-raw_ostream &operator<<(raw_ostream &OS, std::nullopt_t);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, std::nullopt_t);
template <typename T, typename = decltype(std::declval<raw_ostream &>()
<< std::declval<const T &>())>
diff --git a/llvm/include/llvm/Support/raw_socket_stream.h b/llvm/include/llvm/Support/raw_socket_stream.h
index 6c65a66dec9a4a..87a9e30532de76 100644
--- a/llvm/include/llvm/Support/raw_socket_stream.h
+++ b/llvm/include/llvm/Support/raw_socket_stream.h
@@ -14,6 +14,7 @@
#ifndef LLVM_SUPPORT_RAW_SOCKET_STREAM_H
#define LLVM_SUPPORT_RAW_SOCKET_STREAM_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Threading.h"
#include "llvm/Support/raw_ostream.h"
@@ -28,7 +29,7 @@ class raw_socket_stream;
/// Ensures proper initialization and cleanup of winsock resources
///
/// Make sure that calls to WSAStartup and WSACleanup are balanced.
-class WSABalancer {
+class LLVM_ABI WSABalancer {
public:
WSABalancer();
~WSABalancer();
@@ -56,7 +57,7 @@ class WSABalancer {
/// }
/// \endcode
///
-class ListeningSocket {
+class LLVM_ABI ListeningSocket {
std::atomic<int> FD;
std::string SocketPath; // Not modified after construction
@@ -117,7 +118,7 @@ class ListeningSocket {
// raw_socket_stream
//===----------------------------------------------------------------------===//
-class raw_socket_stream : public raw_fd_stream {
+class LLVM_ABI raw_socket_stream : public raw_fd_stream {
uint64_t current_pos() const override { return 0; }
#ifdef _WIN32
WSABalancer _;
diff --git a/llvm/include/llvm/Support/thread.h b/llvm/include/llvm/Support/thread.h
index 69c06c050aac5f..1fc9fc7ea93c37 100644
--- a/llvm/include/llvm/Support/thread.h
+++ b/llvm/include/llvm/Support/thread.h
@@ -17,6 +17,7 @@
#define LLVM_SUPPORT_THREAD_H
#include "llvm/Config/llvm-config.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
#ifdef _WIN32
@@ -35,7 +36,7 @@ namespace llvm {
/// LLVM thread following std::thread interface with added constructor to
/// specify stack size.
-class thread {
+class LLVM_ABI thread {
template <typename CalleeTuple> static void GenericThreadProxy(void *Ptr) {
std::unique_ptr<CalleeTuple> Callee(static_cast<CalleeTuple *>(Ptr));
std::apply(
@@ -113,13 +114,13 @@ class thread {
native_handle_type Thread;
};
-thread::native_handle_type
+LLVM_ABI thread::native_handle_type
llvm_execute_on_thread_impl(thread::start_routine_type ThreadFunc, void *Arg,
std::optional<unsigned> StackSizeInBytes);
-void llvm_thread_join_impl(thread::native_handle_type Thread);
-void llvm_thread_detach_impl(thread::native_handle_type Thread);
-thread::id llvm_thread_get_id_impl(thread::native_handle_type Thread);
-thread::id llvm_thread_get_current_id_impl();
+LLVM_ABI void llvm_thread_join_impl(thread::native_handle_type Thread);
+LLVM_ABI void llvm_thread_detach_impl(thread::native_handle_type Thread);
+LLVM_ABI thread::id llvm_thread_get_id_impl(thread::native_handle_type Thread);
+LLVM_ABI thread::id llvm_thread_get_current_id_impl();
template <class Function, class... Args>
thread::thread(std::optional<unsigned> StackSizeInBytes, Function &&f,
diff --git a/llvm/include/llvm/Support/xxhash.h b/llvm/include/llvm/Support/xxhash.h
index 5f8a7ab360abe2..b521adbef34560 100644
--- a/llvm/include/llvm/Support/xxhash.h
+++ b/llvm/include/llvm/Support/xxhash.h
@@ -40,13 +40,14 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
-uint64_t xxHash64(llvm::StringRef Data);
-uint64_t xxHash64(llvm::ArrayRef<uint8_t> Data);
+LLVM_ABI uint64_t xxHash64(llvm::StringRef Data);
+LLVM_ABI uint64_t xxHash64(llvm::ArrayRef<uint8_t> Data);
-uint64_t xxh3_64bits(ArrayRef<uint8_t> data);
+LLVM_ABI uint64_t xxh3_64bits(ArrayRef<uint8_t> data);
inline uint64_t xxh3_64bits(StringRef data) {
return xxh3_64bits(ArrayRef(data.bytes_begin(), data.size()));
}
@@ -72,7 +73,7 @@ struct XXH128_hash_t {
};
/// XXH3's 128-bit variant.
-XXH128_hash_t xxh3_128bits(ArrayRef<uint8_t> data);
+LLVM_ABI XXH128_hash_t xxh3_128bits(ArrayRef<uint8_t> data);
} // namespace llvm
>From 9422085f30f8062b9caee6f0a3940034992f0067 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Sun, 20 Oct 2024 18:08:16 +0100
Subject: [PATCH 2/4] Add explicit visibility macros to Support source files
---
llvm/lib/Support/CommandLine.cpp | 37 ++++++++++++++++----------------
llvm/lib/Support/Debug.cpp | 5 +++--
llvm/lib/Support/SmallVector.cpp | 5 +++--
3 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index e34a770b1b53e5..1fd91faec50ff8 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -29,6 +29,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Config/config.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Error.h"
@@ -54,24 +55,24 @@ using namespace cl;
//
namespace llvm {
namespace cl {
-template class basic_parser<bool>;
-template class basic_parser<boolOrDefault>;
-template class basic_parser<int>;
-template class basic_parser<long>;
-template class basic_parser<long long>;
-template class basic_parser<unsigned>;
-template class basic_parser<unsigned long>;
-template class basic_parser<unsigned long long>;
-template class basic_parser<double>;
-template class basic_parser<float>;
-template class basic_parser<std::string>;
-template class basic_parser<char>;
-
-template class opt<unsigned>;
-template class opt<int>;
-template class opt<std::string>;
-template class opt<char>;
-template class opt<bool>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<bool>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<boolOrDefault>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<int>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<long>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<long long>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<unsigned>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<unsigned long>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<unsigned long long>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<double>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<float>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<std::string>;
+template class LLVM_EXPORT_TEMPLATE basic_parser<char>;
+
+template class LLVM_EXPORT_TEMPLATE opt<unsigned>;
+template class LLVM_EXPORT_TEMPLATE opt<int>;
+template class LLVM_EXPORT_TEMPLATE opt<std::string>;
+template class LLVM_EXPORT_TEMPLATE opt<char>;
+template class LLVM_EXPORT_TEMPLATE opt<bool>;
} // namespace cl
} // namespace llvm
diff --git a/llvm/lib/Support/Debug.cpp b/llvm/lib/Support/Debug.cpp
index 98a9ac4722b50e..4a9b277cda924a 100644
--- a/llvm/lib/Support/Debug.cpp
+++ b/llvm/lib/Support/Debug.cpp
@@ -25,6 +25,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/circular_raw_ostream.h"
@@ -42,7 +43,7 @@ using namespace llvm;
// built without NDEBUG can depend on via the llvm/Support/Debug.h header.
namespace llvm {
/// Exported boolean set by the -debug option.
-bool DebugFlag = false;
+LLVM_ABI bool DebugFlag = false;
static ManagedStatic<std::vector<std::string>> CurrentDebugType;
@@ -193,4 +194,4 @@ void llvm::initDebugOptions() {}
/// EnableDebugBuffering - Turn on signal handler installation.
///
-bool llvm::EnableDebugBuffering = false;
+LLVM_ABI bool llvm::EnableDebugBuffering = false;
diff --git a/llvm/lib/Support/SmallVector.cpp b/llvm/lib/Support/SmallVector.cpp
index dceea4fbc630e8..bbb38eeb96af53 100644
--- a/llvm/lib/Support/SmallVector.cpp
+++ b/llvm/lib/Support/SmallVector.cpp
@@ -12,6 +12,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MemAlloc.h"
#include <cstdint>
#ifdef LLVM_ENABLE_EXCEPTIONS
@@ -164,14 +165,14 @@ void SmallVectorBase<Size_T>::grow_pod(void *FirstEl, size_t MinSize,
this->set_allocation_range(NewElts, NewCapacity);
}
-template class llvm::SmallVectorBase<uint32_t>;
+template class LLVM_EXPORT_TEMPLATE llvm::SmallVectorBase<uint32_t>;
// Disable the uint64_t instantiation for 32-bit builds.
// Both uint32_t and uint64_t instantiations are needed for 64-bit builds.
// This instantiation will never be used in 32-bit builds, and will cause
// warnings when sizeof(Size_T) > sizeof(size_t).
#if SIZE_MAX > UINT32_MAX
-template class llvm::SmallVectorBase<uint64_t>;
+template class LLVM_EXPORT_TEMPLATE llvm::SmallVectorBase<uint64_t>;
// Assertions to ensure this #if stays in sync with SmallVectorSizeType.
static_assert(sizeof(SmallVectorSizeType<char>) == sizeof(uint64_t),
>From 39ade94d68901554967282ae298852fdabba22a0 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Tue, 19 Nov 2024 22:18:28 +0000
Subject: [PATCH 3/4] Reformat changes
---
llvm/include/llvm/Support/ARMWinEH.h | 4 +-
llvm/include/llvm/Support/Allocator.h | 5 +-
llvm/include/llvm/Support/Atomic.h | 11 +-
llvm/include/llvm/Support/Base64.h | 3 +-
llvm/include/llvm/Support/BlockFrequency.h | 2 +-
llvm/include/llvm/Support/CachePruning.h | 8 +-
llvm/include/llvm/Support/Chrono.h | 30 +-
llvm/include/llvm/Support/CommandLine.h | 70 +++--
llvm/include/llvm/Support/Compression.h | 32 ++-
llvm/include/llvm/Support/ConvertEBCDIC.h | 2 +-
llvm/include/llvm/Support/ConvertUTF.h | 91 +++---
llvm/include/llvm/Support/ELFAttributes.h | 5 +-
llvm/include/llvm/Support/Error.h | 6 +-
llvm/include/llvm/Support/ErrorHandling.h | 99 ++++---
llvm/include/llvm/Support/FileSystem.h | 110 ++++----
llvm/include/llvm/Support/FileUtilities.h | 79 +++---
llvm/include/llvm/Support/GraphWriter.h | 2 +-
llvm/include/llvm/Support/JSON.h | 5 +-
llvm/include/llvm/Support/Locale.h | 1 -
llvm/include/llvm/Support/Memory.h | 3 +-
llvm/include/llvm/Support/NativeFormatting.h | 19 +-
.../llvm/Support/OptimizedStructLayout.h | 2 +-
llvm/include/llvm/Support/OptionStrCmp.h | 4 +-
llvm/include/llvm/Support/Parallel.h | 3 +-
llvm/include/llvm/Support/Path.h | 43 +--
llvm/include/llvm/Support/PluginLoader.h | 10 +-
llvm/include/llvm/Support/PrettyStackTrace.h | 6 +-
llvm/include/llvm/Support/Process.h | 1 -
llvm/include/llvm/Support/Program.h | 49 ++--
llvm/include/llvm/Support/Recycler.h | 3 +-
llvm/include/llvm/Support/ScaledNumber.h | 6 +-
llvm/include/llvm/Support/Signals.h | 171 ++++++------
llvm/include/llvm/Support/SipHash.h | 4 +-
llvm/include/llvm/Support/TimeProfiler.h | 15 +-
llvm/include/llvm/Support/TypeSize.h | 3 +-
llvm/include/llvm/Support/Unicode.h | 3 +-
llvm/include/llvm/Support/Valgrind.h | 8 +-
llvm/include/llvm/Support/VirtualFileSystem.h | 11 +-
llvm/include/llvm/Support/Watchdog.h | 19 +-
.../llvm/Support/Windows/WindowsSupport.h | 10 +-
llvm/include/llvm/Support/YAMLTraits.h | 51 ++--
.../llvm/Support/circular_raw_ostream.h | 262 +++++++++---------
llvm/include/llvm/Support/raw_ostream.h | 2 +-
43 files changed, 671 insertions(+), 602 deletions(-)
diff --git a/llvm/include/llvm/Support/ARMWinEH.h b/llvm/include/llvm/Support/ARMWinEH.h
index 3c952bcae5f027..083bbf405a6b61 100644
--- a/llvm/include/llvm/Support/ARMWinEH.h
+++ b/llvm/include/llvm/Support/ARMWinEH.h
@@ -206,8 +206,8 @@ inline uint16_t StackAdjustment(const RuntimeFunction &RF) {
/// SavedRegisterMask - Utility function to calculate the set of saved general
/// purpose (r0-r15) and VFP (d0-d31) registers.
-LLVM_ABI std::pair<uint16_t, uint32_t> SavedRegisterMask(const RuntimeFunction &RF,
- bool Prologue = true);
+LLVM_ABI std::pair<uint16_t, uint32_t>
+SavedRegisterMask(const RuntimeFunction &RF, bool Prologue = true);
/// RuntimeFunctionARM64 - An entry in the table of procedure data (.pdata)
///
diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h
index 36561cf5d5a93d..59934190a52062 100644
--- a/llvm/include/llvm/Support/Allocator.h
+++ b/llvm/include/llvm/Support/Allocator.h
@@ -36,8 +36,9 @@ namespace detail {
// We call out to an external function to actually print the message as the
// printing code uses Allocator.h in its implementation.
-LLVM_ABI void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated,
- size_t TotalMemory);
+LLVM_ABI void printBumpPtrAllocatorStats(unsigned NumSlabs,
+ size_t BytesAllocated,
+ size_t TotalMemory);
} // end namespace detail
diff --git a/llvm/include/llvm/Support/Atomic.h b/llvm/include/llvm/Support/Atomic.h
index 43df01462b59c3..c2d9ae2da231c5 100644
--- a/llvm/include/llvm/Support/Atomic.h
+++ b/llvm/include/llvm/Support/Atomic.h
@@ -27,16 +27,15 @@
namespace llvm {
namespace sys {
- LLVM_ABI void MemoryFence();
+ LLVM_ABI void MemoryFence();
#ifdef _MSC_VER
- typedef long cas_flag;
+ typedef long cas_flag;
#else
- typedef uint32_t cas_flag;
+ typedef uint32_t cas_flag;
#endif
- LLVM_ABI cas_flag CompareAndSwap(volatile cas_flag* ptr,
- cas_flag new_value,
- cas_flag old_value);
+ LLVM_ABI cas_flag CompareAndSwap(volatile cas_flag *ptr, cas_flag new_value,
+ cas_flag old_value);
}
}
diff --git a/llvm/include/llvm/Support/Base64.h b/llvm/include/llvm/Support/Base64.h
index 997e8c0b7124e1..0dbd87b37868d6 100644
--- a/llvm/include/llvm/Support/Base64.h
+++ b/llvm/include/llvm/Support/Base64.h
@@ -55,7 +55,8 @@ template <class InputBytes> std::string encodeBase64(InputBytes const &Bytes) {
return Buffer;
}
-LLVM_ABI llvm::Error decodeBase64(llvm::StringRef Input, std::vector<char> &Output);
+LLVM_ABI llvm::Error decodeBase64(llvm::StringRef Input,
+ std::vector<char> &Output);
} // end namespace llvm
diff --git a/llvm/include/llvm/Support/BlockFrequency.h b/llvm/include/llvm/Support/BlockFrequency.h
index 4f630d28f72d63..ccae75dc51ad9e 100644
--- a/llvm/include/llvm/Support/BlockFrequency.h
+++ b/llvm/include/llvm/Support/BlockFrequency.h
@@ -122,7 +122,7 @@ class LLVM_ABI BlockFrequency {
};
LLVM_ABI void printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq,
- BlockFrequency Freq);
+ BlockFrequency Freq);
} // namespace llvm
diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h
index 50d5ea41ec9ba9..a677a684a221a4 100644
--- a/llvm/include/llvm/Support/CachePruning.h
+++ b/llvm/include/llvm/Support/CachePruning.h
@@ -67,7 +67,8 @@ struct CachePruningPolicy {
/// For example: "prune_interval=30s:prune_after=24h:cache_size=50%"
/// which means a pruning interval of 30 seconds, expiration time of 24 hours
/// and maximum cache size of 50% of available disk space.
-LLVM_ABI Expected<CachePruningPolicy> parseCachePruningPolicy(StringRef PolicyStr);
+LLVM_ABI Expected<CachePruningPolicy>
+parseCachePruningPolicy(StringRef PolicyStr);
/// Peform pruning using the supplied policy, returns true if pruning
/// occurred, i.e. if Policy.Interval was expired.
@@ -80,8 +81,9 @@ LLVM_ABI Expected<CachePruningPolicy> parseCachePruningPolicy(StringRef PolicySt
/// 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-*".
-LLVM_ABI bool pruneCache(StringRef Path, CachePruningPolicy Policy,
- const std::vector<std::unique_ptr<MemoryBuffer>> &Files = {});
+LLVM_ABI bool
+pruneCache(StringRef Path, CachePruningPolicy Policy,
+ const std::vector<std::unique_ptr<MemoryBuffer>> &Files = {});
} // namespace llvm
#endif
diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h
index e20cd30687d915..f31bd624da8250 100644
--- a/llvm/include/llvm/Support/Chrono.h
+++ b/llvm/include/llvm/Support/Chrono.h
@@ -88,13 +88,13 @@ LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, sys::UtcTime<> TP);
/// - %N is nanos: 000000000 - 999999999
///
/// If no options are given, the default format is "%Y-%m-%d %H:%M:%S.%N".
-template <>
-struct LLVM_ABI format_provider<sys::TimePoint<>> {
+template <> struct LLVM_ABI format_provider<sys::TimePoint<>> {
static void format(const sys::TimePoint<> &TP, llvm::raw_ostream &OS,
StringRef Style);
};
-template <> struct LLVM_ABI format_provider<sys::UtcTime<std::chrono::seconds>> {
+template <>
+struct LLVM_ABI format_provider<sys::UtcTime<std::chrono::seconds>> {
static void format(const sys::UtcTime<std::chrono::seconds> &TP,
llvm::raw_ostream &OS, StringRef Style);
};
@@ -103,12 +103,24 @@ namespace detail {
template <typename Period> struct unit { static const char value[]; };
template <typename Period> const char unit<Period>::value[] = "";
-template <> struct LLVM_ABI unit<std::ratio<3600>> { static const char value[]; };
-template <> struct LLVM_ABI unit<std::ratio<60>> { static const char value[]; };
-template <> struct LLVM_ABI unit<std::ratio<1>> { static const char value[]; };
-template <> struct LLVM_ABI unit<std::milli> { static const char value[]; };
-template <> struct LLVM_ABI unit<std::micro> { static const char value[]; };
-template <> struct LLVM_ABI unit<std::nano> { static const char value[]; };
+template <> struct LLVM_ABI unit<std::ratio<3600>> {
+ static const char value[];
+};
+template <> struct LLVM_ABI unit<std::ratio<60>> {
+ static const char value[];
+};
+template <> struct LLVM_ABI unit<std::ratio<1>> {
+ static const char value[];
+};
+template <> struct LLVM_ABI unit<std::milli> {
+ static const char value[];
+};
+template <> struct LLVM_ABI unit<std::micro> {
+ static const char value[];
+};
+template <> struct LLVM_ABI unit<std::nano> {
+ static const char value[];
+};
} // namespace detail
/// Implementation of format_provider<T> for duration types.
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 2c685c5dc5950b..77aafd5a3aab22 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -67,10 +67,10 @@ namespace cl {
// that give precedence to earlier occurrences, you will need to extend this
// function to support it correctly.
LLVM_ABI bool ParseCommandLineOptions(int argc, const char *const *argv,
- StringRef Overview = "",
- raw_ostream *Errs = nullptr,
- const char *EnvVar = nullptr,
- bool LongOptionsUseDoubleDash = false);
+ StringRef Overview = "",
+ raw_ostream *Errs = nullptr,
+ const char *EnvVar = nullptr,
+ bool LongOptionsUseDoubleDash = false);
// Function pointer type for printing version information.
using VersionPrinterTy = std::function<void(raw_ostream &)>;
@@ -891,7 +891,8 @@ template <class DataType> class parser : public generic_parser_base {
//--------------------------------------------------
// Super class of parsers to provide boilerplate code
//
-class LLVM_ABI basic_parser_impl { // non-template implementation of basic_parser<t>
+class LLVM_ABI
+ basic_parser_impl { // non-template implementation of basic_parser<t>
public:
basic_parser_impl(Option &) {}
@@ -969,7 +970,8 @@ template <> class LLVM_ABI parser<bool> : public basic_parser<bool> {
extern template class LLVM_TEMPLATE_ABI basic_parser<boolOrDefault>;
-template <> class LLVM_ABI parser<boolOrDefault> : public basic_parser<boolOrDefault> {
+template <>
+class LLVM_ABI parser<boolOrDefault> : public basic_parser<boolOrDefault> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1079,7 +1081,8 @@ template <> class LLVM_ABI parser<unsigned> : public basic_parser<unsigned> {
extern template class LLVM_TEMPLATE_ABI basic_parser<unsigned long>;
template <>
-class LLVM_ABI parser<unsigned long> final : public basic_parser<unsigned long> {
+class LLVM_ABI parser<unsigned long> final
+ : public basic_parser<unsigned long> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1101,7 +1104,8 @@ class LLVM_ABI parser<unsigned long> final : public basic_parser<unsigned long>
extern template class LLVM_TEMPLATE_ABI basic_parser<unsigned long long>;
template <>
-class LLVM_ABI parser<unsigned long long> : public basic_parser<unsigned long long> {
+class LLVM_ABI parser<unsigned long long>
+ : public basic_parser<unsigned long long> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1165,7 +1169,8 @@ template <> class LLVM_ABI parser<float> : public basic_parser<float> {
extern template class LLVM_TEMPLATE_ABI basic_parser<std::string>;
-template <> class LLVM_ABI parser<std::string> : public basic_parser<std::string> {
+template <>
+class LLVM_ABI parser<std::string> : public basic_parser<std::string> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -2079,8 +2084,8 @@ getRegisteredSubcommands();
/// lines and end of the response file to be marked with a nullptr string.
/// \param [out] NewArgv All parsed strings are appended to NewArgv.
LLVM_ABI void TokenizeGNUCommandLine(StringRef Source, StringSaver &Saver,
- SmallVectorImpl<const char *> &NewArgv,
- bool MarkEOLs = false);
+ SmallVectorImpl<const char *> &NewArgv,
+ bool MarkEOLs = false);
/// Tokenizes a string of Windows command line arguments, which may contain
/// quotes and escaped quotes.
@@ -2097,15 +2102,16 @@ LLVM_ABI void TokenizeGNUCommandLine(StringRef Source, StringSaver &Saver,
/// lines and end of the response file to be marked with a nullptr string.
/// \param [out] NewArgv All parsed strings are appended to NewArgv.
LLVM_ABI void TokenizeWindowsCommandLine(StringRef Source, StringSaver &Saver,
- SmallVectorImpl<const char *> &NewArgv,
- bool MarkEOLs = false);
+ SmallVectorImpl<const char *> &NewArgv,
+ bool MarkEOLs = false);
/// Tokenizes a Windows command line while attempting to avoid copies. If no
/// quoting or escaping was used, this produces substrings of the original
/// string. If a token requires unquoting, it will be allocated with the
/// StringSaver.
-LLVM_ABI void TokenizeWindowsCommandLineNoCopy(StringRef Source, StringSaver &Saver,
- SmallVectorImpl<StringRef> &NewArgv);
+LLVM_ABI void
+TokenizeWindowsCommandLineNoCopy(StringRef Source, StringSaver &Saver,
+ SmallVectorImpl<StringRef> &NewArgv);
/// Tokenizes a Windows full command line, including command name at the start.
///
@@ -2120,9 +2126,10 @@ LLVM_ABI void TokenizeWindowsCommandLineNoCopy(StringRef Source, StringSaver &Sa
/// if you set MarkEOLs = true, then the first word of every line will be
/// parsed using the special rules for command names, making this function
/// suitable for parsing a file full of commands to execute.
-LLVM_ABI void TokenizeWindowsCommandLineFull(StringRef Source, StringSaver &Saver,
- SmallVectorImpl<const char *> &NewArgv,
- bool MarkEOLs = false);
+LLVM_ABI void
+TokenizeWindowsCommandLineFull(StringRef Source, StringSaver &Saver,
+ SmallVectorImpl<const char *> &NewArgv,
+ bool MarkEOLs = false);
/// String tokenization function type. Should be compatible with either
/// Windows or Unix command line tokenizers.
@@ -2140,8 +2147,8 @@ using TokenizerCallback = void (*)(StringRef Source, StringSaver &Saver,
/// It works like TokenizeGNUCommandLine with ability to skip comment lines.
///
LLVM_ABI void tokenizeConfigFile(StringRef Source, StringSaver &Saver,
- SmallVectorImpl<const char *> &NewArgv,
- bool MarkEOLs = false);
+ SmallVectorImpl<const char *> &NewArgv,
+ bool MarkEOLs = false);
/// Contains options that control response file expansion.
class LLVM_ABI ExpansionContext {
@@ -2234,21 +2241,23 @@ class LLVM_ABI ExpansionContext {
/// environment variable EnvVar and command line options, then expands
/// response files recursively.
/// \return true if all @files were expanded successfully or there were none.
-LLVM_ABI bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar,
- SmallVectorImpl<const char *> &NewArgv);
+LLVM_ABI bool expandResponseFiles(int Argc, const char *const *Argv,
+ const char *EnvVar,
+ SmallVectorImpl<const char *> &NewArgv);
/// A convenience helper which supports the typical use case of expansion
/// function call.
-LLVM_ABI bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
- SmallVectorImpl<const char *> &Argv);
+LLVM_ABI bool ExpandResponseFiles(StringSaver &Saver,
+ TokenizerCallback Tokenizer,
+ SmallVectorImpl<const char *> &Argv);
/// A convenience helper which concatenates the options specified by the
/// environment variable EnvVar and command line options, then expands response
/// files recursively. The tokenizer is a predefined GNU or Windows one.
/// \return true if all @files were expanded successfully or there were none.
-LLVM_ABI bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar,
- StringSaver &Saver,
- SmallVectorImpl<const char *> &NewArgv);
+LLVM_ABI bool expandResponseFiles(int Argc, const char *const *Argv,
+ const char *EnvVar, StringSaver &Saver,
+ SmallVectorImpl<const char *> &NewArgv);
/// Mark all options not part of this category as cl::ReallyHidden.
///
@@ -2258,7 +2267,7 @@ LLVM_ABI bool expandResponseFiles(int Argc, const char *const *Argv, const char
/// not specific to the tool. This function allows a tool to specify a single
/// option category to display in the -help output.
LLVM_ABI void HideUnrelatedOptions(cl::OptionCategory &Category,
- SubCommand &Sub = SubCommand::getTopLevel());
+ SubCommand &Sub = SubCommand::getTopLevel());
/// Mark all options not part of the categories as cl::ReallyHidden.
///
@@ -2267,8 +2276,9 @@ LLVM_ABI void HideUnrelatedOptions(cl::OptionCategory &Category,
/// Some tools (like clang-format) like to be able to hide all options that are
/// not specific to the tool. This function allows a tool to specify a single
/// option category to display in the -help output.
-LLVM_ABI void HideUnrelatedOptions(ArrayRef<const cl::OptionCategory *> Categories,
- SubCommand &Sub = SubCommand::getTopLevel());
+LLVM_ABI void
+HideUnrelatedOptions(ArrayRef<const cl::OptionCategory *> Categories,
+ SubCommand &Sub = SubCommand::getTopLevel());
/// Reset all command line options to a state that looks as if they have
/// never appeared on the command line. This is useful for being able to parse
diff --git a/llvm/include/llvm/Support/Compression.h b/llvm/include/llvm/Support/Compression.h
index 96dc6504ea1e4d..246ccbd6f6dcfe 100644
--- a/llvm/include/llvm/Support/Compression.h
+++ b/llvm/include/llvm/Support/Compression.h
@@ -42,14 +42,15 @@ constexpr int BestSizeCompression = 9;
LLVM_ABI bool isAvailable();
LLVM_ABI void compress(ArrayRef<uint8_t> Input,
- SmallVectorImpl<uint8_t> &CompressedBuffer,
- int Level = DefaultCompression);
+ SmallVectorImpl<uint8_t> &CompressedBuffer,
+ int Level = DefaultCompression);
LLVM_ABI Error decompress(ArrayRef<uint8_t> Input, uint8_t *Output,
- size_t &UncompressedSize);
+ size_t &UncompressedSize);
-LLVM_ABI Error decompress(ArrayRef<uint8_t> Input, SmallVectorImpl<uint8_t> &Output,
- size_t UncompressedSize);
+LLVM_ABI Error decompress(ArrayRef<uint8_t> Input,
+ SmallVectorImpl<uint8_t> &Output,
+ size_t UncompressedSize);
} // End of namespace zlib
@@ -63,14 +64,15 @@ constexpr int BestSizeCompression = 12;
LLVM_ABI bool isAvailable();
LLVM_ABI void compress(ArrayRef<uint8_t> Input,
- SmallVectorImpl<uint8_t> &CompressedBuffer,
- int Level = DefaultCompression, bool EnableLdm = false);
+ SmallVectorImpl<uint8_t> &CompressedBuffer,
+ int Level = DefaultCompression, bool EnableLdm = false);
LLVM_ABI Error decompress(ArrayRef<uint8_t> Input, uint8_t *Output,
- size_t &UncompressedSize);
+ size_t &UncompressedSize);
-LLVM_ABI Error decompress(ArrayRef<uint8_t> Input, SmallVectorImpl<uint8_t> &Output,
- size_t UncompressedSize);
+LLVM_ABI Error decompress(ArrayRef<uint8_t> Input,
+ SmallVectorImpl<uint8_t> &Output,
+ size_t UncompressedSize);
} // End of namespace zstd
@@ -115,15 +117,17 @@ LLVM_ABI const char *getReasonIfUnsupported(Format F);
// Compress Input with the specified format P.Format. If Level is -1, use
// *::DefaultCompression for the format.
LLVM_ABI void compress(Params P, ArrayRef<uint8_t> Input,
- SmallVectorImpl<uint8_t> &Output);
+ SmallVectorImpl<uint8_t> &Output);
// Decompress Input. The uncompressed size must be available.
LLVM_ABI Error decompress(DebugCompressionType T, ArrayRef<uint8_t> Input,
- uint8_t *Output, size_t UncompressedSize);
+ uint8_t *Output, size_t UncompressedSize);
LLVM_ABI Error decompress(Format F, ArrayRef<uint8_t> Input,
- SmallVectorImpl<uint8_t> &Output, size_t UncompressedSize);
+ SmallVectorImpl<uint8_t> &Output,
+ size_t UncompressedSize);
LLVM_ABI Error decompress(DebugCompressionType T, ArrayRef<uint8_t> Input,
- SmallVectorImpl<uint8_t> &Output, size_t UncompressedSize);
+ SmallVectorImpl<uint8_t> &Output,
+ size_t UncompressedSize);
} // End of namespace compression
diff --git a/llvm/include/llvm/Support/ConvertEBCDIC.h b/llvm/include/llvm/Support/ConvertEBCDIC.h
index 30d98a837886db..1ed88b9a905a76 100644
--- a/llvm/include/llvm/Support/ConvertEBCDIC.h
+++ b/llvm/include/llvm/Support/ConvertEBCDIC.h
@@ -21,7 +21,7 @@
namespace llvm {
namespace ConverterEBCDIC {
LLVM_ABI std::error_code convertToEBCDIC(StringRef Source,
- SmallVectorImpl<char> &Result);
+ SmallVectorImpl<char> &Result);
LLVM_ABI void convertToUTF8(StringRef Source, SmallVectorImpl<char> &Result);
diff --git a/llvm/include/llvm/Support/ConvertUTF.h b/llvm/include/llvm/Support/ConvertUTF.h
index 234e859d0fc2fa..71b37d6b200b99 100644
--- a/llvm/include/llvm/Support/ConvertUTF.h
+++ b/llvm/include/llvm/Support/ConvertUTF.h
@@ -158,47 +158,62 @@ typedef enum {
lenientConversion
} ConversionFlags;
-LLVM_ABI ConversionResult ConvertUTF8toUTF16 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
+LLVM_ABI ConversionResult ConvertUTF8toUTF16(const UTF8 **sourceStart,
+ const UTF8 *sourceEnd,
+ UTF16 **targetStart,
+ UTF16 *targetEnd,
+ ConversionFlags flags);
/**
* Convert a partial UTF8 sequence to UTF32. If the sequence ends in an
* incomplete code unit sequence, returns \c sourceExhausted.
*/
-LLVM_ABI ConversionResult ConvertUTF8toUTF32Partial(
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
+LLVM_ABI ConversionResult ConvertUTF8toUTF32Partial(const UTF8 **sourceStart,
+ const UTF8 *sourceEnd,
+ UTF32 **targetStart,
+ UTF32 *targetEnd,
+ ConversionFlags flags);
/**
* Convert a partial UTF8 sequence to UTF32. If the sequence ends in an
* incomplete code unit sequence, returns \c sourceIllegal.
*/
-LLVM_ABI ConversionResult ConvertUTF8toUTF32(
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
-
-LLVM_ABI ConversionResult ConvertUTF16toUTF8 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-
-LLVM_ABI ConversionResult ConvertUTF32toUTF8 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-
-LLVM_ABI ConversionResult ConvertUTF16toUTF32 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
-
-LLVM_ABI ConversionResult ConvertUTF32toUTF16 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
+LLVM_ABI ConversionResult ConvertUTF8toUTF32(const UTF8 **sourceStart,
+ const UTF8 *sourceEnd,
+ UTF32 **targetStart,
+ UTF32 *targetEnd,
+ ConversionFlags flags);
+
+LLVM_ABI ConversionResult ConvertUTF16toUTF8(const UTF16 **sourceStart,
+ const UTF16 *sourceEnd,
+ UTF8 **targetStart,
+ UTF8 *targetEnd,
+ ConversionFlags flags);
+
+LLVM_ABI ConversionResult ConvertUTF32toUTF8(const UTF32 **sourceStart,
+ const UTF32 *sourceEnd,
+ UTF8 **targetStart,
+ UTF8 *targetEnd,
+ ConversionFlags flags);
+
+LLVM_ABI ConversionResult ConvertUTF16toUTF32(const UTF16 **sourceStart,
+ const UTF16 *sourceEnd,
+ UTF32 **targetStart,
+ UTF32 *targetEnd,
+ ConversionFlags flags);
+
+LLVM_ABI ConversionResult ConvertUTF32toUTF16(const UTF32 **sourceStart,
+ const UTF32 *sourceEnd,
+ UTF16 **targetStart,
+ UTF16 *targetEnd,
+ ConversionFlags flags);
LLVM_ABI Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
LLVM_ABI Boolean isLegalUTF8String(const UTF8 **source, const UTF8 *sourceEnd);
-LLVM_ABI unsigned getUTF8SequenceSize(const UTF8 *source, const UTF8 *sourceEnd);
+LLVM_ABI unsigned getUTF8SequenceSize(const UTF8 *source,
+ const UTF8 *sourceEnd);
LLVM_ABI unsigned getNumBytesForUTF8(UTF8 firstByte);
@@ -219,7 +234,7 @@ class StringRef;
* \return true on success.
*/
LLVM_ABI bool ConvertUTF8toWide(unsigned WideCharWidth, llvm::StringRef Source,
- char *&ResultPtr, const UTF8 *&ErrorPtr);
+ char *&ResultPtr, const UTF8 *&ErrorPtr);
/**
* Converts a UTF-8 StringRef to a std::wstring.
@@ -237,8 +252,8 @@ LLVM_ABI bool ConvertUTF8toWide(const char *Source, std::wstring &Result);
* Converts a std::wstring to a UTF-8 encoded std::string.
* \return true on success.
*/
-LLVM_ABI bool convertWideToUTF8(const std::wstring &Source, std::string &Result);
-
+LLVM_ABI bool convertWideToUTF8(const std::wstring &Source,
+ std::string &Result);
/**
* Convert an Unicode code point to UTF8 sequence.
@@ -292,7 +307,8 @@ LLVM_ABI bool hasUTF16ByteOrderMark(ArrayRef<char> SrcBytes);
* \param [out] Out Converted UTF-8 is stored here on success.
* \returns true on success
*/
-LLVM_ABI bool convertUTF16ToUTF8String(ArrayRef<char> SrcBytes, std::string &Out);
+LLVM_ABI bool convertUTF16ToUTF8String(ArrayRef<char> SrcBytes,
+ std::string &Out);
/**
* Converts a UTF16 string into a UTF8 std::string.
@@ -310,7 +326,8 @@ LLVM_ABI bool convertUTF16ToUTF8String(ArrayRef<UTF16> Src, std::string &Out);
* \param [out] Out Converted UTF-8 is stored here on success.
* \returns true on success
*/
-LLVM_ABI bool convertUTF32ToUTF8String(ArrayRef<char> SrcBytes, std::string &Out);
+LLVM_ABI bool convertUTF32ToUTF8String(ArrayRef<char> SrcBytes,
+ std::string &Out);
/**
* Converts a UTF32 string into a UTF8 std::string.
@@ -327,19 +344,21 @@ LLVM_ABI bool convertUTF32ToUTF8String(ArrayRef<UTF32> Src, std::string &Out);
* \returns true on success
*/
LLVM_ABI bool convertUTF8ToUTF16String(StringRef SrcUTF8,
- SmallVectorImpl<UTF16> &DstUTF16);
+ SmallVectorImpl<UTF16> &DstUTF16);
#if defined(_WIN32)
namespace sys {
namespace windows {
-LLVM_ABI std::error_code UTF8ToUTF16(StringRef utf8, SmallVectorImpl<wchar_t> &utf16);
+LLVM_ABI std::error_code UTF8ToUTF16(StringRef utf8,
+ SmallVectorImpl<wchar_t> &utf16);
/// Convert to UTF16 from the current code page used in the system
-LLVM_ABI std::error_code CurCPToUTF16(StringRef utf8, SmallVectorImpl<wchar_t> &utf16);
+LLVM_ABI std::error_code CurCPToUTF16(StringRef utf8,
+ SmallVectorImpl<wchar_t> &utf16);
LLVM_ABI std::error_code UTF16ToUTF8(const wchar_t *utf16, size_t utf16_len,
- SmallVectorImpl<char> &utf8);
+ SmallVectorImpl<char> &utf8);
/// Convert from UTF16 to the current code page used in the system
LLVM_ABI std::error_code UTF16ToCurCP(const wchar_t *utf16, size_t utf16_len,
- SmallVectorImpl<char> &utf8);
+ SmallVectorImpl<char> &utf8);
} // namespace windows
} // namespace sys
#endif
diff --git a/llvm/include/llvm/Support/ELFAttributes.h b/llvm/include/llvm/Support/ELFAttributes.h
index 6b16731a8f5621..8b83c5e7f48390 100644
--- a/llvm/include/llvm/Support/ELFAttributes.h
+++ b/llvm/include/llvm/Support/ELFAttributes.h
@@ -28,8 +28,9 @@ namespace ELFAttrs {
enum AttrType : unsigned { File = 1, Section = 2, Symbol = 3 };
LLVM_ABI StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap,
- bool hasTagPrefix = true);
-LLVM_ABI std::optional<unsigned> attrTypeFromString(StringRef tag, TagNameMap tagNameMap);
+ bool hasTagPrefix = true);
+LLVM_ABI std::optional<unsigned> attrTypeFromString(StringRef tag,
+ TagNameMap tagNameMap);
// Magic numbers for ELF attributes.
enum AttrMagic { Format_Version = 0x41 };
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index d9a492ed3529c2..3cd8a83abc3d78 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -738,7 +738,8 @@ template <class T> class [[nodiscard]] Expected {
/// Report a serious error, calling any installed error handler. See
/// ErrorHandling.h.
-[[noreturn]] void LLVM_ABI report_fatal_error(Error Err, bool gen_crash_diag = true);
+[[noreturn]] void LLVM_ABI report_fatal_error(Error Err,
+ bool gen_crash_diag = true);
/// Report a fatal error if Err is a failure value.
///
@@ -1049,7 +1050,8 @@ Expected<T> handleExpected(Expected<T> ValOrErr, RecoveryFtor &&RecoveryPath,
/// This is useful in the base level of your program to allow clean termination
/// (allowing clean deallocation of resources, etc.), while reporting error
/// information to the user.
-LLVM_ABI void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner = {});
+LLVM_ABI void logAllUnhandledErrors(Error E, raw_ostream &OS,
+ Twine ErrorBanner = {});
/// Write all error messages (if any) in E to a string. The newline character
/// is used to separate error messages.
diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h
index 602189d534f6de..db988d4ae6ef06 100644
--- a/llvm/include/llvm/Support/ErrorHandling.h
+++ b/llvm/include/llvm/Support/ErrorHandling.h
@@ -42,7 +42,7 @@ namespace llvm {
/// \param user_data - An argument which will be passed to the install error
/// handler.
LLVM_ABI void install_fatal_error_handler(fatal_error_handler_t handler,
- void *user_data = nullptr);
+ void *user_data = nullptr);
/// Restores default error handling behaviour.
LLVM_ABI void remove_fatal_error_handler();
@@ -68,58 +68,57 @@ namespace llvm {
/// After the error handler is called this function will call abort(), it
/// does not return.
/// NOTE: The std::string variant was removed to avoid a <string> dependency.
-[[noreturn]] void LLVM_ABI report_fatal_error(const char *reason,
- bool gen_crash_diag = true);
-[[noreturn]] void LLVM_ABI report_fatal_error(StringRef reason,
- bool gen_crash_diag = true);
-[[noreturn]] void LLVM_ABI report_fatal_error(const Twine &reason,
- bool gen_crash_diag = true);
-
-/// Installs a new bad alloc error handler that should be used whenever a
-/// bad alloc error, e.g. failing malloc/calloc, is encountered by LLVM.
-///
-/// The user can install a bad alloc handler, in order to define the behavior
-/// in case of failing allocations, e.g. throwing an exception. Note that this
-/// handler must not trigger any additional allocations itself.
-///
-/// If no error handler is installed the default is to print the error message
-/// to stderr, and call exit(1). If an error handler is installed then it is
-/// the handler's responsibility to log the message, it will no longer be
-/// printed to stderr. If the error handler returns, then exit(1) will be
-/// called.
-///
-///
-/// \param user_data - An argument which will be passed to the installed error
-/// handler.
-LLVM_ABI void install_bad_alloc_error_handler(fatal_error_handler_t handler,
- void *user_data = nullptr);
+ [[noreturn]] void LLVM_ABI report_fatal_error(const char *reason,
+ bool gen_crash_diag = true);
+ [[noreturn]] void LLVM_ABI report_fatal_error(StringRef reason,
+ bool gen_crash_diag = true);
+ [[noreturn]] void LLVM_ABI report_fatal_error(const Twine &reason,
+ bool gen_crash_diag = true);
+
+ /// Installs a new bad alloc error handler that should be used whenever a
+ /// bad alloc error, e.g. failing malloc/calloc, is encountered by LLVM.
+ ///
+ /// The user can install a bad alloc handler, in order to define the behavior
+ /// in case of failing allocations, e.g. throwing an exception. Note that this
+ /// handler must not trigger any additional allocations itself.
+ ///
+ /// If no error handler is installed the default is to print the error message
+ /// to stderr, and call exit(1). If an error handler is installed then it is
+ /// the handler's responsibility to log the message, it will no longer be
+ /// printed to stderr. If the error handler returns, then exit(1) will be
+ /// called.
+ ///
+ ///
+ /// \param user_data - An argument which will be passed to the installed error
+ /// handler.
+ LLVM_ABI void install_bad_alloc_error_handler(fatal_error_handler_t handler,
+ void *user_data = nullptr);
-/// Restores default bad alloc error handling behavior.
-LLVM_ABI void remove_bad_alloc_error_handler();
+ /// Restores default bad alloc error handling behavior.
+ LLVM_ABI void remove_bad_alloc_error_handler();
-LLVM_ABI void install_out_of_memory_new_handler();
+ LLVM_ABI void install_out_of_memory_new_handler();
-/// Reports a bad alloc error, calling any user defined bad alloc
-/// error handler. In contrast to the generic 'report_fatal_error'
-/// functions, this function might not terminate, e.g. the user
-/// defined error handler throws an exception, but it won't return.
-///
-/// Note: When throwing an exception in the bad alloc handler, make sure that
-/// the following unwind succeeds, e.g. do not trigger additional allocations
-/// in the unwind chain.
-///
-/// If no error handler is installed (default), throws a bad_alloc exception
-/// if LLVM is compiled with exception support. Otherwise prints the error
-/// to standard error and calls abort().
-[[noreturn]] void LLVM_ABI report_bad_alloc_error(const char *Reason,
- bool GenCrashDiag = true);
-
-/// This function calls abort(), and prints the optional message to stderr.
-/// Use the llvm_unreachable macro (that adds location info), instead of
-/// calling this function directly.
-[[noreturn]] void
-LLVM_ABI llvm_unreachable_internal(const char *msg = nullptr, const char *file = nullptr,
- unsigned line = 0);
+ /// Reports a bad alloc error, calling any user defined bad alloc
+ /// error handler. In contrast to the generic 'report_fatal_error'
+ /// functions, this function might not terminate, e.g. the user
+ /// defined error handler throws an exception, but it won't return.
+ ///
+ /// Note: When throwing an exception in the bad alloc handler, make sure that
+ /// the following unwind succeeds, e.g. do not trigger additional allocations
+ /// in the unwind chain.
+ ///
+ /// If no error handler is installed (default), throws a bad_alloc exception
+ /// if LLVM is compiled with exception support. Otherwise prints the error
+ /// to standard error and calls abort().
+ [[noreturn]] void LLVM_ABI report_bad_alloc_error(const char *Reason,
+ bool GenCrashDiag = true);
+
+ /// This function calls abort(), and prints the optional message to stderr.
+ /// Use the llvm_unreachable macro (that adds location info), instead of
+ /// calling this function directly.
+ [[noreturn]] void LLVM_ABI llvm_unreachable_internal(
+ const char *msg = nullptr, const char *file = nullptr, unsigned line = 0);
}
/// Marks that the current location is not supposed to be reachable.
diff --git a/llvm/include/llvm/Support/FileSystem.h b/llvm/include/llvm/Support/FileSystem.h
index cefdb21eb28cfe..40fb0de68db335 100644
--- a/llvm/include/llvm/Support/FileSystem.h
+++ b/llvm/include/llvm/Support/FileSystem.h
@@ -226,11 +226,11 @@ class LLVM_ABI basic_file_status {
class LLVM_ABI file_status : public basic_file_status {
friend LLVM_ABI bool equivalent(file_status A, file_status B);
- #if defined(LLVM_ON_UNIX)
+#if defined(LLVM_ON_UNIX)
dev_t fs_st_dev = 0;
nlink_t fs_st_nlinks = 0;
ino_t fs_st_ino = 0;
- #elif defined (_WIN32)
+#elif defined (_WIN32)
uint32_t NumLinks = 0;
uint32_t VolumeSerialNumber = 0;
uint64_t PathHash = 0;
@@ -279,7 +279,8 @@ class LLVM_ABI file_status : public basic_file_status {
/// relative/../path => <current-directory>/relative/../path
///
/// @param path A path that is modified to be an absolute path.
-LLVM_ABI void make_absolute(const Twine ¤t_directory, SmallVectorImpl<char> &path);
+LLVM_ABI void make_absolute(const Twine ¤t_directory,
+ SmallVectorImpl<char> &path);
/// Make \a path an absolute path.
///
@@ -300,9 +301,9 @@ LLVM_ABI std::error_code make_absolute(SmallVectorImpl<char> &path);
/// @returns errc::success if is_directory(path), otherwise a platform
/// specific error_code. If IgnoreExisting is false, also returns
/// error if the directory already existed.
-LLVM_ABI std::error_code create_directories(const Twine &path,
- bool IgnoreExisting = true,
- perms Perms = owner_all | group_all);
+LLVM_ABI std::error_code
+create_directories(const Twine &path, bool IgnoreExisting = true,
+ perms Perms = owner_all | group_all);
/// Create the directory in path.
///
@@ -310,8 +311,9 @@ LLVM_ABI std::error_code create_directories(const Twine &path,
/// @returns errc::success if is_directory(path), otherwise a platform
/// specific error_code. If IgnoreExisting is false, also returns
/// error if the directory already existed.
-LLVM_ABI std::error_code create_directory(const Twine &path, bool IgnoreExisting = true,
- perms Perms = owner_all | group_all);
+LLVM_ABI std::error_code create_directory(const Twine &path,
+ bool IgnoreExisting = true,
+ perms Perms = owner_all | group_all);
/// Create a link from \a from to \a to.
///
@@ -341,8 +343,9 @@ LLVM_ABI std::error_code create_hard_link(const Twine &to, const Twine &from);
/// @param output The location to store the resolved path.
/// @param expand_tilde If true, resolves ~ expressions to the user's home
/// directory.
-LLVM_ABI std::error_code real_path(const Twine &path, SmallVectorImpl<char> &output,
- bool expand_tilde = false);
+LLVM_ABI std::error_code real_path(const Twine &path,
+ SmallVectorImpl<char> &output,
+ bool expand_tilde = false);
/// Expands ~ expressions to the user's home directory. On Unix ~user
/// directories are resolved as well.
@@ -370,14 +373,16 @@ LLVM_ABI std::error_code set_current_path(const Twine &path);
/// @returns errc::success if path has been removed or didn't exist, otherwise a
/// platform-specific error code. If IgnoreNonExisting is false, also
/// returns error if the file didn't exist.
-LLVM_ABI std::error_code remove(const Twine &path, bool IgnoreNonExisting = true);
+LLVM_ABI std::error_code remove(const Twine &path,
+ bool IgnoreNonExisting = true);
/// Recursively delete a directory.
///
/// @param path Input path.
/// @returns errc::success if path has been removed or didn't exist, otherwise a
/// platform-specific error code.
-LLVM_ABI std::error_code remove_directories(const Twine &path, bool IgnoreErrors = true);
+LLVM_ABI std::error_code remove_directories(const Twine &path,
+ bool IgnoreErrors = true);
/// Rename \a from to \a to.
///
@@ -497,7 +502,8 @@ LLVM_ABI bool equivalent(file_status A, file_status B);
/// inode (or equivalent).
/// @returns errc::success if result has been successfully set, otherwise a
/// platform-specific error_code.
-LLVM_ABI std::error_code equivalent(const Twine &A, const Twine &B, bool &result);
+LLVM_ABI std::error_code equivalent(const Twine &A, const Twine &B,
+ bool &result);
/// Simpler version of equivalent for clients that don't need to
/// differentiate between an error and false.
@@ -636,7 +642,7 @@ LLVM_ABI std::error_code is_other(const Twine &path, bool &result);
/// @returns errc::success if result has been successfully set, otherwise a
/// platform-specific error_code.
LLVM_ABI std::error_code status(const Twine &path, file_status &result,
- bool follow = true);
+ bool follow = true);
/// A version for when a file descriptor is already available.
LLVM_ABI std::error_code status(int FD, file_status &Result);
@@ -700,8 +706,9 @@ inline std::error_code file_size(const Twine &Path, uint64_t &Result) {
/// @returns errc::success if the file times were successfully set, otherwise a
/// platform-specific error_code or errc::function_not_supported on
/// platforms where the functionality isn't available.
-LLVM_ABI std::error_code setLastAccessAndModificationTime(int FD, TimePoint<> AccessTime,
- TimePoint<> ModificationTime);
+LLVM_ABI std::error_code
+setLastAccessAndModificationTime(int FD, TimePoint<> AccessTime,
+ TimePoint<> ModificationTime);
/// Simpler version that sets both file modification and access time to the same
/// time.
@@ -801,8 +808,9 @@ enum OpenFlags : unsigned {
/// @param Model Name to base unique path off of.
/// @param ResultPath Set to the file's path.
/// @param MakeAbsolute Whether to use the system temp directory.
-LLVM_ABI void createUniquePath(const Twine &Model, SmallVectorImpl<char> &ResultPath,
- bool MakeAbsolute);
+LLVM_ABI void createUniquePath(const Twine &Model,
+ SmallVectorImpl<char> &ResultPath,
+ bool MakeAbsolute);
/// Create a uniquely named file.
///
@@ -828,15 +836,15 @@ LLVM_ABI void createUniquePath(const Twine &Model, SmallVectorImpl<char> &Result
/// @returns errc::success if Result{FD,Path} have been successfully set,
/// otherwise a platform-specific error_code.
LLVM_ABI std::error_code createUniqueFile(const Twine &Model, int &ResultFD,
- SmallVectorImpl<char> &ResultPath,
- OpenFlags Flags = OF_None,
- unsigned Mode = all_read | all_write);
+ SmallVectorImpl<char> &ResultPath,
+ OpenFlags Flags = OF_None,
+ unsigned Mode = all_read | all_write);
/// Simpler version for clients that don't want an open file. An empty
/// file will still be created.
LLVM_ABI std::error_code createUniqueFile(const Twine &Model,
- SmallVectorImpl<char> &ResultPath,
- unsigned Mode = all_read | all_write);
+ SmallVectorImpl<char> &ResultPath,
+ unsigned Mode = all_read | all_write);
/// Represents a temporary file.
///
@@ -890,19 +898,20 @@ class LLVM_ABI TempFile {
///
/// This should be used for things like a temporary .s that is removed after
/// running the assembler.
-LLVM_ABI std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix,
- int &ResultFD,
- SmallVectorImpl<char> &ResultPath,
- OpenFlags Flags = OF_None);
+LLVM_ABI std::error_code createTemporaryFile(const Twine &Prefix,
+ StringRef Suffix, int &ResultFD,
+ SmallVectorImpl<char> &ResultPath,
+ OpenFlags Flags = OF_None);
/// Simpler version for clients that don't want an open file. An empty
/// file will still be created.
-LLVM_ABI std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix,
- SmallVectorImpl<char> &ResultPath,
- OpenFlags Flags = OF_None);
+LLVM_ABI std::error_code createTemporaryFile(const Twine &Prefix,
+ StringRef Suffix,
+ SmallVectorImpl<char> &ResultPath,
+ OpenFlags Flags = OF_None);
-LLVM_ABI std::error_code createUniqueDirectory(const Twine &Prefix,
- SmallVectorImpl<char> &ResultPath);
+LLVM_ABI std::error_code
+createUniqueDirectory(const Twine &Prefix, SmallVectorImpl<char> &ResultPath);
/// Get a unique name, not currently exisiting in the filesystem. Subject
/// to race conditions, prefer to use createUniqueFile instead.
@@ -911,8 +920,9 @@ LLVM_ABI std::error_code createUniqueDirectory(const Twine &Prefix,
/// checks if it exists. This function is subject to race conditions, if you
/// want to use the returned name to actually create a file, use
/// createUniqueFile instead.
-LLVM_ABI std::error_code getPotentiallyUniqueFileName(const Twine &Model,
- SmallVectorImpl<char> &ResultPath);
+LLVM_ABI std::error_code
+getPotentiallyUniqueFileName(const Twine &Model,
+ SmallVectorImpl<char> &ResultPath);
/// Get a unique temporary file name, not currently exisiting in the
/// filesystem. Subject to race conditions, prefer to use createTemporaryFile
@@ -961,8 +971,8 @@ inline FileAccess &operator|=(FileAccess &A, FileAccess B) {
/// @returns errc::success if \a Name has been opened, otherwise a
/// platform-specific error_code.
LLVM_ABI std::error_code openFile(const Twine &Name, int &ResultFD,
- CreationDisposition Disp, FileAccess Access,
- OpenFlags Flags, unsigned Mode = 0666);
+ CreationDisposition Disp, FileAccess Access,
+ OpenFlags Flags, unsigned Mode = 0666);
/// @brief Opens a file with the specified creation disposition, access mode,
/// and flags and returns a platform-specific file object.
@@ -978,9 +988,10 @@ LLVM_ABI std::error_code openFile(const Twine &Name, int &ResultFD,
/// @param Mode The access permissions of the file, represented in octal.
/// @returns errc::success if \a Name has been opened, otherwise a
/// platform-specific error_code.
-LLVM_ABI Expected<file_t> openNativeFile(const Twine &Name, CreationDisposition Disp,
- FileAccess Access, OpenFlags Flags,
- unsigned Mode = 0666);
+LLVM_ABI Expected<file_t> openNativeFile(const Twine &Name,
+ CreationDisposition Disp,
+ FileAccess Access, OpenFlags Flags,
+ unsigned Mode = 0666);
/// Converts from a Posix file descriptor number to a native file handle.
/// On Windows, this retreives the underlying handle. On non-Windows, this is a
@@ -1010,7 +1021,8 @@ LLVM_ABI file_t getStderrHandle();
/// @param FileHandle File to read from.
/// @param Buf Buffer to read into.
/// @returns The number of bytes read, or error.
-LLVM_ABI Expected<size_t> readNativeFile(file_t FileHandle, MutableArrayRef<char> Buf);
+LLVM_ABI Expected<size_t> readNativeFile(file_t FileHandle,
+ MutableArrayRef<char> Buf);
/// Default chunk size for \a readNativeFileToEOF().
enum : size_t { DefaultReadChunkSize = 4 * 4096 };
@@ -1028,8 +1040,9 @@ enum : size_t { DefaultReadChunkSize = 4 * 4096 };
/// \param Buffer Where to put the file content.
/// \param ChunkSize Size of chunks.
/// \returns The error if EOF was not found.
-LLVM_ABI Error readNativeFileToEOF(file_t FileHandle, SmallVectorImpl<char> &Buffer,
- ssize_t ChunkSize = DefaultReadChunkSize);
+LLVM_ABI Error readNativeFileToEOF(file_t FileHandle,
+ SmallVectorImpl<char> &Buffer,
+ ssize_t ChunkSize = DefaultReadChunkSize);
/// Reads \p Buf.size() bytes from \p FileHandle at offset \p Offset into \p
/// Buf. If 'pread' is available, this will use that, otherwise it will use
@@ -1041,8 +1054,8 @@ LLVM_ABI Error readNativeFileToEOF(file_t FileHandle, SmallVectorImpl<char> &Buf
/// @param Offset Offset into the file at which the read should occur.
/// @returns The number of bytes read, or error.
LLVM_ABI Expected<size_t> readNativeFileSlice(file_t FileHandle,
- MutableArrayRef<char> Buf,
- uint64_t Offset);
+ MutableArrayRef<char> Buf,
+ uint64_t Offset);
/// @brief Opens the file with the given name in a write-only or read-write
/// mode, returning its open file descriptor. If the file does not exist, it
@@ -1142,9 +1155,9 @@ inline Expected<file_t> openNativeFileForReadWrite(const Twine &Name,
/// location.
/// @returns errc::success if \a Name has been opened, otherwise a
/// platform-specific error_code.
-LLVM_ABI std::error_code openFileForRead(const Twine &Name, int &ResultFD,
- OpenFlags Flags = OF_None,
- SmallVectorImpl<char> *RealPath = nullptr);
+LLVM_ABI std::error_code
+openFileForRead(const Twine &Name, int &ResultFD, OpenFlags Flags = OF_None,
+ SmallVectorImpl<char> *RealPath = nullptr);
/// @brief Opens the file with the given name in a read-only mode, returning
/// its open file descriptor.
@@ -1399,7 +1412,8 @@ namespace detail {
struct DirIterState;
- LLVM_ABI std::error_code directory_iterator_construct(DirIterState &, StringRef, bool);
+ LLVM_ABI std::error_code directory_iterator_construct(DirIterState &,
+ StringRef, bool);
LLVM_ABI std::error_code directory_iterator_increment(DirIterState &);
LLVM_ABI std::error_code directory_iterator_destruct(DirIterState &);
diff --git a/llvm/include/llvm/Support/FileUtilities.h b/llvm/include/llvm/Support/FileUtilities.h
index 70b1b53958a852..558b17bb823b29 100644
--- a/llvm/include/llvm/Support/FileUtilities.h
+++ b/llvm/include/llvm/Support/FileUtilities.h
@@ -30,51 +30,50 @@ namespace llvm {
/// option, it will set the string to an error message if an error occurs, or
/// if the files are different.
///
- LLVM_ABI int DiffFilesWithTolerance(StringRef FileA,
- StringRef FileB,
- double AbsTol, double RelTol,
- std::string *Error = nullptr);
-
-
- /// FileRemover - This class is a simple object meant to be stack allocated.
- /// If an exception is thrown from a region, the object removes the filename
- /// specified (if deleteIt is true).
- ///
- class FileRemover {
- SmallString<128> Filename;
- bool DeleteIt;
- public:
- FileRemover() : DeleteIt(false) {}
-
- explicit FileRemover(const Twine& filename, bool deleteIt = true)
+LLVM_ABI int DiffFilesWithTolerance(StringRef FileA, StringRef FileB,
+ double AbsTol, double RelTol,
+ std::string *Error = nullptr);
+
+/// FileRemover - This class is a simple object meant to be stack allocated.
+/// If an exception is thrown from a region, the object removes the filename
+/// specified (if deleteIt is true).
+///
+class FileRemover {
+ SmallString<128> Filename;
+ bool DeleteIt;
+
+public:
+ FileRemover() : DeleteIt(false) {}
+
+ explicit FileRemover(const Twine &filename, bool deleteIt = true)
: DeleteIt(deleteIt) {
- filename.toVector(Filename);
- }
+ filename.toVector(Filename);
+ }
- ~FileRemover() {
- if (DeleteIt) {
- // Ignore problems deleting the file.
- sys::fs::remove(Filename);
- }
+ ~FileRemover() {
+ if (DeleteIt) {
+ // Ignore problems deleting the file.
+ sys::fs::remove(Filename);
}
-
- /// setFile - Give ownership of the file to the FileRemover so it will
- /// be removed when the object is destroyed. If the FileRemover already
- /// had ownership of a file, remove it first.
- void setFile(const Twine& filename, bool deleteIt = true) {
- if (DeleteIt) {
- // Ignore problems deleting the file.
- sys::fs::remove(Filename);
- }
-
- Filename.clear();
- filename.toVector(Filename);
- DeleteIt = deleteIt;
+ }
+
+ /// setFile - Give ownership of the file to the FileRemover so it will
+ /// be removed when the object is destroyed. If the FileRemover already
+ /// had ownership of a file, remove it first.
+ void setFile(const Twine &filename, bool deleteIt = true) {
+ if (DeleteIt) {
+ // Ignore problems deleting the file.
+ sys::fs::remove(Filename);
}
- /// releaseFile - Take ownership of the file away from the FileRemover so it
- /// will not be removed when the object is destroyed.
- void releaseFile() { DeleteIt = false; }
+ Filename.clear();
+ filename.toVector(Filename);
+ DeleteIt = deleteIt;
+ }
+
+ /// releaseFile - Take ownership of the file away from the FileRemover so it
+ /// will not be removed when the object is destroyed.
+ void releaseFile() { DeleteIt = false; }
};
/// FilePermssionsApplier helps to copy permissions from an input file to
diff --git a/llvm/include/llvm/Support/GraphWriter.h b/llvm/include/llvm/Support/GraphWriter.h
index fdc537e701aec4..8b619a3a9c3ced 100644
--- a/llvm/include/llvm/Support/GraphWriter.h
+++ b/llvm/include/llvm/Support/GraphWriter.h
@@ -59,7 +59,7 @@ enum Name {
} // end namespace GraphProgram
LLVM_ABI bool DisplayGraph(StringRef Filename, bool wait = true,
- GraphProgram::Name program = GraphProgram::DOT);
+ GraphProgram::Name program = GraphProgram::DOT);
template<typename GraphType>
class GraphWriter {
diff --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h
index 0067d7eef485ec..7c9d28c8585316 100644
--- a/llvm/include/llvm/Support/JSON.h
+++ b/llvm/include/llvm/Support/JSON.h
@@ -647,7 +647,8 @@ inline bool Object::erase(StringRef K) {
return M.erase(ObjectKey(K));
}
-LLVM_ABI std::vector<const Object::value_type *> sortedElements(const Object &O);
+LLVM_ABI std::vector<const Object::value_type *>
+sortedElements(const Object &O);
/// A "cursor" marking a position within a Value.
/// The Value is a tree, and this is the path from the root to the current node.
@@ -977,7 +978,7 @@ Expected<T> parse(const llvm::StringRef &JSON, const char *RootName = "") {
/// an array, and so on.
/// With asserts disabled, this is undefined behavior.
class LLVM_ABI OStream {
- public:
+public:
using Block = llvm::function_ref<void()>;
// If IndentSize is nonzero, output is pretty-printed.
explicit OStream(llvm::raw_ostream &OS, unsigned IndentSize = 0)
diff --git a/llvm/include/llvm/Support/Locale.h b/llvm/include/llvm/Support/Locale.h
index e865dfb70de55c..485ef8fee64a72 100644
--- a/llvm/include/llvm/Support/Locale.h
+++ b/llvm/include/llvm/Support/Locale.h
@@ -10,7 +10,6 @@ namespace locale {
LLVM_ABI int columnWidth(StringRef s);
LLVM_ABI bool isPrint(int c);
-
}
}
}
diff --git a/llvm/include/llvm/Support/Memory.h b/llvm/include/llvm/Support/Memory.h
index 45adc411b419c7..06f80920e2786f 100644
--- a/llvm/include/llvm/Support/Memory.h
+++ b/llvm/include/llvm/Support/Memory.h
@@ -171,7 +171,8 @@ namespace sys {
#ifndef NDEBUG
/// Debugging output for Memory::ProtectionFlags.
- LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Memory::ProtectionFlags &PF);
+ LLVM_ABI raw_ostream &operator<<(raw_ostream &OS,
+ const Memory::ProtectionFlags &PF);
/// Debugging output for MemoryBlock.
LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const MemoryBlock &MB);
diff --git a/llvm/include/llvm/Support/NativeFormatting.h b/llvm/include/llvm/Support/NativeFormatting.h
index 425d0e46e8cb25..45336511ae9b76 100644
--- a/llvm/include/llvm/Support/NativeFormatting.h
+++ b/llvm/include/llvm/Support/NativeFormatting.h
@@ -27,21 +27,22 @@ LLVM_ABI size_t getDefaultPrecision(FloatStyle Style);
LLVM_ABI bool isPrefixedHexStyle(HexPrintStyle S);
LLVM_ABI void write_integer(raw_ostream &S, unsigned int N, size_t MinDigits,
- IntegerStyle Style);
-LLVM_ABI void write_integer(raw_ostream &S, int N, size_t MinDigits, IntegerStyle Style);
+ IntegerStyle Style);
+LLVM_ABI void write_integer(raw_ostream &S, int N, size_t MinDigits,
+ IntegerStyle Style);
LLVM_ABI void write_integer(raw_ostream &S, unsigned long N, size_t MinDigits,
- IntegerStyle Style);
+ IntegerStyle Style);
LLVM_ABI void write_integer(raw_ostream &S, long N, size_t MinDigits,
- IntegerStyle Style);
-LLVM_ABI void write_integer(raw_ostream &S, unsigned long long N, size_t MinDigits,
- IntegerStyle Style);
+ IntegerStyle Style);
+LLVM_ABI void write_integer(raw_ostream &S, unsigned long long N,
+ size_t MinDigits, IntegerStyle Style);
LLVM_ABI void write_integer(raw_ostream &S, long long N, size_t MinDigits,
- IntegerStyle Style);
+ IntegerStyle Style);
LLVM_ABI void write_hex(raw_ostream &S, uint64_t N, HexPrintStyle Style,
- std::optional<size_t> Width = std::nullopt);
+ std::optional<size_t> Width = std::nullopt);
LLVM_ABI void write_double(raw_ostream &S, double D, FloatStyle Style,
- std::optional<size_t> Precision = std::nullopt);
+ std::optional<size_t> Precision = std::nullopt);
}
#endif
diff --git a/llvm/include/llvm/Support/OptimizedStructLayout.h b/llvm/include/llvm/Support/OptimizedStructLayout.h
index 452abca2aab14a..8c11ae158d3b71 100644
--- a/llvm/include/llvm/Support/OptimizedStructLayout.h
+++ b/llvm/include/llvm/Support/OptimizedStructLayout.h
@@ -137,7 +137,7 @@ struct OptimizedStructLayoutField {
/// alignment. Note that the total size is not rounded up to a multiple
/// of the required alignment; clients which require this can do so easily.
LLVM_ABI std::pair<uint64_t, Align> performOptimizedStructLayout(
- MutableArrayRef<OptimizedStructLayoutField> Fields);
+ MutableArrayRef<OptimizedStructLayoutField> Fields);
} // namespace llvm
diff --git a/llvm/include/llvm/Support/OptionStrCmp.h b/llvm/include/llvm/Support/OptionStrCmp.h
index 4dd3ef9772e9b5..4ac2452d4405be 100644
--- a/llvm/include/llvm/Support/OptionStrCmp.h
+++ b/llvm/include/llvm/Support/OptionStrCmp.h
@@ -22,11 +22,11 @@ namespace llvm {
// are identical ignoring case, they are ordered according to case sensitive
// ordering if `FallbackCaseSensitive` is true.
LLVM_ABI int StrCmpOptionName(StringRef A, StringRef B,
- bool FallbackCaseSensitive = true);
+ bool FallbackCaseSensitive = true);
// Comparison function for Option prefixes.
LLVM_ABI int StrCmpOptionPrefixes(ArrayRef<StringRef> APrefixes,
- ArrayRef<StringRef> BPrefixes);
+ ArrayRef<StringRef> BPrefixes);
} // namespace llvm
diff --git a/llvm/include/llvm/Support/Parallel.h b/llvm/include/llvm/Support/Parallel.h
index 0fb8ab45c7daa7..3103390b0e0306 100644
--- a/llvm/include/llvm/Support/Parallel.h
+++ b/llvm/include/llvm/Support/Parallel.h
@@ -226,7 +226,8 @@ void parallelSort(RandomAccessIterator Start, RandomAccessIterator End,
llvm::sort(Start, End, Comp);
}
-LLVM_ABI void parallelFor(size_t Begin, size_t End, function_ref<void(size_t)> Fn);
+LLVM_ABI void parallelFor(size_t Begin, size_t End,
+ function_ref<void(size_t)> Fn);
template <class IterTy, class FuncTy>
void parallelForEach(IterTy Begin, IterTy End, FuncTy Fn) {
diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h
index f70405d3e7312d..6103b9cd5814b3 100644
--- a/llvm/include/llvm/Support/Path.h
+++ b/llvm/include/llvm/Support/Path.h
@@ -153,7 +153,8 @@ LLVM_ABI reverse_iterator rend(StringRef path);
/// @endcode
///
/// @param path A path that is modified to not have a file component.
-LLVM_ABI void remove_filename(SmallVectorImpl<char> &path, Style style = Style::native);
+LLVM_ABI void remove_filename(SmallVectorImpl<char> &path,
+ Style style = Style::native);
/// Replace the file extension of \a path with \a extension.
///
@@ -167,8 +168,9 @@ LLVM_ABI void remove_filename(SmallVectorImpl<char> &path, Style style = Style::
/// @param extension The extension to be added. It may be empty. It may also
/// optionally start with a '.', if it does not, one will be
/// prepended.
-LLVM_ABI void replace_extension(SmallVectorImpl<char> &path, const Twine &extension,
- Style style = Style::native);
+LLVM_ABI void replace_extension(SmallVectorImpl<char> &path,
+ const Twine &extension,
+ Style style = Style::native);
/// Replace matching path prefix with another path.
///
@@ -192,15 +194,16 @@ LLVM_ABI void replace_extension(SmallVectorImpl<char> &path, const Twine &extens
/// @param style The style used to match the prefix. Exact match using
/// Posix style, case/separator insensitive match for Windows style.
/// @result true if \a Path begins with OldPrefix
-LLVM_ABI bool replace_path_prefix(SmallVectorImpl<char> &Path, StringRef OldPrefix,
- StringRef NewPrefix,
- Style style = Style::native);
+LLVM_ABI bool replace_path_prefix(SmallVectorImpl<char> &Path,
+ StringRef OldPrefix, StringRef NewPrefix,
+ Style style = Style::native);
/// Remove redundant leading "./" pieces and consecutive separators.
///
/// @param path Input path.
/// @result The cleaned-up \a path.
-LLVM_ABI StringRef remove_leading_dotslash(StringRef path, Style style = Style::native);
+LLVM_ABI StringRef remove_leading_dotslash(StringRef path,
+ Style style = Style::native);
/// In-place remove any './' and optionally '../' components from a path.
///
@@ -208,8 +211,9 @@ LLVM_ABI StringRef remove_leading_dotslash(StringRef path, Style style = Style::
/// @param remove_dot_dot specify if '../' (except for leading "../") should be
/// removed
/// @result True if path was changed
-LLVM_ABI bool remove_dots(SmallVectorImpl<char> &path, bool remove_dot_dot = false,
- Style style = Style::native);
+LLVM_ABI bool remove_dots(SmallVectorImpl<char> &path,
+ bool remove_dot_dot = false,
+ Style style = Style::native);
/// Append to path.
///
@@ -222,12 +226,12 @@ LLVM_ABI bool remove_dots(SmallVectorImpl<char> &path, bool remove_dot_dot = fal
/// @param path Set to \a path + \a component.
/// @param a The component to be appended to \a path.
LLVM_ABI void append(SmallVectorImpl<char> &path, const Twine &a,
- const Twine &b = "",
- const Twine &c = "",
- const Twine &d = "");
+ const Twine &b = "", const Twine &c = "",
+ const Twine &d = "");
LLVM_ABI void append(SmallVectorImpl<char> &path, Style style, const Twine &a,
- const Twine &b = "", const Twine &c = "", const Twine &d = "");
+ const Twine &b = "", const Twine &c = "",
+ const Twine &d = "");
/// Append to path.
///
@@ -241,7 +245,7 @@ LLVM_ABI void append(SmallVectorImpl<char> &path, Style style, const Twine &a,
/// @param begin Start of components to append.
/// @param end One past the end of components to append.
LLVM_ABI void append(SmallVectorImpl<char> &path, const_iterator begin,
- const_iterator end, Style style = Style::native);
+ const_iterator end, Style style = Style::native);
/// @}
/// @name Transforms (or some other better name)
@@ -254,7 +258,7 @@ LLVM_ABI void append(SmallVectorImpl<char> &path, const_iterator begin,
/// @param path A path that is transformed to native format.
/// @param result Holds the result of the transformation.
LLVM_ABI void native(const Twine &path, SmallVectorImpl<char> &result,
- Style style = Style::native);
+ Style style = Style::native);
/// Convert path to the native form in place. This is used to give paths to
/// users and operating system calls in the platform's normal way. For example,
@@ -280,7 +284,8 @@ inline void make_preferred(SmallVectorImpl<char> &path,
/// @result The result of replacing backslashes with forward slashes if Windows.
/// On Unix, this function is a no-op because backslashes are valid path
/// chracters.
-LLVM_ABI std::string convert_to_slash(StringRef path, Style style = Style::native);
+LLVM_ABI std::string convert_to_slash(StringRef path,
+ Style style = Style::native);
/// @}
/// @name Lexical Observers
@@ -411,7 +416,8 @@ LLVM_ABI StringRef get_separator(Style style = Style::native);
/// (e.g., TEMP on Windows, TMPDIR on *nix) to specify a temporary directory.
///
/// @param result Holds the resulting path name.
-LLVM_ABI void system_temp_directory(bool erasedOnReboot, SmallVectorImpl<char> &result);
+LLVM_ABI void system_temp_directory(bool erasedOnReboot,
+ SmallVectorImpl<char> &result);
/// Get the user's home directory.
///
@@ -447,7 +453,8 @@ LLVM_ABI bool has_root_name(const Twine &path, Style style = Style::native);
///
/// @param path Input path.
/// @result True if the path has a root directory, false otherwise.
-LLVM_ABI bool has_root_directory(const Twine &path, Style style = Style::native);
+LLVM_ABI bool has_root_directory(const Twine &path,
+ Style style = Style::native);
/// Has root path?
///
diff --git a/llvm/include/llvm/Support/PluginLoader.h b/llvm/include/llvm/Support/PluginLoader.h
index 0db6817309b1f3..54643ca30a7ed0 100644
--- a/llvm/include/llvm/Support/PluginLoader.h
+++ b/llvm/include/llvm/Support/PluginLoader.h
@@ -24,11 +24,11 @@
#include <string>
namespace llvm {
- struct LLVM_ABI PluginLoader {
- void operator=(const std::string &Filename);
- static unsigned getNumPlugins();
- static std::string& getPlugin(unsigned num);
- };
+struct LLVM_ABI PluginLoader {
+ void operator=(const std::string &Filename);
+ static unsigned getNumPlugins();
+ static std::string &getPlugin(unsigned num);
+};
#ifndef DONT_GET_PLUGIN_LOADER_OPTION
// This causes operator= above to be invoked for every -load option.
diff --git a/llvm/include/llvm/Support/PrettyStackTrace.h b/llvm/include/llvm/Support/PrettyStackTrace.h
index a757d1c37460b3..1ab3b7b50c0184 100644
--- a/llvm/include/llvm/Support/PrettyStackTrace.h
+++ b/llvm/include/llvm/Support/PrettyStackTrace.h
@@ -35,7 +35,8 @@ namespace llvm {
///
/// \see EnablePrettyStackTrace
/// \see PrettyStackTraceEntry
- LLVM_ABI void EnablePrettyStackTraceOnSigInfoForThisThread(bool ShouldEnable = true);
+ LLVM_ABI void
+ EnablePrettyStackTraceOnSigInfoForThisThread(bool ShouldEnable = true);
/// Replaces the generic bug report message that is output upon
/// a crash.
@@ -50,7 +51,8 @@ namespace llvm {
/// constructed and destructed, they will add their symbolic frames to a
/// virtual stack trace. This gets dumped out if the program crashes.
class LLVM_ABI PrettyStackTraceEntry {
- friend LLVM_ABI PrettyStackTraceEntry *ReverseStackTrace(PrettyStackTraceEntry *);
+ friend LLVM_ABI PrettyStackTraceEntry *
+ ReverseStackTrace(PrettyStackTraceEntry *);
PrettyStackTraceEntry *NextEntry;
PrettyStackTraceEntry(const PrettyStackTraceEntry &) = delete;
diff --git a/llvm/include/llvm/Support/Process.h b/llvm/include/llvm/Support/Process.h
index b7f86b1669c14a..d2e630c056abd8 100644
--- a/llvm/include/llvm/Support/Process.h
+++ b/llvm/include/llvm/Support/Process.h
@@ -219,7 +219,6 @@ class LLVM_ABI Process {
private:
[[noreturn]] static void ExitNoCleanup(int RetCode);
};
-
}
}
diff --git a/llvm/include/llvm/Support/Program.h b/llvm/include/llvm/Support/Program.h
index ce539643f098a1..62f03342d26e8a 100644
--- a/llvm/include/llvm/Support/Program.h
+++ b/llvm/include/llvm/Support/Program.h
@@ -161,12 +161,12 @@ namespace sys {
/// Return true if the given arguments fit within system-specific
/// argument length limits.
LLVM_ABI bool commandLineFitsWithinSystemLimits(StringRef Program,
- ArrayRef<StringRef> Args);
+ ArrayRef<StringRef> Args);
/// Return true if the given arguments fit within system-specific
/// argument length limits.
LLVM_ABI bool commandLineFitsWithinSystemLimits(StringRef Program,
- ArrayRef<const char *> Args);
+ ArrayRef<const char *> Args);
/// File encoding options when writing contents that a non-UTF8 tool will
/// read (on Windows systems). For UNIX, we always use UTF-8.
@@ -209,27 +209,27 @@ namespace sys {
/// \li 0 if the child process has not changed state.
/// \note Users of this function should always check the ReturnCode member of
/// the \see ProcessInfo returned from this function.
- LLVM_ABI ProcessInfo
- Wait(const ProcessInfo &PI, ///< The child process that should be waited on.
- std::optional<unsigned> SecondsToWait, ///< If std::nullopt, waits until
- ///< child has terminated.
- ///< If a value, this specifies the amount of time to wait for the child
- ///< process. If the time expires, and \p Polling is false, the child is
- ///< killed and this < function returns. If the time expires and \p
- ///< Polling is true, the child is resumed.
- ///<
- ///< If zero, this function will perform a non-blocking
- ///< wait on the child process.
- std::string *ErrMsg = nullptr, ///< If non-zero, provides a pointer to a
- ///< string instance in which error messages will be returned. If the
- ///< string is non-empty upon return an error occurred while invoking the
- ///< program.
- std::optional<ProcessStatistics> *ProcStat =
- nullptr, ///< If non-zero, provides
- /// a pointer to a structure in which process execution statistics will
- /// be stored.
-
- bool Polling = false ///< If true, do not kill the process on timeout.
+ LLVM_ABI ProcessInfo Wait(
+ const ProcessInfo &PI, ///< The child process that should be waited on.
+ std::optional<unsigned> SecondsToWait, ///< If std::nullopt, waits until
+ ///< child has terminated.
+ ///< If a value, this specifies the amount of time to wait for the child
+ ///< process. If the time expires, and \p Polling is false, the child is
+ ///< killed and this < function returns. If the time expires and \p
+ ///< Polling is true, the child is resumed.
+ ///<
+ ///< If zero, this function will perform a non-blocking
+ ///< wait on the child process.
+ std::string *ErrMsg = nullptr, ///< If non-zero, provides a pointer to a
+ ///< string instance in which error messages will be returned. If the
+ ///< string is non-empty upon return an error occurred while invoking the
+ ///< program.
+ std::optional<ProcessStatistics> *ProcStat =
+ nullptr, ///< If non-zero, provides
+ /// a pointer to a structure in which process execution statistics will
+ /// be stored.
+
+ bool Polling = false ///< If true, do not kill the process on timeout.
);
/// Print a command argument, and optionally quote it.
@@ -240,7 +240,8 @@ namespace sys {
/// to build a single flat command line appropriate for calling CreateProcess
/// on
/// Windows.
- LLVM_ABI ErrorOr<std::wstring> flattenWindowsCommandLine(ArrayRef<StringRef> Args);
+ LLVM_ABI ErrorOr<std::wstring>
+ flattenWindowsCommandLine(ArrayRef<StringRef> Args);
#endif
}
}
diff --git a/llvm/include/llvm/Support/Recycler.h b/llvm/include/llvm/Support/Recycler.h
index e2548cc7c59615..187db31f4e2490 100644
--- a/llvm/include/llvm/Support/Recycler.h
+++ b/llvm/include/llvm/Support/Recycler.h
@@ -25,7 +25,8 @@ namespace llvm {
/// PrintRecyclingAllocatorStats - Helper for RecyclingAllocator for
/// printing statistics.
///
-LLVM_ABI void PrintRecyclerStats(size_t Size, size_t Align, size_t FreeListSize);
+LLVM_ABI void PrintRecyclerStats(size_t Size, size_t Align,
+ size_t FreeListSize);
/// Recycler - This class manages a linked-list of deallocated nodes
/// and facilitates reusing deallocated memory in place of allocating
diff --git a/llvm/include/llvm/Support/ScaledNumber.h b/llvm/include/llvm/Support/ScaledNumber.h
index 7c1765582b0fca..b1460c72106ca7 100644
--- a/llvm/include/llvm/Support/ScaledNumber.h
+++ b/llvm/include/llvm/Support/ScaledNumber.h
@@ -136,14 +136,16 @@ inline std::pair<uint64_t, int16_t> getProduct64(uint64_t LHS, uint64_t RHS) {
/// Implemented with long division.
///
/// \pre \c Dividend and \c Divisor are non-zero.
-LLVM_ABI std::pair<uint64_t, int16_t> divide64(uint64_t Dividend, uint64_t Divisor);
+LLVM_ABI std::pair<uint64_t, int16_t> divide64(uint64_t Dividend,
+ uint64_t Divisor);
/// Divide two 32-bit integers to create a 32-bit scaled number.
///
/// Implemented with one 64-bit integer divide/remainder pair.
///
/// \pre \c Dividend and \c Divisor are non-zero.
-LLVM_ABI std::pair<uint32_t, int16_t> divide32(uint32_t Dividend, uint32_t Divisor);
+LLVM_ABI std::pair<uint32_t, int16_t> divide32(uint32_t Dividend,
+ uint32_t Divisor);
/// Divide two 32-bit numbers to create a 32-bit scaled number.
///
diff --git a/llvm/include/llvm/Support/Signals.h b/llvm/include/llvm/Support/Signals.h
index 41b2ea15847da6..7aaae11f46792b 100644
--- a/llvm/include/llvm/Support/Signals.h
+++ b/llvm/include/llvm/Support/Signals.h
@@ -26,92 +26,93 @@ namespace sys {
/// This function runs all the registered interrupt handlers, including the
/// removal of files registered by RemoveFileOnSignal.
- LLVM_ABI void RunInterruptHandlers();
-
- /// This function registers signal handlers to ensure that if a signal gets
- /// delivered that the named file is removed.
- /// Remove a file if a fatal signal occurs.
- LLVM_ABI bool RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg = nullptr);
-
- /// This function removes a file from the list of files to be removed on
- /// signal delivery.
- LLVM_ABI void DontRemoveFileOnSignal(StringRef Filename);
-
- /// When an error signal (such as SIGABRT or SIGSEGV) is delivered to the
- /// process, print a stack trace and then exit.
- /// Print a stack trace if a fatal signal occurs.
- /// \param Argv0 the current binary name, used to find the symbolizer
- /// relative to the current binary before searching $PATH; can be
- /// StringRef(), in which case we will only search $PATH.
- /// \param DisableCrashReporting if \c true, disable the normal crash
- /// reporting mechanisms on the underlying operating system.
- LLVM_ABI void PrintStackTraceOnErrorSignal(StringRef Argv0,
- bool DisableCrashReporting = false);
-
- /// Disable all system dialog boxes that appear when the process crashes.
- LLVM_ABI void DisableSystemDialogsOnCrash();
-
- /// Print the stack trace using the given \c raw_ostream object.
- /// \param Depth refers to the number of stackframes to print. If not
- /// specified, the entire frame is printed.
- LLVM_ABI void PrintStackTrace(raw_ostream &OS, int Depth = 0);
-
- // Run all registered signal handlers.
- LLVM_ABI void RunSignalHandlers();
-
- using SignalHandlerCallback = void (*)(void *);
-
- /// Add a function to be called when an abort/kill signal is delivered to the
- /// process. The handler can have a cookie passed to it to identify what
- /// instance of the handler it is.
- LLVM_ABI void AddSignalHandler(SignalHandlerCallback FnPtr, void *Cookie);
-
- /// This function registers a function to be called when the user "interrupts"
- /// the program (typically by pressing ctrl-c). When the user interrupts the
- /// program, the specified interrupt function is called instead of the program
- /// being killed, and the interrupt function automatically disabled.
- ///
- /// Note that interrupt functions are not allowed to call any non-reentrant
- /// functions. An null interrupt function pointer disables the current
- /// installed function. Note also that the handler may be executed on a
- /// different thread on some platforms.
- LLVM_ABI void SetInterruptFunction(void (*IF)());
-
- /// Registers a function to be called when an "info" signal is delivered to
- /// the process.
- ///
- /// On POSIX systems, this will be SIGUSR1; on systems that have it, SIGINFO
- /// will also be used (typically ctrl-t).
- ///
- /// Note that signal handlers are not allowed to call any non-reentrant
- /// functions. An null function pointer disables the current installed
- /// function. Note also that the handler may be executed on a different
- /// thread on some platforms.
- LLVM_ABI void SetInfoSignalFunction(void (*Handler)());
-
- /// Registers a function to be called in a "one-shot" manner when a pipe
- /// signal is delivered to the process (i.e., on a failed write to a pipe).
- /// After the pipe signal is handled once, the handler is unregistered.
- ///
- /// The LLVM signal handling code will not install any handler for the pipe
- /// signal unless one is provided with this API (see \ref
- /// DefaultOneShotPipeSignalHandler). This handler must be provided before
- /// any other LLVM signal handlers are installed: the \ref InitLLVM
- /// constructor has a flag that can simplify this setup.
- ///
- /// Note that the handler is not allowed to call any non-reentrant
- /// functions. A null handler pointer disables the current installed
- /// function. Note also that the handler may be executed on a
- /// different thread on some platforms.
- LLVM_ABI void SetOneShotPipeSignalFunction(void (*Handler)());
-
- /// On Unix systems and Windows, this function exits with an "IO error" exit
- /// code.
- LLVM_ABI void DefaultOneShotPipeSignalHandler();
+LLVM_ABI void RunInterruptHandlers();
+
+/// This function registers signal handlers to ensure that if a signal gets
+/// delivered that the named file is removed.
+/// Remove a file if a fatal signal occurs.
+LLVM_ABI bool RemoveFileOnSignal(StringRef Filename,
+ std::string *ErrMsg = nullptr);
+
+/// This function removes a file from the list of files to be removed on
+/// signal delivery.
+LLVM_ABI void DontRemoveFileOnSignal(StringRef Filename);
+
+/// When an error signal (such as SIGABRT or SIGSEGV) is delivered to the
+/// process, print a stack trace and then exit.
+/// Print a stack trace if a fatal signal occurs.
+/// \param Argv0 the current binary name, used to find the symbolizer
+/// relative to the current binary before searching $PATH; can be
+/// StringRef(), in which case we will only search $PATH.
+/// \param DisableCrashReporting if \c true, disable the normal crash
+/// reporting mechanisms on the underlying operating system.
+LLVM_ABI void PrintStackTraceOnErrorSignal(StringRef Argv0,
+ bool DisableCrashReporting = false);
+
+/// Disable all system dialog boxes that appear when the process crashes.
+LLVM_ABI void DisableSystemDialogsOnCrash();
+
+/// Print the stack trace using the given \c raw_ostream object.
+/// \param Depth refers to the number of stackframes to print. If not
+/// specified, the entire frame is printed.
+LLVM_ABI void PrintStackTrace(raw_ostream &OS, int Depth = 0);
+
+// Run all registered signal handlers.
+LLVM_ABI void RunSignalHandlers();
+
+using SignalHandlerCallback = void (*)(void *);
+
+/// Add a function to be called when an abort/kill signal is delivered to the
+/// process. The handler can have a cookie passed to it to identify what
+/// instance of the handler it is.
+LLVM_ABI void AddSignalHandler(SignalHandlerCallback FnPtr, void *Cookie);
+
+/// This function registers a function to be called when the user "interrupts"
+/// the program (typically by pressing ctrl-c). When the user interrupts the
+/// program, the specified interrupt function is called instead of the program
+/// being killed, and the interrupt function automatically disabled.
+///
+/// Note that interrupt functions are not allowed to call any non-reentrant
+/// functions. An null interrupt function pointer disables the current
+/// installed function. Note also that the handler may be executed on a
+/// different thread on some platforms.
+LLVM_ABI void SetInterruptFunction(void (*IF)());
+
+/// Registers a function to be called when an "info" signal is delivered to
+/// the process.
+///
+/// On POSIX systems, this will be SIGUSR1; on systems that have it, SIGINFO
+/// will also be used (typically ctrl-t).
+///
+/// Note that signal handlers are not allowed to call any non-reentrant
+/// functions. An null function pointer disables the current installed
+/// function. Note also that the handler may be executed on a different
+/// thread on some platforms.
+LLVM_ABI void SetInfoSignalFunction(void (*Handler)());
+
+/// Registers a function to be called in a "one-shot" manner when a pipe
+/// signal is delivered to the process (i.e., on a failed write to a pipe).
+/// After the pipe signal is handled once, the handler is unregistered.
+///
+/// The LLVM signal handling code will not install any handler for the pipe
+/// signal unless one is provided with this API (see \ref
+/// DefaultOneShotPipeSignalHandler). This handler must be provided before
+/// any other LLVM signal handlers are installed: the \ref InitLLVM
+/// constructor has a flag that can simplify this setup.
+///
+/// Note that the handler is not allowed to call any non-reentrant
+/// functions. A null handler pointer disables the current installed
+/// function. Note also that the handler may be executed on a
+/// different thread on some platforms.
+LLVM_ABI void SetOneShotPipeSignalFunction(void (*Handler)());
+
+/// On Unix systems and Windows, this function exits with an "IO error" exit
+/// code.
+LLVM_ABI void DefaultOneShotPipeSignalHandler();
#ifdef _WIN32
/// Windows does not support signals and this handler must be called manually.
- LLVM_ABI void CallOneShotPipeSignalHandler();
+LLVM_ABI void CallOneShotPipeSignalHandler();
#endif
/// This function does the following:
@@ -121,9 +122,9 @@ namespace sys {
/// - create a core/mini dump of the exception context whenever possible
/// Context is a system-specific failure context: it is the signal type on
/// Unix; the ExceptionContext on Windows.
- LLVM_ABI void CleanupOnSignal(uintptr_t Context);
+LLVM_ABI void CleanupOnSignal(uintptr_t Context);
- LLVM_ABI void unregisterHandlers();
+LLVM_ABI void unregisterHandlers();
} // End sys namespace
} // End llvm namespace
diff --git a/llvm/include/llvm/Support/SipHash.h b/llvm/include/llvm/Support/SipHash.h
index 5f202d5cac2cf8..910cf59432c69a 100644
--- a/llvm/include/llvm/Support/SipHash.h
+++ b/llvm/include/llvm/Support/SipHash.h
@@ -27,11 +27,11 @@ class StringRef;
/// Computes a SipHash-2-4 64-bit result.
LLVM_ABI void getSipHash_2_4_64(ArrayRef<uint8_t> In, const uint8_t (&K)[16],
- uint8_t (&Out)[8]);
+ uint8_t (&Out)[8]);
/// Computes a SipHash-2-4 128-bit result.
LLVM_ABI void getSipHash_2_4_128(ArrayRef<uint8_t> In, const uint8_t (&K)[16],
- uint8_t (&Out)[16]);
+ uint8_t (&Out)[16]);
/// Compute a stable non-zero 16-bit hash of the given string.
///
diff --git a/llvm/include/llvm/Support/TimeProfiler.h b/llvm/include/llvm/Support/TimeProfiler.h
index f85865023a2112..9d65f1ec1efd32 100644
--- a/llvm/include/llvm/Support/TimeProfiler.h
+++ b/llvm/include/llvm/Support/TimeProfiler.h
@@ -117,8 +117,8 @@ struct TimeTraceProfilerEntry;
/// This sets up the global \p TimeTraceProfilerInstance
/// variable to be the profiler instance.
LLVM_ABI void timeTraceProfilerInitialize(unsigned TimeTraceGranularity,
- StringRef ProcName,
- bool TimeTraceVerbose = false);
+ StringRef ProcName,
+ bool TimeTraceVerbose = false);
/// Cleanup the time trace profiler, if it was initialized.
LLVM_ABI void timeTraceProfilerCleanup();
@@ -142,14 +142,14 @@ LLVM_ABI void timeTraceProfilerWrite(raw_pwrite_stream &OS);
/// Returns a StringError indicating a failure if the function is
/// unable to open the file for writing.
LLVM_ABI Error timeTraceProfilerWrite(StringRef PreferredFileName,
- StringRef FallbackFileName);
+ StringRef FallbackFileName);
/// Manually begin a time section, with the given \p Name and \p Detail.
/// Profiler copies the string data, so the pointers can be given into
/// temporaries. Time sections can be hierarchical; every Begin must have a
/// matching End pair but they can nest.
LLVM_ABI TimeTraceProfilerEntry *timeTraceProfilerBegin(StringRef Name,
- StringRef Detail);
+ StringRef Detail);
LLVM_ABI TimeTraceProfilerEntry *
timeTraceProfilerBegin(StringRef Name,
llvm::function_ref<std::string()> Detail);
@@ -164,11 +164,12 @@ timeTraceProfilerBegin(StringRef Name,
/// https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#heading=h.jh64i9l3vwa1
/// for more details.
LLVM_ABI TimeTraceProfilerEntry *timeTraceAsyncProfilerBegin(StringRef Name,
- StringRef Detail);
+ StringRef Detail);
// Mark an instant event.
-LLVM_ABI void timeTraceAddInstantEvent(StringRef Name,
- llvm::function_ref<std::string()> Detail);
+LLVM_ABI void
+timeTraceAddInstantEvent(StringRef Name,
+ llvm::function_ref<std::string()> Detail);
/// Manually end the last time section.
LLVM_ABI void timeTraceProfilerEnd();
diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h
index 266c498cd58422..b0be064f383aad 100644
--- a/llvm/include/llvm/Support/TypeSize.h
+++ b/llvm/include/llvm/Support/TypeSize.h
@@ -332,7 +332,8 @@ class ElementCount
// Stores the size of a type. If the type is of fixed size, it will represent
// the exact size. If the type is a scalable vector, it will represent the known
// minimum size.
-class LLVM_ABI TypeSize : public details::FixedOrScalableQuantity<TypeSize, uint64_t> {
+class LLVM_ABI TypeSize
+ : public details::FixedOrScalableQuantity<TypeSize, uint64_t> {
TypeSize(const FixedOrScalableQuantity<TypeSize, uint64_t> &V)
: FixedOrScalableQuantity(V) {}
diff --git a/llvm/include/llvm/Support/Unicode.h b/llvm/include/llvm/Support/Unicode.h
index 9b3a42932c6ff7..7c790da7b647d7 100644
--- a/llvm/include/llvm/Support/Unicode.h
+++ b/llvm/include/llvm/Support/Unicode.h
@@ -75,7 +75,8 @@ struct LooseMatchingResult {
SmallString<64> Name;
};
-LLVM_ABI std::optional<LooseMatchingResult> nameToCodepointLooseMatching(StringRef Name);
+LLVM_ABI std::optional<LooseMatchingResult>
+nameToCodepointLooseMatching(StringRef Name);
struct MatchForCodepointName {
std::string Name;
diff --git a/llvm/include/llvm/Support/Valgrind.h b/llvm/include/llvm/Support/Valgrind.h
index a3c490c7295c4e..894ddecf0b3e44 100644
--- a/llvm/include/llvm/Support/Valgrind.h
+++ b/llvm/include/llvm/Support/Valgrind.h
@@ -21,11 +21,11 @@
namespace llvm {
namespace sys {
// True if Valgrind is controlling this process.
- LLVM_ABI bool RunningOnValgrind();
+LLVM_ABI bool RunningOnValgrind();
- // Discard valgrind's translation of code in the range [Addr .. Addr + Len).
- // Otherwise valgrind may continue to execute the old version of the code.
- LLVM_ABI void ValgrindDiscardTranslations(const void *Addr, size_t Len);
+// Discard valgrind's translation of code in the range [Addr .. Addr + Len).
+// Otherwise valgrind may continue to execute the old version of the code.
+LLVM_ABI void ValgrindDiscardTranslations(const void *Addr, size_t Len);
} // namespace sys
} // end namespace llvm
diff --git a/llvm/include/llvm/Support/VirtualFileSystem.h b/llvm/include/llvm/Support/VirtualFileSystem.h
index e8693a359f5443..71c73cd5f3ad15 100644
--- a/llvm/include/llvm/Support/VirtualFileSystem.h
+++ b/llvm/include/llvm/Support/VirtualFileSystem.h
@@ -264,7 +264,7 @@ class LLVM_ABI recursive_directory_iterator {
/// The virtual file system interface.
class LLVM_ABI FileSystem : public llvm::ThreadSafeRefCountedBase<FileSystem>,
- public RTTIExtends<FileSystem, RTTIRoot> {
+ public RTTIExtends<FileSystem, RTTIRoot> {
public:
static const char ID;
virtual ~FileSystem();
@@ -389,7 +389,8 @@ LLVM_ABI std::unique_ptr<FileSystem> createPhysicalFileSystem();
/// top-most (most recently added) directory are used. When there is a file
/// that exists in more than one file system, the file in the top-most file
/// system overrides the other(s).
-class LLVM_ABI OverlayFileSystem : public RTTIExtends<OverlayFileSystem, FileSystem> {
+class LLVM_ABI OverlayFileSystem
+ : public RTTIExtends<OverlayFileSystem, FileSystem> {
using FileSystemList = SmallVector<IntrusiveRefCntPtr<FileSystem>, 1>;
/// The stack of file systems, implemented as a list in order of
@@ -449,7 +450,8 @@ class LLVM_ABI OverlayFileSystem : public RTTIExtends<OverlayFileSystem, FileSys
/// By default, this delegates all calls to the underlying file system. This
/// is useful when derived file systems want to override some calls and still
/// proxy other calls.
-class LLVM_ABI ProxyFileSystem : public RTTIExtends<ProxyFileSystem, FileSystem> {
+class LLVM_ABI ProxyFileSystem
+ : public RTTIExtends<ProxyFileSystem, FileSystem> {
public:
static const char ID;
explicit ProxyFileSystem(IntrusiveRefCntPtr<FileSystem> FS)
@@ -535,7 +537,8 @@ class NamedNodeOrError {
} // namespace detail
/// An in-memory file system.
-class LLVM_ABI InMemoryFileSystem : public RTTIExtends<InMemoryFileSystem, FileSystem> {
+class LLVM_ABI InMemoryFileSystem
+ : public RTTIExtends<InMemoryFileSystem, FileSystem> {
std::unique_ptr<detail::InMemoryDirectory> Root;
std::string WorkingDirectory;
bool UseNormalizedPaths = true;
diff --git a/llvm/include/llvm/Support/Watchdog.h b/llvm/include/llvm/Support/Watchdog.h
index 080edb3bd692cc..768bb3fb3a24f3 100644
--- a/llvm/include/llvm/Support/Watchdog.h
+++ b/llvm/include/llvm/Support/Watchdog.h
@@ -22,15 +22,16 @@ namespace llvm {
/// that must complete in a given amount of time. Failure to complete before
/// the timeout is an unrecoverable situation and no mechanisms to attempt
/// to handle it are provided.
- class LLVM_ABI Watchdog {
- public:
- Watchdog(unsigned int seconds);
- ~Watchdog();
- private:
- // Noncopyable.
- Watchdog(const Watchdog &other) = delete;
- Watchdog &operator=(const Watchdog &other) = delete;
- };
+ class LLVM_ABI Watchdog {
+ public:
+ Watchdog(unsigned int seconds);
+ ~Watchdog();
+
+ private:
+ // Noncopyable.
+ Watchdog(const Watchdog &other) = delete;
+ Watchdog &operator=(const Watchdog &other) = delete;
+ };
}
}
diff --git a/llvm/include/llvm/Support/Windows/WindowsSupport.h b/llvm/include/llvm/Support/Windows/WindowsSupport.h
index beca3e196a2a3e..ffc6fdf5b983c5 100644
--- a/llvm/include/llvm/Support/Windows/WindowsSupport.h
+++ b/llvm/include/llvm/Support/Windows/WindowsSupport.h
@@ -235,13 +235,15 @@ namespace windows {
// Returns command line arguments. Unlike arguments given to main(),
// this function guarantees that the returned arguments are encoded in
// UTF-8 regardless of the current code page setting.
-LLVM_ABI std::error_code GetCommandLineArguments(SmallVectorImpl<const char *> &Args,
- BumpPtrAllocator &Alloc);
+LLVM_ABI std::error_code
+GetCommandLineArguments(SmallVectorImpl<const char *> &Args,
+ BumpPtrAllocator &Alloc);
/// Convert UTF-8 path to a suitable UTF-16 path for use with the Win32 Unicode
/// File API.
-LLVM_ABI std::error_code widenPath(const Twine &Path8, SmallVectorImpl<wchar_t> &Path16,
- size_t MaxPathLen = MAX_PATH);
+LLVM_ABI std::error_code widenPath(const Twine &Path8,
+ SmallVectorImpl<wchar_t> &Path16,
+ size_t MaxPathLen = MAX_PATH);
} // end namespace windows
} // end namespace sys
diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h
index 23474986180c4a..24fa6c8b03b7d1 100644
--- a/llvm/include/llvm/Support/YAMLTraits.h
+++ b/llvm/include/llvm/Support/YAMLTraits.h
@@ -1202,92 +1202,79 @@ yamlize(IO &io, T &Seq, bool, Context &Ctx) {
}
}
-template<>
-struct LLVM_ABI ScalarTraits<bool> {
+template <> struct LLVM_ABI ScalarTraits<bool> {
static void output(const bool &, void* , raw_ostream &);
static StringRef input(StringRef, void *, bool &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<StringRef> {
+template <> struct LLVM_ABI ScalarTraits<StringRef> {
static void output(const StringRef &, void *, raw_ostream &);
static StringRef input(StringRef, void *, StringRef &);
static QuotingType mustQuote(StringRef S) { return needsQuotes(S); }
};
-template<>
-struct LLVM_ABI ScalarTraits<std::string> {
+template <> struct LLVM_ABI ScalarTraits<std::string> {
static void output(const std::string &, void *, raw_ostream &);
static StringRef input(StringRef, void *, std::string &);
static QuotingType mustQuote(StringRef S) { return needsQuotes(S); }
};
-template<>
-struct LLVM_ABI ScalarTraits<uint8_t> {
+template <> struct LLVM_ABI ScalarTraits<uint8_t> {
static void output(const uint8_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, uint8_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<uint16_t> {
+template <> struct LLVM_ABI ScalarTraits<uint16_t> {
static void output(const uint16_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, uint16_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<uint32_t> {
+template <> struct LLVM_ABI ScalarTraits<uint32_t> {
static void output(const uint32_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, uint32_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<uint64_t> {
+template <> struct LLVM_ABI ScalarTraits<uint64_t> {
static void output(const uint64_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, uint64_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<int8_t> {
+template <> struct LLVM_ABI ScalarTraits<int8_t> {
static void output(const int8_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, int8_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<int16_t> {
+template <> struct LLVM_ABI ScalarTraits<int16_t> {
static void output(const int16_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, int16_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<int32_t> {
+template <> struct LLVM_ABI ScalarTraits<int32_t> {
static void output(const int32_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, int32_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<int64_t> {
+template <> struct LLVM_ABI ScalarTraits<int64_t> {
static void output(const int64_t &, void *, raw_ostream &);
static StringRef input(StringRef, void *, int64_t &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<float> {
+template <> struct LLVM_ABI ScalarTraits<float> {
static void output(const float &, void *, raw_ostream &);
static StringRef input(StringRef, void *, float &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<double> {
+template <> struct LLVM_ABI ScalarTraits<double> {
static void output(const double &, void *, raw_ostream &);
static StringRef input(StringRef, void *, double &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
@@ -1747,29 +1734,25 @@ LLVM_YAML_STRONG_TYPEDEF(uint16_t, Hex16)
LLVM_YAML_STRONG_TYPEDEF(uint32_t, Hex32)
LLVM_YAML_STRONG_TYPEDEF(uint64_t, Hex64)
-template<>
-struct LLVM_ABI ScalarTraits<Hex8> {
+template <> struct LLVM_ABI ScalarTraits<Hex8> {
static void output(const Hex8 &, void *, raw_ostream &);
static StringRef input(StringRef, void *, Hex8 &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<Hex16> {
+template <> struct LLVM_ABI ScalarTraits<Hex16> {
static void output(const Hex16 &, void *, raw_ostream &);
static StringRef input(StringRef, void *, Hex16 &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<Hex32> {
+template <> struct LLVM_ABI ScalarTraits<Hex32> {
static void output(const Hex32 &, void *, raw_ostream &);
static StringRef input(StringRef, void *, Hex32 &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template<>
-struct LLVM_ABI ScalarTraits<Hex64> {
+template <> struct LLVM_ABI ScalarTraits<Hex64> {
static void output(const Hex64 &, void *, raw_ostream &);
static StringRef input(StringRef, void *, Hex64 &);
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
diff --git a/llvm/include/llvm/Support/circular_raw_ostream.h b/llvm/include/llvm/Support/circular_raw_ostream.h
index 7ecf6b75ca1980..80155b3fbdba7a 100644
--- a/llvm/include/llvm/Support/circular_raw_ostream.h
+++ b/llvm/include/llvm/Support/circular_raw_ostream.h
@@ -22,138 +22,136 @@ namespace llvm {
/// to a circular buffer, or can pass it through directly to an
/// underlying stream if specified with a buffer of zero.
///
- class LLVM_ABI 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
- /// issues, etc.
- ///
- static constexpr bool TAKE_OWNERSHIP = true;
-
- /// REFERENCE_ONLY - Tell this stream it should not manage the
- /// held stream.
- ///
- static constexpr bool REFERENCE_ONLY = false;
-
- private:
- /// TheStream - The real stream we output to. We set it to be
- /// unbuffered, since we're already doing our own buffering.
- ///
- raw_ostream *TheStream = nullptr;
-
- /// OwnsStream - Are we responsible for managing the underlying
- /// stream?
- ///
- bool OwnsStream;
-
- /// BufferSize - The size of the buffer in bytes.
- ///
- size_t BufferSize;
-
- /// BufferArray - The actual buffer storage.
- ///
- char *BufferArray = nullptr;
-
- /// Cur - Pointer to the current output point in BufferArray.
- ///
- char *Cur;
-
- /// Filled - Indicate whether the buffer has been completely
- /// filled. This helps avoid garbage output.
- ///
- bool Filled = false;
-
- /// Banner - A pointer to a banner to print before dumping the
- /// log.
- ///
- const char *Banner;
-
- /// flushBuffer - Dump the contents of the buffer to Stream.
- ///
- void flushBuffer() {
- if (Filled)
- // Write the older portion of the buffer.
- TheStream->write(Cur, BufferArray + BufferSize - Cur);
- // Write the newer portion of the buffer.
- TheStream->write(BufferArray, Cur - BufferArray);
- Cur = BufferArray;
- Filled = false;
- }
-
- void write_impl(const char *Ptr, size_t Size) override;
-
- /// current_pos - Return the current position within the stream,
- /// not counting the bytes currently in the buffer.
- ///
- uint64_t current_pos() const override {
- // This has the same effect as calling TheStream.current_pos(),
- // but that interface is private.
- return TheStream->tell() - TheStream->GetNumBytesInBuffer();
- }
-
- public:
- /// circular_raw_ostream - Construct an optionally
- /// circular-buffered stream, handing it an underlying stream to
- /// do the "real" output.
- ///
- /// As a side effect, if BuffSize is nonzero, the given Stream is
- /// set to be Unbuffered. This is because circular_raw_ostream
- /// does its own buffering, so it doesn't want another layer of
- /// buffering to be happening underneath it.
- ///
- /// "Owns" tells the circular_raw_ostream whether it is
- /// responsible for managing the held stream, doing memory
- /// management of it, etc.
- ///
- circular_raw_ostream(raw_ostream &Stream, const char *Header,
- size_t BuffSize = 0, bool Owns = REFERENCE_ONLY)
- : raw_ostream(/*unbuffered*/ true), OwnsStream(Owns),
- BufferSize(BuffSize), Banner(Header) {
- if (BufferSize != 0)
- BufferArray = new char[BufferSize];
- Cur = BufferArray;
- setStream(Stream, Owns);
- }
-
- ~circular_raw_ostream() override {
- flush();
- flushBufferWithBanner();
- releaseStream();
- delete[] BufferArray;
- }
-
- bool is_displayed() const override {
- return TheStream->is_displayed();
- }
-
- /// setStream - Tell the circular_raw_ostream to output a
- /// different stream. "Owns" tells circular_raw_ostream whether
- /// it should take responsibility for managing the underlying
- /// stream.
- ///
- void setStream(raw_ostream &Stream, bool Owns = REFERENCE_ONLY) {
- releaseStream();
- TheStream = &Stream;
- OwnsStream = Owns;
- }
-
- /// flushBufferWithBanner - Force output of the buffer along with
- /// a small header.
- ///
- void flushBufferWithBanner();
-
- private:
- /// releaseStream - Delete the held stream if needed. Otherwise,
- /// transfer the buffer settings from this circular_raw_ostream
- /// back to the underlying stream.
- ///
- void releaseStream() {
- if (!TheStream)
- return;
- if (OwnsStream)
- delete TheStream;
- }
- };
+class LLVM_ABI 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
+ /// issues, etc.
+ ///
+ static constexpr bool TAKE_OWNERSHIP = true;
+
+ /// REFERENCE_ONLY - Tell this stream it should not manage the
+ /// held stream.
+ ///
+ static constexpr bool REFERENCE_ONLY = false;
+
+private:
+ /// TheStream - The real stream we output to. We set it to be
+ /// unbuffered, since we're already doing our own buffering.
+ ///
+ raw_ostream *TheStream = nullptr;
+
+ /// OwnsStream - Are we responsible for managing the underlying
+ /// stream?
+ ///
+ bool OwnsStream;
+
+ /// BufferSize - The size of the buffer in bytes.
+ ///
+ size_t BufferSize;
+
+ /// BufferArray - The actual buffer storage.
+ ///
+ char *BufferArray = nullptr;
+
+ /// Cur - Pointer to the current output point in BufferArray.
+ ///
+ char *Cur;
+
+ /// Filled - Indicate whether the buffer has been completely
+ /// filled. This helps avoid garbage output.
+ ///
+ bool Filled = false;
+
+ /// Banner - A pointer to a banner to print before dumping the
+ /// log.
+ ///
+ const char *Banner;
+
+ /// flushBuffer - Dump the contents of the buffer to Stream.
+ ///
+ void flushBuffer() {
+ if (Filled)
+ // Write the older portion of the buffer.
+ TheStream->write(Cur, BufferArray + BufferSize - Cur);
+ // Write the newer portion of the buffer.
+ TheStream->write(BufferArray, Cur - BufferArray);
+ Cur = BufferArray;
+ Filled = false;
+ }
+
+ void write_impl(const char *Ptr, size_t Size) override;
+
+ /// current_pos - Return the current position within the stream,
+ /// not counting the bytes currently in the buffer.
+ ///
+ uint64_t current_pos() const override {
+ // This has the same effect as calling TheStream.current_pos(),
+ // but that interface is private.
+ return TheStream->tell() - TheStream->GetNumBytesInBuffer();
+ }
+
+public:
+ /// circular_raw_ostream - Construct an optionally
+ /// circular-buffered stream, handing it an underlying stream to
+ /// do the "real" output.
+ ///
+ /// As a side effect, if BuffSize is nonzero, the given Stream is
+ /// set to be Unbuffered. This is because circular_raw_ostream
+ /// does its own buffering, so it doesn't want another layer of
+ /// buffering to be happening underneath it.
+ ///
+ /// "Owns" tells the circular_raw_ostream whether it is
+ /// responsible for managing the held stream, doing memory
+ /// management of it, etc.
+ ///
+ circular_raw_ostream(raw_ostream &Stream, const char *Header,
+ size_t BuffSize = 0, bool Owns = REFERENCE_ONLY)
+ : raw_ostream(/*unbuffered*/ true), OwnsStream(Owns),
+ BufferSize(BuffSize), Banner(Header) {
+ if (BufferSize != 0)
+ BufferArray = new char[BufferSize];
+ Cur = BufferArray;
+ setStream(Stream, Owns);
+ }
+
+ ~circular_raw_ostream() override {
+ flush();
+ flushBufferWithBanner();
+ releaseStream();
+ delete[] BufferArray;
+ }
+
+ bool is_displayed() const override { return TheStream->is_displayed(); }
+
+ /// setStream - Tell the circular_raw_ostream to output a
+ /// different stream. "Owns" tells circular_raw_ostream whether
+ /// it should take responsibility for managing the underlying
+ /// stream.
+ ///
+ void setStream(raw_ostream &Stream, bool Owns = REFERENCE_ONLY) {
+ releaseStream();
+ TheStream = &Stream;
+ OwnsStream = Owns;
+ }
+
+ /// flushBufferWithBanner - Force output of the buffer along with
+ /// a small header.
+ ///
+ void flushBufferWithBanner();
+
+private:
+ /// releaseStream - Delete the held stream if needed. Otherwise,
+ /// transfer the buffer settings from this circular_raw_ostream
+ /// back to the underlying stream.
+ ///
+ void releaseStream() {
+ if (!TheStream)
+ return;
+ if (OwnsStream)
+ delete TheStream;
+ }
+};
} // end llvm namespace
#endif
diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h
index e58732b49dc54b..3107c4bd5e74e3 100644
--- a/llvm/include/llvm/Support/raw_ostream.h
+++ b/llvm/include/llvm/Support/raw_ostream.h
@@ -837,7 +837,7 @@ class Error;
/// a temporary file. The final output file is atomically replaced with the
/// temporary file after the \p Write function is finished.
LLVM_ABI Error writeToOutput(StringRef OutputFileName,
- std::function<Error(raw_ostream &)> Write);
+ std::function<Error(raw_ostream &)> Write);
LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, std::nullopt_t);
>From cc463293355dfbaa1361dff92a2778da7f1a7303 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Tue, 19 Nov 2024 22:26:10 +0000
Subject: [PATCH 4/4] format again
---
llvm/include/llvm/Support/FileSystem.h | 4 ++--
llvm/include/llvm/Support/FileUtilities.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/include/llvm/Support/FileSystem.h b/llvm/include/llvm/Support/FileSystem.h
index 40fb0de68db335..57af35de5413ad 100644
--- a/llvm/include/llvm/Support/FileSystem.h
+++ b/llvm/include/llvm/Support/FileSystem.h
@@ -230,11 +230,11 @@ class LLVM_ABI file_status : public basic_file_status {
dev_t fs_st_dev = 0;
nlink_t fs_st_nlinks = 0;
ino_t fs_st_ino = 0;
-#elif defined (_WIN32)
+#elif defined(_WIN32)
uint32_t NumLinks = 0;
uint32_t VolumeSerialNumber = 0;
uint64_t PathHash = 0;
- #endif
+#endif
public:
file_status() = default;
diff --git a/llvm/include/llvm/Support/FileUtilities.h b/llvm/include/llvm/Support/FileUtilities.h
index 558b17bb823b29..6130284eb27c91 100644
--- a/llvm/include/llvm/Support/FileUtilities.h
+++ b/llvm/include/llvm/Support/FileUtilities.h
@@ -74,7 +74,7 @@ class FileRemover {
/// releaseFile - Take ownership of the file away from the FileRemover so it
/// will not be removed when the object is destroyed.
void releaseFile() { DeleteIt = false; }
- };
+};
/// FilePermssionsApplier helps to copy permissions from an input file to
/// an output one. It memorizes the status of the input file and can apply
More information about the llvm-commits
mailing list