[cfe-dev] Loading Static Analyzer plugin fails with CommandLine Errors

Gábor Kozár kozargabor at gmail.com
Tue Sep 3 08:50:10 PDT 2013


Thanks Laszlo, you make good points, I'll investigate.



--
Gábor Kozár
kozargabor at gmail.com





On Tue, Sep 3, 2013, at 16:52, Laszlo Nagy wrote:

Hi Gabor,



#1 you should not link any Clang

library against when you make your plugin



How do I not link against any Clang library when I'm writing a Clang
plugin?

I need to use Clang's classes extensively.



Sound weird, but works just fine. Your plugin will be loaded by the

Clang binary, and it already loaded the needed symbols. That's why you

don't need to explicitly link against them... You can look at

[1]https://github.com/rizsotto/Constantine for cmake example.



In the meanwhile, I realize that I have done it all with the assumption
that

GCC 4.7.2 and Clang 3.3 generate compatible binaries. Could this be the

source of the issue? I'll try self-hosting Clang 3.3 and see what
happens

then.



I do compile my plugin with GCC and Clang is able to load it without

problem.



My two cents are still on the llvm::cl classes. Although you are not

using them, but the libraries that you are link against might. (That's

why I was suggest not to do that.) And not to mention the fact, that

the messages are emitted by the CommandLine.cpp:144. See also:



  [2]http://comments.gmane.org/gmane.comp.compilers.clang.devel/6870

  [3]http://comments.gmane.org/gmane.comp.compilers.clang.scm/63478



Regards,

Laszlo

References

1. https://github.com/rizsotto/Constantine
2. http://comments.gmane.org/gmane.comp.compilers.clang.devel/6870
3. http://comments.gmane.org/gmane.comp.compilers.clang.scm/63478
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130903/1788de7b/attachment.html>


More information about the cfe-dev mailing list