Page MenuHomePhabricator

clang-cl: Support loading plugins on Windows
AcceptedPublic

Authored by ehsan on Jan 31 2016, 3:58 PM.

Details

Reviewers
rnk
Summary

This builds on the support being added to LLVM to import and export
registries from DLLs. This will allow us to pick up the registry
entries added in the DLL's copy of FrontendPluginRegistry.

This will allow us to use plugins on Windows using:
$ clang-cl -Xclang -load -Xclang plugin.dll \

-Xclang -add-plugin -Xclang foo

clang-cl: Enable plugins on Windows

Diff Detail

Event Timeline

ehsan updated this revision to Diff 46499.Jan 31 2016, 3:58 PM
ehsan retitled this revision from to clang-cl: Support loading plugins on Windows.
ehsan updated this object.
ehsan added a reviewer: rnk.
ehsan added a subscriber: cfe-commits.
ehsan updated this revision to Diff 47056.Feb 5 2016, 2:54 PM

Updating based on the LLVM side changes.

ehsan updated this revision to Diff 47057.Feb 5 2016, 2:55 PM

Sorry for the noise, arconist fail...

rnk accepted this revision.Feb 8 2016, 3:17 PM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Feb 8 2016, 3:17 PM

Was committed in r260265, but reverted in r260536.

@chapuni, you have reverted this patch and the commit message says "investigating". Did you come to a conclusion? Can we reland it?

@v.g.vassilev, I couldn't explain what it caused. Fell free to recommit.

LLVM_EXPORT_REGISTRY no longer exists, so this can't be relanded.

Indeed. IIUC, here is no way clang-cl to load plugins if compiled BUILD_SHARED_LIB=0. It is not clear to me if that's a design limitation or something else. I'd love to be able to load plugins on a 'standard' clang-cl instance.

Clang's plugin model is currently fundamentally incompatible with how imports and exports work on Windows, which I'm guessing is probably why LLVM_EXPORT_REGISTRY was removed as well. There's no easy way to get plugins to work on Windows.