Skip to content
Open
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
6 changes: 6 additions & 0 deletions llvm/include/llvm/Passes/PassPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ class PassPlugin {
/// };
/// }
/// ```

#if defined(_WIN32) && defined(LLVM_BUILD_LLVM_DYLIB)
extern "C" ::llvm::PassPluginLibraryInfo __declspec(dllexport)
llvmGetPassPluginInfo();
#else
extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
llvmGetPassPluginInfo();
#endif
Copy link
Member

Choose a reason for hiding this comment

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

I think that we can share most of the declaration between the platforms, it is only the attribute that differs.

extern "C" ::llvm::PassPluginLibraryInfo
#if defined(_WIN32)
#if defined(LLVM_BUILD_LLVM_DYLIB)
__declspec(dllexport)
#endif
#else
LLVM_ATTRIBUTE_WEAK
#endif
llvmGetPassPluginInfo();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That looks a really painful way to declare it.


#endif /* LLVM_PASSES_PASSPLUGIN_H */