Skip to content

Meta issue to track changes for adding plugin and LLVM_BUILD_LLVM_DYLIB support for Windows #109483

Open
@fsfod

Description

@fsfod

This is meta issue to track adding support for building LLVM and Clang as a shared library on windows and to also allow the use on plugins for Support clang plugins on Windows GSOC project. This will mostly be achieved by adding explicit visibility macros to public API surface that will dllexport'ed. These changes will also benefit non windows platforms by reducing the numbers of exported symbols when the default symbol visibility is set to hidden at a latter time.
Some rational for these changes is explained in this old LLVM discourse post Supporting LLVM_BUILD_LLVM_DYLIB on Windows.

With the current code merged in it is possible build a LLVM DLL using clang-cl, but not all the required symbols exported yet so tools aren't buildable. A branch with most of the changes from the open PR's merged in can be found here along with full visibility macros to create a working windows build with working plugins for LLVM and Clang. The CMake options to use are -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_BUILD_LLVM_DYLIB_VIS=ON -DLLVM_LINK_LLVM_DYLIB=ON -DCLANG_LINK_CLANG_DYLIB=ON

LLVM

Clang

Clang Tooling Fixes and improvements

  • Update Clang to store source location for explicit function template instantiation definitions and declarations so tool can annotate them and not guess
  • Make FrontendAction::BeginSourceFile virtual so proxy Actions work correctly
  • Fix non usable API in FixItRewriter to access computed changes without writing a file

Metadata

Metadata

Assignees

No one assigned

    Labels

    cmakeBuild system in general and CMake in particularmetabugIssue to collect references to a group of similar or related issues.platform:windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions