Skip to content

Commit 305f60a

Browse files
committed
[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.
1 parent 8673d0e commit 305f60a

File tree

126 files changed

+744
-631
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+744
-631
lines changed

llvm/include/llvm/Support/AMDGPUMetadata.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#define LLVM_SUPPORT_AMDGPUMETADATA_H
1717

1818
#include "llvm/ADT/StringRef.h"
19+
#include "llvm/Support/Compiler.h"
1920
#include <cstdint>
2021
#include <string>
2122
#include <system_error>
@@ -447,10 +448,10 @@ struct Metadata final {
447448
};
448449

449450
/// Converts \p String to \p HSAMetadata.
450-
std::error_code fromString(StringRef String, Metadata &HSAMetadata);
451+
LLVM_ABI std::error_code fromString(StringRef String, Metadata &HSAMetadata);
451452

452453
/// Converts \p HSAMetadata to \p String.
453-
std::error_code toString(Metadata HSAMetadata, std::string &String);
454+
LLVM_ABI std::error_code toString(Metadata HSAMetadata, std::string &String);
454455

455456
//===----------------------------------------------------------------------===//
456457
// HSA metadata for v3 code object.

llvm/include/llvm/Support/ARMAttributeParser.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
#include "ARMBuildAttributes.h"
1313
#include "ELFAttributeParser.h"
1414
#include "llvm/ADT/StringRef.h"
15+
#include "llvm/Support/Compiler.h"
1516
#include "llvm/Support/Error.h"
1617

1718
namespace llvm {
1819

1920
class ScopedPrinter;
2021

21-
class ARMAttributeParser : public ELFAttributeParser {
22+
class LLVM_ABI ARMAttributeParser : public ELFAttributeParser {
2223
struct DisplayHandler {
2324
ARMBuildAttrs::AttrType attribute;
2425
Error (ARMAttributeParser::*routine)(ARMBuildAttrs::AttrType);

llvm/include/llvm/Support/ARMBuildAttributes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
#ifndef LLVM_SUPPORT_ARMBUILDATTRIBUTES_H
1919
#define LLVM_SUPPORT_ARMBUILDATTRIBUTES_H
2020

21+
#include "llvm/Support/Compiler.h"
2122
#include "llvm/Support/ELFAttributes.h"
2223

2324
namespace llvm {
2425
namespace ARMBuildAttrs {
2526

26-
const TagNameMap &getARMAttributeTags();
27+
LLVM_ABI const TagNameMap &getARMAttributeTags();
2728

2829
enum SpecialAttr {
2930
// This is for the .cpu asm attr. It translates into one or more

llvm/include/llvm/Support/ARMWinEH.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define LLVM_SUPPORT_ARMWINEH_H
1111

1212
#include "llvm/ADT/ArrayRef.h"
13+
#include "llvm/Support/Compiler.h"
1314
#include "llvm/Support/Endian.h"
1415

1516
namespace llvm {
@@ -205,7 +206,7 @@ inline uint16_t StackAdjustment(const RuntimeFunction &RF) {
205206

206207
/// SavedRegisterMask - Utility function to calculate the set of saved general
207208
/// purpose (r0-r15) and VFP (d0-d31) registers.
208-
std::pair<uint16_t, uint32_t> SavedRegisterMask(const RuntimeFunction &RF,
209+
LLVM_ABI std::pair<uint16_t, uint32_t> SavedRegisterMask(const RuntimeFunction &RF,
209210
bool Prologue = true);
210211

211212
/// RuntimeFunctionARM64 - An entry in the table of procedure data (.pdata)

llvm/include/llvm/Support/Allocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace detail {
3636

3737
// We call out to an external function to actually print the message as the
3838
// printing code uses Allocator.h in its implementation.
39-
void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated,
39+
LLVM_ABI void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated,
4040
size_t TotalMemory);
4141

4242
} // end namespace detail

llvm/include/llvm/Support/Atomic.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef LLVM_SUPPORT_ATOMIC_H
1818
#define LLVM_SUPPORT_ATOMIC_H
1919

20+
#include "llvm/Support/Compiler.h"
2021
#include "llvm/Support/DataTypes.h"
2122

2223
// Windows will at times define MemoryFence.
@@ -26,14 +27,14 @@
2627

2728
namespace llvm {
2829
namespace sys {
29-
void MemoryFence();
30+
LLVM_ABI void MemoryFence();
3031

3132
#ifdef _MSC_VER
3233
typedef long cas_flag;
3334
#else
3435
typedef uint32_t cas_flag;
3536
#endif
36-
cas_flag CompareAndSwap(volatile cas_flag* ptr,
37+
LLVM_ABI cas_flag CompareAndSwap(volatile cas_flag* ptr,
3738
cas_flag new_value,
3839
cas_flag old_value);
3940
}

llvm/include/llvm/Support/BalancedPartitioning.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
#include "raw_ostream.h"
4343
#include "llvm/ADT/ArrayRef.h"
44+
#include "llvm/Support/Compiler.h"
4445

4546
#include <atomic>
4647
#include <condition_variable>
@@ -53,7 +54,7 @@ namespace llvm {
5354
class ThreadPoolInterface;
5455
/// A function with a set of utility nodes where it is beneficial to order two
5556
/// functions close together if they have similar utility nodes
56-
class BPFunctionNode {
57+
class LLVM_ABI BPFunctionNode {
5758
friend class BalancedPartitioning;
5859

5960
public:
@@ -97,7 +98,7 @@ struct BalancedPartitioningConfig {
9798
unsigned TaskSplitDepth = 9;
9899
};
99100

100-
class BalancedPartitioning {
101+
class LLVM_ABI BalancedPartitioning {
101102
public:
102103
BalancedPartitioning(const BalancedPartitioningConfig &Config);
103104

@@ -114,7 +115,7 @@ class BalancedPartitioning {
114115
/// wait(). BalancedPartitioning recursively spawns new threads inside other
115116
/// threads, so we need to track how many active threads that could spawn more
116117
/// threads.
117-
struct BPThreadPool {
118+
struct LLVM_ABI BPThreadPool {
118119
ThreadPoolInterface &TheThreadPool;
119120
std::mutex mtx;
120121
std::condition_variable cv;

llvm/include/llvm/Support/Base64.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef LLVM_SUPPORT_BASE64_H
1414
#define LLVM_SUPPORT_BASE64_H
1515

16+
#include "llvm/Support/Compiler.h"
1617
#include "llvm/Support/Error.h"
1718
#include <cstdint>
1819
#include <string>
@@ -54,7 +55,7 @@ template <class InputBytes> std::string encodeBase64(InputBytes const &Bytes) {
5455
return Buffer;
5556
}
5657

57-
llvm::Error decodeBase64(llvm::StringRef Input, std::vector<char> &Output);
58+
LLVM_ABI llvm::Error decodeBase64(llvm::StringRef Input, std::vector<char> &Output);
5859

5960
} // end namespace llvm
6061

llvm/include/llvm/Support/BinaryStream.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "llvm/ADT/ArrayRef.h"
1313
#include "llvm/ADT/BitmaskEnum.h"
1414
#include "llvm/Support/BinaryStreamError.h"
15+
#include "llvm/Support/Compiler.h"
1516
#include "llvm/Support/Error.h"
1617
#include <cstdint>
1718

@@ -31,7 +32,7 @@ enum BinaryStreamFlags {
3132
/// single contiguous buffer (or even in memory at all), in such cases a it may
3233
/// be necessary for an implementation to cache such a buffer so that it can
3334
/// return it.
34-
class BinaryStream {
35+
class LLVM_ABI BinaryStream {
3536
public:
3637
virtual ~BinaryStream() = default;
3738

@@ -69,7 +70,7 @@ class BinaryStream {
6970
/// buffer to the stream's backing store. Streams are assumed to be buffered
7071
/// so that to be portable it is necessary to call commit() on the stream when
7172
/// all data has been written.
72-
class WritableBinaryStream : public BinaryStream {
73+
class LLVM_ABI WritableBinaryStream : public BinaryStream {
7374
public:
7475
~WritableBinaryStream() override = default;
7576

llvm/include/llvm/Support/BinaryStreamError.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define LLVM_SUPPORT_BINARYSTREAMERROR_H
1111

1212
#include "llvm/ADT/StringRef.h"
13+
#include "llvm/Support/Compiler.h"
1314
#include "llvm/Support/Error.h"
1415

1516
#include <string>
@@ -24,7 +25,7 @@ enum class stream_error_code {
2425
};
2526

2627
/// Base class for errors originating when parsing raw PDB files
27-
class BinaryStreamError : public ErrorInfo<BinaryStreamError> {
28+
class LLVM_ABI BinaryStreamError : public ErrorInfo<BinaryStreamError> {
2829
public:
2930
static char ID;
3031
explicit BinaryStreamError(stream_error_code C);

0 commit comments

Comments
 (0)