Skip to content

[llvm] revisions to LLVM_ABI export macro definitions #144598

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 4 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
7 changes: 7 additions & 0 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,13 @@ if (LLVM_LINK_LLVM_DYLIB AND BUILD_SHARED_LIBS)
message(FATAL_ERROR "Cannot enable BUILD_SHARED_LIBS with LLVM_LINK_LLVM_DYLIB. We recommend disabling BUILD_SHARED_LIBS.")
endif()

set(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS OFF)
if (LLVM_BUILD_LLVM_DYLIB OR LLVM_BUILD_SHARED_LIBS OR LLVM_ENABLE_PLUGINS)
# Export annotations for LLVM must be enabled if building as a shared lib or
# enabling plugins.
set(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS ON)
endif()

option(LLVM_OPTIMIZED_TABLEGEN "Force TableGen to be built with optimization" OFF)
if(CMAKE_CROSSCOMPILING OR (LLVM_OPTIMIZED_TABLEGEN AND (LLVM_ENABLE_ASSERTIONS OR CMAKE_CONFIGURATION_TYPES)))
set(LLVM_USE_HOST_TOOLS ON)
Expand Down
7 changes: 3 additions & 4 deletions llvm/docs/InterfaceExportAnnotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ method in a C++ class, it may be annotated for export.
Friend Functions
~~~~~~~~~~~~~~~~
Friend functions declared in a class, struct or union must be annotated with
``LLVM_ABI_FRIEND`` if the corresponding function declaration is annotated with
``LLVM_ABI`` if the corresponding function declaration is annotated with
``LLVM_ABI``. This requirement applies even when the class containing the friend
declaration is annotated with ``LLVM_ABI``.

Expand All @@ -236,14 +236,13 @@ declaration is annotated with ``LLVM_ABI``.
class ExampleClass {
// Friend declaration of a function must be annotated the same as the actual
// function declaration.
LLVM_ABI_FRIEND friend int friend_function(ExampleClass &obj);
LLVM_ABI friend int friend_function(ExampleClass &obj);
};

.. note::

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

