[cfe-dev] Loading plugins into libclang

Benjamin Kramer via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 1 05:16:52 PST 2016


Hi everyone,

in my quest to get clang-tidy integrated into your favorite editor
(via ycm) I'm hitting one major roadblock. I'm piggybacking on the
existing plugin mechanism which gives me both a way to add extra
Actions to the parse process and hand flags to the plugin for
configuration. This works well for (most of) clang-tidy as it really
just emits diagnostics and FixIts.

However, loading a plugin into libclang isn't easily possible because
there it doesn't export all the clang symbols. Putting all the clang
symbols into the plugin doesn't work either because you'll get
duplicate command line flag registration and everything. My current
hack is to statically link clang-tidy into libclang. This works but
creates an ugly (optional) dependency from libclang into
clang-tools-extra.

Is there any other way to extend libclang without actually modifying
libclang itself?

- Ben



More information about the cfe-dev mailing list