Skip to content

Commit b53a81d

Browse files
committed
[llvm] manual fixups to export annotations
1 parent a92b393 commit b53a81d

25 files changed

+120
-89
lines changed

llvm/include/llvm/Support/COM.h

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#ifndef LLVM_SUPPORT_COM_H
1515
#define LLVM_SUPPORT_COM_H
1616

17+
#include "llvm/Support/Compiler.h"
18+
1719
namespace llvm {
1820
namespace sys {
1921

llvm/include/llvm/Support/CommandLine.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ template <class DataType> class basic_parser : public basic_parser_impl {
941941

942942
//--------------------------------------------------
943943

944-
extern template class basic_parser<bool>;
944+
extern template class LLVM_TEMPLATE_ABI basic_parser<bool>;
945945

946946
template <> class LLVM_ABI parser<bool> : public basic_parser<bool> {
947947
public:
@@ -968,7 +968,7 @@ template <> class LLVM_ABI parser<bool> : public basic_parser<bool> {
968968

969969
//--------------------------------------------------
970970

971-
extern template class basic_parser<boolOrDefault>;
971+
extern template class LLVM_TEMPLATE_ABI basic_parser<boolOrDefault>;
972972

973973
template <>
974974
class LLVM_ABI parser<boolOrDefault> : public basic_parser<boolOrDefault> {
@@ -994,7 +994,7 @@ class LLVM_ABI parser<boolOrDefault> : public basic_parser<boolOrDefault> {
994994

995995
//--------------------------------------------------
996996

997-
extern template class basic_parser<int>;
997+
extern template class LLVM_TEMPLATE_ABI basic_parser<int>;
998998

999999
template <> class LLVM_ABI parser<int> : public basic_parser<int> {
10001000
public:
@@ -1015,7 +1015,7 @@ template <> class LLVM_ABI parser<int> : public basic_parser<int> {
10151015

10161016
//--------------------------------------------------
10171017

1018-
extern template class basic_parser<long>;
1018+
extern template class LLVM_TEMPLATE_ABI basic_parser<long>;
10191019

10201020
template <> class LLVM_ABI parser<long> final : public basic_parser<long> {
10211021
public:
@@ -1036,7 +1036,7 @@ template <> class LLVM_ABI parser<long> final : public basic_parser<long> {
10361036

10371037
//--------------------------------------------------
10381038

1039-
extern template class basic_parser<long long>;
1039+
extern template class LLVM_TEMPLATE_ABI basic_parser<long long>;
10401040

10411041
template <> class LLVM_ABI parser<long long> : public basic_parser<long long> {
10421042
public:
@@ -1057,7 +1057,7 @@ template <> class LLVM_ABI parser<long long> : public basic_parser<long long> {
10571057

10581058
//--------------------------------------------------
10591059

1060-
extern template class basic_parser<unsigned>;
1060+
extern template class LLVM_TEMPLATE_ABI basic_parser<unsigned>;
10611061

10621062
template <> class LLVM_ABI parser<unsigned> : public basic_parser<unsigned> {
10631063
public:
@@ -1078,7 +1078,7 @@ template <> class LLVM_ABI parser<unsigned> : public basic_parser<unsigned> {
10781078

10791079
//--------------------------------------------------
10801080

1081-
extern template class basic_parser<unsigned long>;
1081+
extern template class LLVM_TEMPLATE_ABI basic_parser<unsigned long>;
10821082

10831083
template <>
10841084
class LLVM_ABI parser<unsigned long> final
@@ -1101,7 +1101,7 @@ class LLVM_ABI parser<unsigned long> final
11011101

11021102
//--------------------------------------------------
11031103

1104-
extern template class basic_parser<unsigned long long>;
1104+
extern template class LLVM_TEMPLATE_ABI basic_parser<unsigned long long>;
11051105

11061106
template <>
11071107
class LLVM_ABI parser<unsigned long long>
@@ -1125,7 +1125,7 @@ class LLVM_ABI parser<unsigned long long>
11251125

11261126
//--------------------------------------------------
11271127

1128-
extern template class basic_parser<double>;
1128+
extern template class LLVM_TEMPLATE_ABI basic_parser<double>;
11291129

11301130
template <> class LLVM_ABI parser<double> : public basic_parser<double> {
11311131
public:
@@ -1146,7 +1146,7 @@ template <> class LLVM_ABI parser<double> : public basic_parser<double> {
11461146

11471147
//--------------------------------------------------
11481148

1149-
extern template class basic_parser<float>;
1149+
extern template class LLVM_TEMPLATE_ABI basic_parser<float>;
11501150

11511151
template <> class LLVM_ABI parser<float> : public basic_parser<float> {
11521152
public:
@@ -1167,7 +1167,7 @@ template <> class LLVM_ABI parser<float> : public basic_parser<float> {
11671167

11681168
//--------------------------------------------------
11691169

1170-
extern template class basic_parser<std::string>;
1170+
extern template class LLVM_TEMPLATE_ABI basic_parser<std::string>;
11711171

11721172
template <>
11731173
class LLVM_ABI parser<std::string> : public basic_parser<std::string> {
@@ -1192,7 +1192,7 @@ class LLVM_ABI parser<std::string> : public basic_parser<std::string> {
11921192

11931193
//--------------------------------------------------
11941194

1195-
extern template class basic_parser<char>;
1195+
extern template class LLVM_TEMPLATE_ABI basic_parser<char>;
11961196

11971197
template <> class LLVM_ABI parser<char> : public basic_parser<char> {
11981198
public:

llvm/include/llvm/Support/ConvertUTF.h

+8-6
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,16 @@ LLVM_ABI bool convertUTF8ToUTF16String(StringRef SrcUTF8,
349349
#if defined(_WIN32)
350350
namespace sys {
351351
namespace windows {
352-
std::error_code UTF8ToUTF16(StringRef utf8, SmallVectorImpl<wchar_t> &utf16);
352+
LLVM_ABI std::error_code UTF8ToUTF16(StringRef utf8,
353+
SmallVectorImpl<wchar_t> &utf16);
353354
/// Convert to UTF16 from the current code page used in the system
354-
std::error_code CurCPToUTF16(StringRef utf8, SmallVectorImpl<wchar_t> &utf16);
355-
std::error_code UTF16ToUTF8(const wchar_t *utf16, size_t utf16_len,
356-
SmallVectorImpl<char> &utf8);
355+
LLVM_ABI std::error_code CurCPToUTF16(StringRef utf8,
356+
SmallVectorImpl<wchar_t> &utf16);
357+
LLVM_ABI std::error_code UTF16ToUTF8(const wchar_t *utf16, size_t utf16_len,
358+
SmallVectorImpl<char> &utf8);
357359
/// Convert from UTF16 to the current code page used in the system
358-
std::error_code UTF16ToCurCP(const wchar_t *utf16, size_t utf16_len,
359-
SmallVectorImpl<char> &utf8);
360+
LLVM_ABI std::error_code UTF16ToCurCP(const wchar_t *utf16, size_t utf16_len,
361+
SmallVectorImpl<char> &utf8);
360362
} // namespace windows
361363
} // namespace sys
362364
#endif

llvm/include/llvm/Support/Debug.h

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#ifndef LLVM_SUPPORT_DEBUG_H
2929
#define LLVM_SUPPORT_DEBUG_H
3030

31+
#include "llvm/Support/Compiler.h"
32+
3133
namespace llvm {
3234

3335
class raw_ostream;

llvm/include/llvm/Support/DynamicLibrary.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DynamicLibrary {
3535
// Placeholder whose address represents an invalid library.
3636
// We use this instead of NULL or a pointer-int pair because the OS library
3737
// might define 0 or 1 to be "special" handles, such as "search all".
38-
static char Invalid;
38+
LLVM_ABI static char Invalid;
3939

4040
// Opaque data used to interface with OS-specific dynamic library handling.
4141
void *Data;

llvm/include/llvm/Support/Error.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ class [[nodiscard]] Error {
262262
// of debug prints can cause the function to be too large for inlining. So
263263
// it's important that we define this function out of line so that it can't be
264264
// inlined.
265-
[[noreturn]] void fatalUncheckedError() const;
265+
[[noreturn]] LLVM_ABI void fatalUncheckedError() const;
266266
#endif
267267

268268
void assertIsChecked() {
@@ -402,6 +402,10 @@ class LLVM_ABI ErrorList final : public ErrorInfo<ErrorList> {
402402
Payloads.push_back(std::move(Payload2));
403403
}
404404

405+
// Explicitly non-copyable.
406+
ErrorList(ErrorList const &) = delete;
407+
ErrorList &operator=(ErrorList const &) = delete;
408+
405409
static Error join(Error E1, Error E2) {
406410
if (!E1)
407411
return E2;
@@ -1195,7 +1199,7 @@ class LLVM_ABI ECError : public ErrorInfo<ECError> {
11951199
void log(raw_ostream &OS) const override { OS << EC.message(); }
11961200

11971201
// Used by ErrorInfo::classID.
1198-
static char ID;
1202+
LLVM_ABI static char ID;
11991203

12001204
protected:
12011205
ECError() = default;

llvm/include/llvm/Support/ExtensibleRTTI.h

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
#ifndef LLVM_SUPPORT_EXTENSIBLERTTI_H
6161
#define LLVM_SUPPORT_EXTENSIBLERTTI_H
6262

63+
#include "llvm/Support/Compiler.h"
64+
6365
namespace llvm {
6466

6567
/// Base class for the extensible RTTI hierarchy.

llvm/include/llvm/Support/FileSystem.h

+11-10
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,17 @@ class basic_file_status {
220220

221221
/// Represents the result of a call to sys::fs::status().
222222
class file_status : public basic_file_status {
223-
friend bool equivalent(file_status A, file_status B);
223+
LLVM_ABI_FRIEND friend bool equivalent(file_status A, file_status B);
224224

225-
#if defined(LLVM_ON_UNIX)
225+
#if defined(LLVM_ON_UNIX)
226226
dev_t fs_st_dev = 0;
227227
nlink_t fs_st_nlinks = 0;
228228
ino_t fs_st_ino = 0;
229-
#elif defined (_WIN32)
229+
#elif defined(_WIN32)
230230
uint32_t NumLinks = 0;
231231
uint32_t VolumeSerialNumber = 0;
232232
uint64_t PathHash = 0;
233-
#endif
233+
#endif
234234

235235
public:
236236
file_status() = default;
@@ -645,7 +645,7 @@ LLVM_ABI std::error_code status(int FD, file_status &Result);
645645

646646
#ifdef _WIN32
647647
/// A version for when a file descriptor is already available.
648-
std::error_code status(file_t FD, file_status &Result);
648+
LLVM_ABI std::error_code status(file_t FD, file_status &Result);
649649
#endif
650650

651651
/// Get file creation mode mask of the process.
@@ -851,7 +851,7 @@ LLVM_ABI std::error_code createUniqueFile(const Twine &Model,
851851
/// properly handle errors in a destructor.
852852
class TempFile {
853853
bool Done = false;
854-
TempFile(StringRef Name, int FD);
854+
LLVM_ABI TempFile(StringRef Name, int FD);
855855

856856
public:
857857
/// This creates a temporary file with createUniqueFile and schedules it for
@@ -992,7 +992,7 @@ LLVM_ABI Expected<file_t> openNativeFile(const Twine &Name,
992992
/// Converts from a Posix file descriptor number to a native file handle.
993993
/// On Windows, this retreives the underlying handle. On non-Windows, this is a
994994
/// no-op.
995-
file_t convertFDToNativeFile(int FD);
995+
LLVM_ABI file_t convertFDToNativeFile(int FD);
996996

997997
#ifndef _WIN32
998998
inline file_t convertFDToNativeFile(int FD) { return FD; }
@@ -1305,10 +1305,11 @@ class mapped_file_region {
13051305
Moved.copyFrom(mapped_file_region());
13061306
}
13071307

1308-
void unmapImpl();
1309-
void dontNeedImpl();
1308+
LLVM_ABI void unmapImpl();
1309+
LLVM_ABI void dontNeedImpl();
13101310

1311-
std::error_code init(sys::fs::file_t FD, uint64_t Offset, mapmode Mode);
1311+
LLVM_ABI std::error_code init(sys::fs::file_t FD, uint64_t Offset,
1312+
mapmode Mode);
13121313

13131314
public:
13141315
mapped_file_region() = default;

llvm/include/llvm/Support/JSON.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -481,12 +481,12 @@ class Value {
481481
#endif // !NDEBUG || LLVM_ENABLE_DUMP
482482

483483
private:
484-
void destroy();
485-
void copyFrom(const Value &M);
484+
LLVM_ABI void destroy();
485+
LLVM_ABI void copyFrom(const Value &M);
486486
// We allow moving from *const* Values, by marking all members as mutable!
487487
// This hack is needed to support initializer-list syntax efficiently.
488488
// (std::initializer_list<T> is a container of const T).
489-
void moveFrom(const Value &&M);
489+
LLVM_ABI void moveFrom(const Value &&M);
490490
friend class Array;
491491
friend class Object;
492492

@@ -531,7 +531,7 @@ class Value {
531531
llvm::StringRef, std::string, json::Array,
532532
json::Object>
533533
Union;
534-
friend bool operator==(const Value &, const Value &);
534+
LLVM_ABI_FRIEND friend bool operator==(const Value &, const Value &);
535535
};
536536

537537
LLVM_ABI bool operator==(const Value &, const Value &);
@@ -713,7 +713,7 @@ class Path::Root {
713713
llvm::StringLiteral ErrorMessage;
714714
std::vector<Path::Segment> ErrorPath; // Only valid in error state. Reversed.
715715

716-
friend void Path::report(llvm::StringLiteral Message);
716+
LLVM_ABI_FRIEND friend void Path::report(llvm::StringLiteral Message);
717717

718718
public:
719719
Root(llvm::StringRef Name = "") : Name(Name), ErrorMessage("") {}
@@ -1071,9 +1071,9 @@ class OStream {
10711071
attributeEnd();
10721072
}
10731073

1074-
void valueBegin();
1075-
void flushComment();
1076-
void newline();
1074+
LLVM_ABI void valueBegin();
1075+
LLVM_ABI void flushComment();
1076+
LLVM_ABI void newline();
10771077

10781078
enum Context {
10791079
Singleton, // Top level, or object attribute.

llvm/include/llvm/Support/Locale.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef LLVM_SUPPORT_LOCALE_H
22
#define LLVM_SUPPORT_LOCALE_H
33

4+
#include "llvm/Support/Compiler.h"
5+
46
namespace llvm {
57
class StringRef;
68

llvm/include/llvm/Support/MD5.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class MD5 {
104104
MD5_u32plus block[16];
105105
} InternalState;
106106

107-
const uint8_t *body(ArrayRef<uint8_t> Data);
107+
LLVM_ABI const uint8_t *body(ArrayRef<uint8_t> Data);
108108
};
109109

110110
/// Helper to compute and return lower 64 bits of the given string's MD5 hash.

llvm/include/llvm/Support/Parallel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ LLVM_ABI extern ThreadPoolStrategy strategy;
4242
#ifdef _WIN32
4343
// Direct access to thread_local variables from a different DLL isn't
4444
// possible with Windows Native TLS.
45-
unsigned getThreadIndex();
45+
LLVM_ABI unsigned getThreadIndex();
4646
#else
4747
// Don't access this directly, use the getThreadIndex wrapper.
4848
LLVM_ABI extern thread_local unsigned threadIndex;

llvm/include/llvm/Support/Path.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class const_iterator
8080
Style S = Style::native; ///< The path style to use.
8181

8282
// An end iterator has Position = Path.size() + 1.
83-
friend const_iterator begin(StringRef path, Style style);
84-
friend const_iterator end(StringRef path);
83+
LLVM_ABI_FRIEND friend const_iterator begin(StringRef path, Style style);
84+
LLVM_ABI_FRIEND friend const_iterator end(StringRef path);
8585

8686
public:
8787
reference operator*() const { return Component; }
@@ -105,8 +105,8 @@ class reverse_iterator
105105
size_t Position = 0; ///< The iterators current position within Path.
106106
Style S = Style::native; ///< The path style to use.
107107

108-
friend reverse_iterator rbegin(StringRef path, Style style);
109-
friend reverse_iterator rend(StringRef path);
108+
LLVM_ABI_FRIEND friend reverse_iterator rbegin(StringRef path, Style style);
109+
LLVM_ABI_FRIEND friend reverse_iterator rend(StringRef path);
110110

111111
public:
112112
reference operator*() const { return Component; }

llvm/include/llvm/Support/PluginLoader.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
#ifndef LLVM_SUPPORT_PLUGINLOADER_H
1717
#define LLVM_SUPPORT_PLUGINLOADER_H
1818

19+
#include "llvm/Support/Compiler.h"
20+
1921
#ifndef DONT_GET_PLUGIN_LOADER_OPTION
2022
#include "llvm/Support/CommandLine.h"
21-
#include "llvm/Support/Compiler.h"
2223
#endif
2324

2425
#include <string>

llvm/include/llvm/Support/PrettyStackTrace.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ namespace llvm {
5151
/// constructed and destructed, they will add their symbolic frames to a
5252
/// virtual stack trace. This gets dumped out if the program crashes.
5353
class LLVM_ABI PrettyStackTraceEntry {
54-
friend PrettyStackTraceEntry *ReverseStackTrace(PrettyStackTraceEntry *);
54+
LLVM_ABI_FRIEND friend PrettyStackTraceEntry *
55+
ReverseStackTrace(PrettyStackTraceEntry *);
5556

5657
PrettyStackTraceEntry *NextEntry;
5758
PrettyStackTraceEntry(const PrettyStackTraceEntry &) = delete;

llvm/include/llvm/Support/Program.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ namespace sys {
240240
/// to build a single flat command line appropriate for calling CreateProcess
241241
/// on
242242
/// Windows.
243-
ErrorOr<std::wstring> flattenWindowsCommandLine(ArrayRef<StringRef> Args);
243+
LLVM_ABI ErrorOr<std::wstring>
244+
flattenWindowsCommandLine(ArrayRef<StringRef> Args);
244245
#endif
245246
}
246247
}

0 commit comments

Comments
 (0)