Skip to content

[Support] Add clang tooling generated explicit visibility macros #113097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions llvm/include/llvm/Support/AMDGPUMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/Support/ARMAttributeParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/Support/ARMBuildAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions llvm/include/llvm/Support/ARMWinEH.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -205,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.
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)
///
Expand Down
5 changes: 3 additions & 2 deletions llvm/include/llvm/Support/Allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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

Expand Down
12 changes: 6 additions & 6 deletions llvm/include/llvm/Support/Atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -26,16 +27,15 @@

namespace llvm {
namespace sys {
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
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);
}
}

Expand Down
7 changes: 4 additions & 3 deletions llvm/include/llvm/Support/BalancedPartitioning.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#include "raw_ostream.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/Compiler.h"

#include <atomic>
#include <condition_variable>
Expand All @@ -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:
Expand Down Expand Up @@ -97,7 +98,7 @@ struct BalancedPartitioningConfig {
unsigned TaskSplitDepth = 9;
};

class BalancedPartitioning {
class LLVM_ABI BalancedPartitioning {
public:
BalancedPartitioning(const BalancedPartitioningConfig &Config);

Expand All @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion llvm/include/llvm/Support/Base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -54,7 +55,8 @@ 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

Expand Down
5 changes: 3 additions & 2 deletions llvm/include/llvm/Support/BinaryStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/Support/BinaryStreamError.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/Support/BinaryStreamReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions llvm/include/llvm/Support/BinaryStreamRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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>;
Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/Support/BinaryStreamWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions llvm/include/llvm/Support/BlockFrequency.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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:
Expand Down Expand Up @@ -120,8 +121,8 @@ class BlockFrequency {
}
};

void printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq,
BlockFrequency Freq);
LLVM_ABI void printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq,
BlockFrequency Freq);

} // namespace llvm

Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/Support/BranchProbability.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/Support/BuryPointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#ifndef LLVM_SUPPORT_BURYPOINTER_H
#define LLVM_SUPPORT_BURYPOINTER_H

#include "llvm/Support/Compiler.h"
#include <memory>

namespace llvm {
Expand All @@ -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());
}
Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/Support/COM.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions llvm/include/llvm/Support/CRC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand All @@ -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) {}

Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/Support/CSKYAttributeParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading
Loading