RFC: [llvm] refactor common export macros to llvm/Config #149175
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Eliminate code duplication in
LLVM_ABI
and related export macros by defining a foundational set ofLLVM_INTERFACE_
macros in a new config headerllvm/Config/export-config.h
.Overview
export-config.h.cmake
config file which contains new definitions ofLLVM_INTERFACE_
macros. These macros are always defined to the appropriate export/visibility annotation.llvm-config.h.cmake
to the newexport-config.h.cmake
file.LLVM_ABI
macro definitions inllvm/Support/Compiler.h
to alias to the newLLVM_INTERFACE_
macros, conditional onLLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS
being defined.macro definition in
llvm-c/Visibility.hto alias to
LLVM_INTERFACE_ABI, conditional on
LLVM_ENABLE_LLVM_C_EXPORT_ANNOTATIONS` being defined.Background
The effort to build LLVM as a WIndows DLL is tracked in #109483. Additional context is provided in this discourse, and documentation for
LLVM_ABI
and related annotations is found in the LLVM repo here.Validation
clang-cl
and MSVCcl
.clang
andgcc
.