Virtual Table and Type Info
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
21 changes: 10 additions & 11 deletions llvm/include/llvm/ADT/APFloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ class IEEEFloat final {
/// emphasizes producing different codes for different inputs in order to
/// be used in canonicalization and memoization. As such, equality is
/// bitwiseIsEqual, and 0 != -0.
LLVM_ABI_FRIEND friend hash_code hash_value(const IEEEFloat &Arg);
LLVM_ABI friend hash_code hash_value(const IEEEFloat &Arg);

/// Converts this value into a decimal string.
///
Expand Down Expand Up @@ -629,13 +629,12 @@ class IEEEFloat final {
/// 0 -> \c IEK_Zero
/// Inf -> \c IEK_Inf
///
LLVM_ABI_FRIEND friend int ilogb(const IEEEFloat &Arg);
LLVM_ABI friend int ilogb(const IEEEFloat &Arg);

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

LLVM_ABI_FRIEND friend IEEEFloat frexp(const IEEEFloat &X, int &Exp,
roundingMode);
LLVM_ABI friend IEEEFloat frexp(const IEEEFloat &X, int &Exp, roundingMode);

/// \name Special value setters.
/// @{
Expand Down Expand Up @@ -906,11 +905,11 @@ class DoubleAPFloat final {
LLVM_ABI LLVM_READONLY int getExactLog2() const;
LLVM_ABI LLVM_READONLY int getExactLog2Abs() const;

LLVM_ABI_FRIEND friend DoubleAPFloat scalbn(const DoubleAPFloat &X, int Exp,
roundingMode);
LLVM_ABI_FRIEND friend DoubleAPFloat frexp(const DoubleAPFloat &X, int &Exp,
roundingMode);
LLVM_ABI_FRIEND friend hash_code hash_value(const DoubleAPFloat &Arg);
LLVM_ABI friend DoubleAPFloat scalbn(const DoubleAPFloat &X, int Exp,
roundingMode);
LLVM_ABI friend DoubleAPFloat frexp(const DoubleAPFloat &X, int &Exp,
roundingMode);
LLVM_ABI friend hash_code hash_value(const DoubleAPFloat &Arg);
};

LLVM_ABI hash_code hash_value(const DoubleAPFloat &Arg);
Expand Down Expand Up @@ -1518,7 +1517,7 @@ class APFloat : public APFloatBase {
APFLOAT_DISPATCH_ON_SEMANTICS(getExactLog2());
}

LLVM_ABI_FRIEND friend hash_code hash_value(const APFloat &Arg);
LLVM_ABI friend hash_code hash_value(const APFloat &Arg);
friend int ilogb(const APFloat &Arg) { return ilogb(Arg.getIEEE()); }
friend APFloat scalbn(APFloat X, int Exp, roundingMode RM);
friend APFloat frexp(const APFloat &X, int &Exp, roundingMode RM);
Expand Down
17 changes: 8 additions & 9 deletions llvm/include/llvm/ADT/SlowDynamicAPInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,17 @@ class SlowDynamicAPInt {
LLVM_ABI SlowDynamicAPInt &operator++();
LLVM_ABI SlowDynamicAPInt &operator--();

LLVM_ABI_FRIEND friend SlowDynamicAPInt abs(const SlowDynamicAPInt &X);
LLVM_ABI_FRIEND friend SlowDynamicAPInt ceilDiv(const SlowDynamicAPInt &LHS,
const SlowDynamicAPInt &RHS);
LLVM_ABI_FRIEND friend SlowDynamicAPInt floorDiv(const SlowDynamicAPInt &LHS,
const SlowDynamicAPInt &RHS);
LLVM_ABI friend SlowDynamicAPInt abs(const SlowDynamicAPInt &X);
LLVM_ABI friend SlowDynamicAPInt ceilDiv(const SlowDynamicAPInt &LHS,
const SlowDynamicAPInt &RHS);
LLVM_ABI friend SlowDynamicAPInt floorDiv(const SlowDynamicAPInt &LHS,
const SlowDynamicAPInt &RHS);
/// The operands must be non-negative for gcd.
LLVM_ABI_FRIEND friend SlowDynamicAPInt gcd(const SlowDynamicAPInt &A,
const SlowDynamicAPInt &B);
LLVM_ABI friend SlowDynamicAPInt gcd(const SlowDynamicAPInt &A,
const SlowDynamicAPInt &B);

/// Overload to compute a hash_code for a SlowDynamicAPInt value.
LLVM_ABI_FRIEND friend hash_code
hash_value(const SlowDynamicAPInt &X); // NOLINT
LLVM_ABI friend hash_code hash_value(const SlowDynamicAPInt &X); // NOLINT

// Make DynamicAPInt a friend so it can access Val directly.
friend DynamicAPInt;
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Bitcode/BitcodeReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ struct ParserCallbacks {
IdentificationBit(IdentificationBit), ModuleBit(ModuleBit) {}

// Calls the ctor.
LLVM_ABI_FRIEND friend Expected<BitcodeFileContents>
LLVM_ABI friend Expected<BitcodeFileContents>
getBitcodeFileContents(MemoryBufferRef Buffer);

Expected<std::unique_ptr<Module>>
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/MachineOperand.h
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ class MachineOperand {
/// isIdenticalTo uses for comparison. It is thus suited for use in hash
/// tables which use that function for equality comparisons only. This must
/// stay exactly in sync with isIdenticalTo above.
LLVM_ABI_FRIEND friend hash_code hash_value(const MachineOperand &MO);
LLVM_ABI friend hash_code hash_value(const MachineOperand &MO);

/// ChangeToImmediate - Replace this operand with a new immediate operand of
/// the specified value. If an operand is known to be an immediate already,
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/CodeGen/PseudoSourceValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class LLVM_ABI PseudoSourceValue {
private:
unsigned Kind;
unsigned AddressSpace;
LLVM_ABI_FRIEND friend raw_ostream &
llvm::operator<<(raw_ostream &OS, const PseudoSourceValue *PSV);
LLVM_ABI friend raw_ostream &llvm::operator<<(raw_ostream &OS,
const PseudoSourceValue *PSV);

friend class MachineMemOperand; // For printCustom().
friend class MIRFormatter; // For printCustom().
Expand Down
3 changes: 3 additions & 0 deletions llvm/include/llvm/Config/llvm-config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
/* Define if building LLVM with BUILD_SHARED_LIBS */
#cmakedefine LLVM_BUILD_SHARED_LIBS

/* Define if exporting LLVM public interface for shared library */
#cmakedefine LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS

/* Define if building LLVM with LLVM_FORCE_USE_OLD_TOOLCHAIN_LIBS */
#cmakedefine LLVM_FORCE_USE_OLD_TOOLCHAIN ${LLVM_FORCE_USE_OLD_TOOLCHAIN}

Expand Down
3 changes: 1 addition & 2 deletions llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ class ExecutorProcessControl;
class LLVM_ABI LLJIT {
template <typename, typename, typename> friend class LLJITBuilderSetters;

LLVM_ABI_FRIEND friend Expected<JITDylibSP>
setUpGenericLLVMIRPlatform(LLJIT &J);
LLVM_ABI friend Expected<JITDylibSP> setUpGenericLLVMIRPlatform(LLJIT &J);

public:
/// Initializer support for LLJIT.
Expand Down
8 changes: 4 additions & 4 deletions llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class SymbolStringPool {
friend class SymbolStringPoolEntryUnsafe;

// Implemented in DebugUtils.h.
LLVM_ABI_FRIEND friend raw_ostream &operator<<(raw_ostream &OS,
const SymbolStringPool &SSP);
LLVM_ABI friend raw_ostream &operator<<(raw_ostream &OS,
const SymbolStringPool &SSP);

public:
/// Destroy a SymbolStringPool.
Expand Down Expand Up @@ -94,8 +94,8 @@ class SymbolStringPtrBase {
return LHS.S < RHS.S;
}

LLVM_ABI_FRIEND friend raw_ostream &
operator<<(raw_ostream &OS, const SymbolStringPtrBase &Sym);
LLVM_ABI friend raw_ostream &operator<<(raw_ostream &OS,
const SymbolStringPtrBase &Sym);

#ifndef NDEBUG
// Returns true if the pool entry's ref count is above zero (or if the entry
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/ExecutionEngine/RuntimeDyld.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class RuntimeDyld {
LLVM_ABI void finalizeWithMemoryManagerLocking();

private:
LLVM_ABI_FRIEND friend void jitLinkForORC(
LLVM_ABI friend void jitLinkForORC(
object::OwningBinary<object::ObjectFile> O,
RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver,
bool ProcessAllSections,
Expand Down
5 changes: 2 additions & 3 deletions llvm/include/llvm/IR/Function.h
Original file line number Diff line number Diff line change
Expand Up @@ -783,9 +783,8 @@ class LLVM_ABI Function : public GlobalObject, public ilist_node<Function> {

private:
// These need access to the underlying BB list.
LLVM_ABI_FRIEND friend void BasicBlock::removeFromParent();
LLVM_ABI_FRIEND friend iplist<BasicBlock>::iterator
BasicBlock::eraseFromParent();
LLVM_ABI friend void BasicBlock::removeFromParent();
LLVM_ABI friend iplist<BasicBlock>::iterator BasicBlock::eraseFromParent();
template <class BB_t, class BB_i_t, class BI_t, class II_t>
friend class InstIterator;
friend class llvm::SymbolTableListTraits<llvm::BasicBlock>;
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/ProfileData/SampleProfWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class LLVM_ABI SampleProfileWriterText : public SampleProfileWriter {
/// cannot be skipped.
bool MarkFlatProfiles = false;

LLVM_ABI_FRIEND friend ErrorOr<std::unique_ptr<SampleProfileWriter>>
LLVM_ABI friend ErrorOr<std::unique_ptr<SampleProfileWriter>>
SampleProfileWriter::create(std::unique_ptr<raw_ostream> &OS,
SampleProfileFormat Format);
};
Expand Down Expand Up @@ -225,7 +225,7 @@ class LLVM_ABI SampleProfileWriterBinary : public SampleProfileWriter {
void addNames(const FunctionSamples &S);

private:
LLVM_ABI_FRIEND friend ErrorOr<std::unique_ptr<SampleProfileWriter>>
LLVM_ABI friend ErrorOr<std::unique_ptr<SampleProfileWriter>>
SampleProfileWriter::create(std::unique_ptr<raw_ostream> &OS,
SampleProfileFormat Format);
};
Expand Down
41 changes: 12 additions & 29 deletions llvm/include/llvm/Support/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,6 @@
/// for both functions and classes. On windows its turned in to dllimport for
/// library consumers, for other platforms its a default visibility attribute.
///
/// LLVM_ABI_FRIEND is for annotating friend function declarations when the
/// target function's original declaration is annotated with LLVM_ABI. This
/// macro matches the LLVM_ABI macro on Windows, on other platforms it does
/// nothing.
///
/// LLVM_C_ABI is used to annotated functions and data that need to be exported
/// for the libllvm-c API. This used both for the llvm-c headers and for the
/// functions declared in the different Target's c++ source files that don't
Expand All @@ -184,19 +179,8 @@
// Marker to add to classes or functions in public headers that should not have
// export macros added to them by the clang tool
#define LLVM_ABI_NOT_EXPORTED
#if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS) || \
defined(LLVM_ENABLE_PLUGINS)
// Some libraries like those for tablegen are linked in to tools that used
// in the build so can't depend on the llvm shared library. If export macros
// were left enabled when building these we would get duplicate or
// missing symbol linker errors on windows.
#if defined(LLVM_BUILD_STATIC)
#define LLVM_ABI
#define LLVM_ABI_FRIEND
#define LLVM_TEMPLATE_ABI
#define LLVM_EXPORT_TEMPLATE
#define LLVM_ABI_EXPORT
#elif defined(_WIN32) && !defined(__MINGW32__)
#if defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS) && !defined(LLVM_BUILD_STATIC)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that at some point we will want to make LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS always true and remove that from the conditional check here? LLVM_BUILD_STATIC should be able to control the behaviour as needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that at some point we will want to make LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS always true and remove that from the conditional check here? LLVM_BUILD_STATIC should be able to control the behaviour as needed.

@compnerd I haven't figured out a way of gating these macros with a single preprocessor definition. Here is my thinking:

  1. We require a #define that gets emitted to llvm-config.h (via a #cmakedefine) so that it will be present when LLVM clients are built. This is so clients will pick-up the __declspec(dllimport) annotation when building on Windows. I added LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS for this purpose, and I expect to add two similar definitions for the llvm-c and Demangle libraries.
  2. We need a mechanism to override the definitions in llvm-config.h when building some tools/utils (e.g. tablegen) that prefer to statically link against LLVM. This was already working with LLVM_BUILD_STATIC.

Do you have a suggestion to achieve this with a single define?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The headers are associated with a build, that build can only be used one way (static or dynamic). We should record that into llvm-config.h via the #cmakedefine LLVM_BUILD_STATIC. Then when ready to enable the attributes by default:

#if defined(LLVM_BUILD_STATIC)
#define LLVM_ABI /**/
#else
#if defined(LLVM_EXPORTS)
#define LLVM_ABI __declspec(dllexport)
#else
#define LLVM_ABI __declspec(dllimport)
#endif
#endif

LLVM_EXPORTS would be defined by the build system (normally, CMake would define this for you if BUILD_SHARED_LIBS is set and you are building the LLVM library).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The headers are associated with a build, that build can only be used one way (static or dynamic).

I just don't see a way to eliminate support for llvm_add_library's DISABLE_LLVM_LINK_LLVM_DYLIB argument, which is what dynamically defines LLVM_BUILD_STATIC at build time in the few cases it is needed. See AddLLVM.cmake.

Here's why I believe we need to have a second variable as a dynamic override to the one in llvm-config.h:

  • TableGen depends on the LLVM Support library
  • TableGen is required to build the LLVM DLL, so it has to statically link the Support library
  • When statically linking the Support library, the associated headers must not have __declspec(dllimport) annotations on symbol declarations

Is there a better way to solve this? Generate a second llvm-config.h for this purpose maybe?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be building the library a second time if the configuration is different.

#if defined(_WIN32) && !defined(__MINGW32__)
#if defined(LLVM_EXPORTS)
#define LLVM_ABI __declspec(dllexport)
#define LLVM_TEMPLATE_ABI
Expand All @@ -206,25 +190,24 @@
#define LLVM_TEMPLATE_ABI __declspec(dllimport)
#define LLVM_EXPORT_TEMPLATE
#endif
#define LLVM_ABI_FRIEND LLVM_ABI
#define LLVM_ABI_EXPORT __declspec(dllexport)
#elif defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) || \
#elif __has_attribute(visibility)
#if defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) || \
defined(__MVS__) || defined(__CYGWIN__)
#define LLVM_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
#define LLVM_ABI_FRIEND
#define LLVM_TEMPLATE_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
#define LLVM_ABI __attribute__((visibility("default")))
#define LLVM_TEMPLATE_ABI LLVM_ABI
#define LLVM_EXPORT_TEMPLATE
#define LLVM_ABI_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
#define LLVM_ABI_EXPORTL LLVM_ABI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Suggested change
#define LLVM_ABI_EXPORTL LLVM_ABI
#define LLVM_ABI_EXPORT LLVM_ABI

#elif defined(__MACH__) || defined(__WASM__) || defined(__EMSCRIPTEN__)
#define LLVM_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
#define LLVM_ABI_FRIEND
#define LLVM_ABI __attribute__((visibility("default")))
#define LLVM_TEMPLATE_ABI
#define LLVM_EXPORT_TEMPLATE
#define LLVM_ABI_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
#define LLVM_ABI_EXPORT LLVM_ABI
#endif
#else
#endif
#endif
#if !defined(LLVM_ABI)
#define LLVM_ABI
#define LLVM_ABI_FRIEND
#define LLVM_TEMPLATE_ABI
#define LLVM_EXPORT_TEMPLATE
#define LLVM_ABI_EXPORT
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Support/Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ class ExpectedAsOutParameter {
/// (or Expected) and you want to call code that still returns
/// std::error_codes.
class LLVM_ABI ECError : public ErrorInfo<ECError> {
LLVM_ABI_FRIEND friend Error errorCodeToError(std::error_code);
LLVM_ABI friend Error errorCodeToError(std::error_code);

void anchor() override;

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Support/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class basic_file_status {

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

#if defined(LLVM_ON_UNIX)
dev_t fs_st_dev = 0;
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/Support/JSON.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ class Value {
llvm::StringRef, std::string, json::Array,
json::Object>
Union;
LLVM_ABI_FRIEND friend bool operator==(const Value &, const Value &);
LLVM_ABI friend bool operator==(const Value &, const Value &);
};

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

LLVM_ABI_FRIEND friend void Path::report(llvm::StringLiteral Message);
LLVM_ABI friend void Path::report(llvm::StringLiteral Message);

public:
Root(llvm::StringRef Name = "") : Name(Name), ErrorMessage("") {}
Expand Down
8 changes: 4 additions & 4 deletions llvm/include/llvm/Support/Path.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class const_iterator
Style S = Style::native; ///< The path style to use.

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

public:
reference operator*() const { return Component; }
Expand All @@ -105,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.

LLVM_ABI_FRIEND friend reverse_iterator rbegin(StringRef path, Style style);
LLVM_ABI_FRIEND friend reverse_iterator rend(StringRef path);
LLVM_ABI friend reverse_iterator rbegin(StringRef path, Style style);
LLVM_ABI friend reverse_iterator rend(StringRef path);

public:
reference operator*() const { return Component; }
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Support/PrettyStackTrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ 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 {
LLVM_ABI_FRIEND friend PrettyStackTraceEntry *
LLVM_ABI friend PrettyStackTraceEntry *
ReverseStackTrace(PrettyStackTraceEntry *);

PrettyStackTraceEntry *NextEntry;
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/XRay/InstrumentationMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class InstrumentationMap {
FunctionAddressMap FunctionAddresses;
FunctionAddressReverseMap FunctionIds;

LLVM_ABI_FRIEND friend Expected<InstrumentationMap>
LLVM_ABI friend Expected<InstrumentationMap>
loadInstrumentationMap(StringRef);

public:
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/XRay/Trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Trace {

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

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

public:
using size_type = RecordVector::size_type;
Expand Down
Loading