Skip to content

Commit e175ecf

Browse files
[llvm] revisions to LLVM_ABI export macro definitions (#144598)
## Purpose Simplify the logic used to define `LLVM_ABI` and related macros, eliminate the `LLVM_ABI_FRIEND` macro, and update the `LLVM_ABI` macro to always resolve to `__attribute__((visibility("default")))` when building LLVM as a shared library for ELF or Mach-O targets. ## Background Previously, `LLVM_ABI` was defined to the C++ style attribute `[[gnu::visibility("default")]]` when compiling with gcc, which has more restrictions on its placement. Of note, the C++ style attributes cannot decorate `friend` functions and must not appear after `extern` on variable declarations. Documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst). ## Overview - Define a new CMake config value, `LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS`, which is implicitly set whenever `LLVM_BUILD_LLVM_DYLIB`, `LLVM_BUILD_SHARED_LIBS`, or `LLVM_ENABLE_PLUGINS` is set. Add it as a `#cmakedefine` to llvm-config.h so its definition is available to projects building against LLVM as required so clients see `__declspec(dllimport)` on Windows. - Gate the `LLVM_ABI` macro definitions in Compiler.h behind the new `LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS` definition. This is simpler/cleaner, but should be equivalent to the previous logic. - Maintain `LLVM_BUILD_STATIC` as an override to be used by specific targets that don't want to build against the DLL/shared library, such as tablegen. - For ELF and Mach-O targets, directly define `LLVM_ABI` as `__attribute__((visibility("default")))` instead of `LLVM_ATTRIBUTE_VISIBILITY_DEFAULT`, which resolves to C++ style `[[gnu::visibility("default")]]` when compiling with gcc. - Remove the `LLVM_ABI_FRIEND` macro and replace all usages of it with `LLVM_ABI`. - Update the documentation for exporting friend functions to no longer reference `LLVM_ABI_FRIEND`. ## Validation - Built as static lib with clang and gcc on Linux. - Built as static with clang-cl and MSVC on Windows. - Built as shared lib with clang and gcc on Linux (+ additional local changes not yet merged). - Built as DLL with clang-cl and MSVC on Windows (+ additional local changes not yet merged). --------- Co-authored-by: SquallATF <[email protected]>
1 parent 6a8899c commit e175ecf

21 files changed

+70
-80
lines changed

llvm/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,13 @@ if (LLVM_LINK_LLVM_DYLIB AND BUILD_SHARED_LIBS)
942942
message(FATAL_ERROR "Cannot enable BUILD_SHARED_LIBS with LLVM_LINK_LLVM_DYLIB. We recommend disabling BUILD_SHARED_LIBS.")
943943
endif()
944944

945+
set(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS OFF)
946+
if (LLVM_BUILD_LLVM_DYLIB OR LLVM_BUILD_SHARED_LIBS OR LLVM_ENABLE_PLUGINS)
947+
# Export annotations for LLVM must be enabled if building as a shared lib or
948+
# enabling plugins.
949+
set(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS ON)
950+
endif()
951+
945952
option(LLVM_OPTIMIZED_TABLEGEN "Force TableGen to be built with optimization" OFF)
946953
if(CMAKE_CROSSCOMPILING OR (LLVM_OPTIMIZED_TABLEGEN AND (LLVM_ENABLE_ASSERTIONS OR CMAKE_CONFIGURATION_TYPES)))
947954
set(LLVM_USE_HOST_TOOLS ON)

llvm/docs/InterfaceExportAnnotations.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ method in a C++ class, it may be annotated for export.
222222
Friend Functions
223223
~~~~~~~~~~~~~~~~
224224
Friend functions declared in a class, struct or union must be annotated with
225-
``LLVM_ABI_FRIEND`` if the corresponding function declaration is annotated with
225+
``LLVM_ABI`` if the corresponding function declaration is annotated with
226226
``LLVM_ABI``. This requirement applies even when the class containing the friend
227227
declaration is annotated with ``LLVM_ABI``.
228228

@@ -236,14 +236,13 @@ declaration is annotated with ``LLVM_ABI``.
236236
class ExampleClass {
237237
// Friend declaration of a function must be annotated the same as the actual
238238
// function declaration.
239-
LLVM_ABI_FRIEND friend int friend_function(ExampleClass &obj);
239+
LLVM_ABI friend int friend_function(ExampleClass &obj);
240240
};
241241
242242
.. note::
243243

244244
Annotating the friend declaration avoids an “inconsistent dll linkage”
245-
compiler error when building a DLL for Windows. The ``LLVM_ABI_FRIEND``
246-
annotation is a no-op when building ELF or Mach-O shared libraries.
245+
compiler error when building a DLL for Windows.
247246

248247
Virtual Table and Type Info
249248
~~~~~~~~~~~~~~~~~~~~~~~~~~~

llvm/include/llvm/ADT/APFloat.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ class IEEEFloat final {
572572
/// emphasizes producing different codes for different inputs in order to
573573
/// be used in canonicalization and memoization. As such, equality is
574574
/// bitwiseIsEqual, and 0 != -0.
575-
LLVM_ABI_FRIEND friend hash_code hash_value(const IEEEFloat &Arg);
575+
LLVM_ABI friend hash_code hash_value(const IEEEFloat &Arg);
576576

577577
/// Converts this value into a decimal string.
578578
///
@@ -629,13 +629,12 @@ class IEEEFloat final {
629629
/// 0 -> \c IEK_Zero
630630
/// Inf -> \c IEK_Inf
631631
///
632-
LLVM_ABI_FRIEND friend int ilogb(const IEEEFloat &Arg);
632+
LLVM_ABI friend int ilogb(const IEEEFloat &Arg);
633633

634634
/// Returns: X * 2^Exp for integral exponents.
635-
LLVM_ABI_FRIEND friend IEEEFloat scalbn(IEEEFloat X, int Exp, roundingMode);
635+
LLVM_ABI friend IEEEFloat scalbn(IEEEFloat X, int Exp, roundingMode);
636636

637-
LLVM_ABI_FRIEND friend IEEEFloat frexp(const IEEEFloat &X, int &Exp,
638-
roundingMode);
637+
LLVM_ABI friend IEEEFloat frexp(const IEEEFloat &X, int &Exp, roundingMode);
639638

640639
/// \name Special value setters.
641640
/// @{
@@ -906,11 +905,11 @@ class DoubleAPFloat final {
906905
LLVM_ABI LLVM_READONLY int getExactLog2() const;
907906
LLVM_ABI LLVM_READONLY int getExactLog2Abs() const;
908907

909-
LLVM_ABI_FRIEND friend DoubleAPFloat scalbn(const DoubleAPFloat &X, int Exp,
910-
roundingMode);
911-
LLVM_ABI_FRIEND friend DoubleAPFloat frexp(const DoubleAPFloat &X, int &Exp,
912-
roundingMode);
913-
LLVM_ABI_FRIEND friend hash_code hash_value(const DoubleAPFloat &Arg);
908+
LLVM_ABI friend DoubleAPFloat scalbn(const DoubleAPFloat &X, int Exp,
909+
roundingMode);
910+
LLVM_ABI friend DoubleAPFloat frexp(const DoubleAPFloat &X, int &Exp,
911+
roundingMode);
912+
LLVM_ABI friend hash_code hash_value(const DoubleAPFloat &Arg);
914913
};
915914

916915
LLVM_ABI hash_code hash_value(const DoubleAPFloat &Arg);
@@ -1518,7 +1517,7 @@ class APFloat : public APFloatBase {
15181517
APFLOAT_DISPATCH_ON_SEMANTICS(getExactLog2());
15191518
}
15201519

1521-
LLVM_ABI_FRIEND friend hash_code hash_value(const APFloat &Arg);
1520+
LLVM_ABI friend hash_code hash_value(const APFloat &Arg);
15221521
friend int ilogb(const APFloat &Arg) { return ilogb(Arg.getIEEE()); }
15231522
friend APFloat scalbn(APFloat X, int Exp, roundingMode RM);
15241523
friend APFloat frexp(const APFloat &X, int &Exp, roundingMode RM);

llvm/include/llvm/ADT/SlowDynamicAPInt.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,17 @@ class SlowDynamicAPInt {
6262
LLVM_ABI SlowDynamicAPInt &operator++();
6363
LLVM_ABI SlowDynamicAPInt &operator--();
6464

65-
LLVM_ABI_FRIEND friend SlowDynamicAPInt abs(const SlowDynamicAPInt &X);
66-
LLVM_ABI_FRIEND friend SlowDynamicAPInt ceilDiv(const SlowDynamicAPInt &LHS,
67-
const SlowDynamicAPInt &RHS);
68-
LLVM_ABI_FRIEND friend SlowDynamicAPInt floorDiv(const SlowDynamicAPInt &LHS,
69-
const SlowDynamicAPInt &RHS);
65+
LLVM_ABI friend SlowDynamicAPInt abs(const SlowDynamicAPInt &X);
66+
LLVM_ABI friend SlowDynamicAPInt ceilDiv(const SlowDynamicAPInt &LHS,
67+
const SlowDynamicAPInt &RHS);
68+
LLVM_ABI friend SlowDynamicAPInt floorDiv(const SlowDynamicAPInt &LHS,
69+
const SlowDynamicAPInt &RHS);
7070
/// The operands must be non-negative for gcd.
71-
LLVM_ABI_FRIEND friend SlowDynamicAPInt gcd(const SlowDynamicAPInt &A,
72-
const SlowDynamicAPInt &B);
71+
LLVM_ABI friend SlowDynamicAPInt gcd(const SlowDynamicAPInt &A,
72+
const SlowDynamicAPInt &B);
7373

7474
/// Overload to compute a hash_code for a SlowDynamicAPInt value.
75-
LLVM_ABI_FRIEND friend hash_code
76-
hash_value(const SlowDynamicAPInt &X); // NOLINT
75+
LLVM_ABI friend hash_code hash_value(const SlowDynamicAPInt &X); // NOLINT
7776

7877
// Make DynamicAPInt a friend so it can access Val directly.
7978
friend DynamicAPInt;

llvm/include/llvm/Bitcode/BitcodeReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct ParserCallbacks {
120120
IdentificationBit(IdentificationBit), ModuleBit(ModuleBit) {}
121121

122122
// Calls the ctor.
123-
LLVM_ABI_FRIEND friend Expected<BitcodeFileContents>
123+
LLVM_ABI friend Expected<BitcodeFileContents>
124124
getBitcodeFileContents(MemoryBufferRef Buffer);
125125

126126
Expected<std::unique_ptr<Module>>

llvm/include/llvm/CodeGen/MachineOperand.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ class MachineOperand {
764764
/// isIdenticalTo uses for comparison. It is thus suited for use in hash
765765
/// tables which use that function for equality comparisons only. This must
766766
/// stay exactly in sync with isIdenticalTo above.
767-
LLVM_ABI_FRIEND friend hash_code hash_value(const MachineOperand &MO);
767+
LLVM_ABI friend hash_code hash_value(const MachineOperand &MO);
768768

769769
/// ChangeToImmediate - Replace this operand with a new immediate operand of
770770
/// the specified value. If an operand is known to be an immediate already,

llvm/include/llvm/CodeGen/PseudoSourceValue.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class LLVM_ABI PseudoSourceValue {
4646
private:
4747
unsigned Kind;
4848
unsigned AddressSpace;
49-
LLVM_ABI_FRIEND friend raw_ostream &
50-
llvm::operator<<(raw_ostream &OS, const PseudoSourceValue *PSV);
49+
LLVM_ABI friend raw_ostream &llvm::operator<<(raw_ostream &OS,
50+
const PseudoSourceValue *PSV);
5151

5252
friend class MachineMemOperand; // For printCustom().
5353
friend class MIRFormatter; // For printCustom().

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@
110110
/* Define if building LLVM with BUILD_SHARED_LIBS */
111111
#cmakedefine LLVM_BUILD_SHARED_LIBS
112112

113+
/* Define if exporting LLVM public interface for shared library */
114+
#cmakedefine LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS
115+
113116
/* Define if building LLVM with LLVM_FORCE_USE_OLD_TOOLCHAIN_LIBS */
114117
#cmakedefine LLVM_FORCE_USE_OLD_TOOLCHAIN ${LLVM_FORCE_USE_OLD_TOOLCHAIN}
115118

llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ class ExecutorProcessControl;
4242
class LLVM_ABI LLJIT {
4343
template <typename, typename, typename> friend class LLJITBuilderSetters;
4444

45-
LLVM_ABI_FRIEND friend Expected<JITDylibSP>
46-
setUpGenericLLVMIRPlatform(LLJIT &J);
45+
LLVM_ABI friend Expected<JITDylibSP> setUpGenericLLVMIRPlatform(LLJIT &J);
4746

4847
public:
4948
/// Initializer support for LLJIT.

llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class SymbolStringPool {
3636
friend class SymbolStringPoolEntryUnsafe;
3737

3838
// Implemented in DebugUtils.h.
39-
LLVM_ABI_FRIEND friend raw_ostream &operator<<(raw_ostream &OS,
40-
const SymbolStringPool &SSP);
39+
LLVM_ABI friend raw_ostream &operator<<(raw_ostream &OS,
40+
const SymbolStringPool &SSP);
4141

4242
public:
4343
/// Destroy a SymbolStringPool.
@@ -94,8 +94,8 @@ class SymbolStringPtrBase {
9494
return LHS.S < RHS.S;
9595
}
9696

97-
LLVM_ABI_FRIEND friend raw_ostream &
98-
operator<<(raw_ostream &OS, const SymbolStringPtrBase &Sym);
97+
LLVM_ABI friend raw_ostream &operator<<(raw_ostream &OS,
98+
const SymbolStringPtrBase &Sym);
9999

100100
#ifndef NDEBUG
101101
// Returns true if the pool entry's ref count is above zero (or if the entry

llvm/include/llvm/ExecutionEngine/RuntimeDyld.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ class RuntimeDyld {
287287
LLVM_ABI void finalizeWithMemoryManagerLocking();
288288

289289
private:
290-
LLVM_ABI_FRIEND friend void jitLinkForORC(
290+
LLVM_ABI friend void jitLinkForORC(
291291
object::OwningBinary<object::ObjectFile> O,
292292
RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver,
293293
bool ProcessAllSections,

llvm/include/llvm/IR/Function.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,8 @@ class LLVM_ABI Function : public GlobalObject, public ilist_node<Function> {
783783

784784
private:
785785
// These need access to the underlying BB list.
786-
LLVM_ABI_FRIEND friend void BasicBlock::removeFromParent();
787-
LLVM_ABI_FRIEND friend iplist<BasicBlock>::iterator
788-
BasicBlock::eraseFromParent();
786+
LLVM_ABI friend void BasicBlock::removeFromParent();
787+
LLVM_ABI friend iplist<BasicBlock>::iterator BasicBlock::eraseFromParent();
789788
template <class BB_t, class BB_i_t, class BI_t, class II_t>
790789
friend class InstIterator;
791790
friend class llvm::SymbolTableListTraits<llvm::BasicBlock>;

llvm/include/llvm/ProfileData/SampleProfWriter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class LLVM_ABI SampleProfileWriterText : public SampleProfileWriter {
193193
/// cannot be skipped.
194194
bool MarkFlatProfiles = false;
195195

196-
LLVM_ABI_FRIEND friend ErrorOr<std::unique_ptr<SampleProfileWriter>>
196+
LLVM_ABI friend ErrorOr<std::unique_ptr<SampleProfileWriter>>
197197
SampleProfileWriter::create(std::unique_ptr<raw_ostream> &OS,
198198
SampleProfileFormat Format);
199199
};
@@ -225,7 +225,7 @@ class LLVM_ABI SampleProfileWriterBinary : public SampleProfileWriter {
225225
void addNames(const FunctionSamples &S);
226226

227227
private:
228-
LLVM_ABI_FRIEND friend ErrorOr<std::unique_ptr<SampleProfileWriter>>
228+
LLVM_ABI friend ErrorOr<std::unique_ptr<SampleProfileWriter>>
229229
SampleProfileWriter::create(std::unique_ptr<raw_ostream> &OS,
230230
SampleProfileFormat Format);
231231
};

llvm/include/llvm/Support/Compiler.h

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,6 @@
171171
/// for both functions and classes. On windows its turned in to dllimport for
172172
/// library consumers, for other platforms its a default visibility attribute.
173173
///
174-
/// LLVM_ABI_FRIEND is for annotating friend function declarations when the
175-
/// target function's original declaration is annotated with LLVM_ABI. This
176-
/// macro matches the LLVM_ABI macro on Windows, on other platforms it does
177-
/// nothing.
178-
///
179174
/// LLVM_C_ABI is used to annotated functions and data that need to be exported
180175
/// for the libllvm-c API. This used both for the llvm-c headers and for the
181176
/// functions declared in the different Target's c++ source files that don't
@@ -184,19 +179,10 @@
184179
// Marker to add to classes or functions in public headers that should not have
185180
// export macros added to them by the clang tool
186181
#define LLVM_ABI_NOT_EXPORTED
187-
#if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS) || \
188-
defined(LLVM_ENABLE_PLUGINS)
189-
// Some libraries like those for tablegen are linked in to tools that used
190-
// in the build so can't depend on the llvm shared library. If export macros
191-
// were left enabled when building these we would get duplicate or
192-
// missing symbol linker errors on windows.
193-
#if defined(LLVM_BUILD_STATIC)
194-
#define LLVM_ABI
195-
#define LLVM_ABI_FRIEND
196-
#define LLVM_TEMPLATE_ABI
197-
#define LLVM_EXPORT_TEMPLATE
198-
#define LLVM_ABI_EXPORT
199-
#elif defined(_WIN32) && !defined(__MINGW32__)
182+
// TODO(https://github.com/llvm/llvm-project/issues/145406): eliminate need for
183+
// two preprocessor definitions to gate LLVM_ABI macro definitions.
184+
#if defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS) && !defined(LLVM_BUILD_STATIC)
185+
#if defined(_WIN32) && !defined(__MINGW32__)
200186
#if defined(LLVM_EXPORTS)
201187
#define LLVM_ABI __declspec(dllexport)
202188
#define LLVM_TEMPLATE_ABI
@@ -206,25 +192,24 @@
206192
#define LLVM_TEMPLATE_ABI __declspec(dllimport)
207193
#define LLVM_EXPORT_TEMPLATE
208194
#endif
209-
#define LLVM_ABI_FRIEND LLVM_ABI
210195
#define LLVM_ABI_EXPORT __declspec(dllexport)
211-
#elif defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) || \
196+
#elif __has_attribute(visibility)
197+
#if defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) || \
212198
defined(__MVS__) || defined(__CYGWIN__)
213-
#define LLVM_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
214-
#define LLVM_ABI_FRIEND
215-
#define LLVM_TEMPLATE_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
199+
#define LLVM_ABI __attribute__((visibility("default")))
200+
#define LLVM_TEMPLATE_ABI LLVM_ABI
216201
#define LLVM_EXPORT_TEMPLATE
217-
#define LLVM_ABI_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
202+
#define LLVM_ABI_EXPORT LLVM_ABI
218203
#elif defined(__MACH__) || defined(__WASM__) || defined(__EMSCRIPTEN__)
219-
#define LLVM_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
220-
#define LLVM_ABI_FRIEND
204+
#define LLVM_ABI __attribute__((visibility("default")))
221205
#define LLVM_TEMPLATE_ABI
222206
#define LLVM_EXPORT_TEMPLATE
223-
#define LLVM_ABI_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
207+
#define LLVM_ABI_EXPORT LLVM_ABI
224208
#endif
225-
#else
209+
#endif
210+
#endif
211+
#if !defined(LLVM_ABI)
226212
#define LLVM_ABI
227-
#define LLVM_ABI_FRIEND
228213
#define LLVM_TEMPLATE_ABI
229214
#define LLVM_EXPORT_TEMPLATE
230215
#define LLVM_ABI_EXPORT

llvm/include/llvm/Support/Error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ class ExpectedAsOutParameter {
11911191
/// (or Expected) and you want to call code that still returns
11921192
/// std::error_codes.
11931193
class LLVM_ABI ECError : public ErrorInfo<ECError> {
1194-
LLVM_ABI_FRIEND friend Error errorCodeToError(std::error_code);
1194+
LLVM_ABI friend Error errorCodeToError(std::error_code);
11951195

11961196
void anchor() override;
11971197

llvm/include/llvm/Support/FileSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ 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-
LLVM_ABI_FRIEND friend bool equivalent(file_status A, file_status B);
223+
LLVM_ABI friend bool equivalent(file_status A, file_status B);
224224

225225
#if defined(LLVM_ON_UNIX)
226226
dev_t fs_st_dev = 0;

llvm/include/llvm/Support/JSON.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ class Value {
531531
llvm::StringRef, std::string, json::Array,
532532
json::Object>
533533
Union;
534-
LLVM_ABI_FRIEND friend bool operator==(const Value &, const Value &);
534+
LLVM_ABI 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-
LLVM_ABI_FRIEND friend void Path::report(llvm::StringLiteral Message);
716+
LLVM_ABI friend void Path::report(llvm::StringLiteral Message);
717717

718718
public:
719719
Root(llvm::StringRef Name = "") : Name(Name), ErrorMessage("") {}

llvm/include/llvm/Support/Path.h

Lines changed: 4 additions & 4 deletions
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-
LLVM_ABI_FRIEND friend const_iterator begin(StringRef path, Style style);
84-
LLVM_ABI_FRIEND friend const_iterator end(StringRef path);
83+
LLVM_ABI friend const_iterator begin(StringRef path, Style style);
84+
LLVM_ABI 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-
LLVM_ABI_FRIEND friend reverse_iterator rbegin(StringRef path, Style style);
109-
LLVM_ABI_FRIEND friend reverse_iterator rend(StringRef path);
108+
LLVM_ABI friend reverse_iterator rbegin(StringRef path, Style style);
109+
LLVM_ABI friend reverse_iterator rend(StringRef path);
110110

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

llvm/include/llvm/Support/PrettyStackTrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ 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-
LLVM_ABI_FRIEND friend PrettyStackTraceEntry *
54+
LLVM_ABI friend PrettyStackTraceEntry *
5555
ReverseStackTrace(PrettyStackTraceEntry *);
5656

5757
PrettyStackTraceEntry *NextEntry;

llvm/include/llvm/XRay/InstrumentationMap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class InstrumentationMap {
8585
FunctionAddressMap FunctionAddresses;
8686
FunctionAddressReverseMap FunctionIds;
8787

88-
LLVM_ABI_FRIEND friend Expected<InstrumentationMap>
88+
LLVM_ABI friend Expected<InstrumentationMap>
8989
loadInstrumentationMap(StringRef);
9090

9191
public:

llvm/include/llvm/XRay/Trace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Trace {
5151

5252
typedef std::vector<XRayRecord>::const_iterator citerator;
5353

54-
LLVM_ABI_FRIEND friend Expected<Trace> loadTrace(const DataExtractor &, bool);
54+
LLVM_ABI friend Expected<Trace> loadTrace(const DataExtractor &, bool);
5555

5656
public:
5757
using size_type = RecordVector::size_type;

0 commit comments

Comments
 (0)