[cfe-dev] Method of Building Clang Silently Breaks My Plugin

Nick Holt via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 12 08:49:25 PST 2015


Hi everyone, 

I’ve been developing clang plugin over the past several months for use by my team. I’ve recently developed a bash script to include in the repository, which can be run to take care of building clang and compiling the plugin.

I actually have two versions of this build script. One of them, which was adopted from a project on GitHub, works fine. However, for various reasons, I ended up writing my own. I’m finding that with my own script, the plugin breaks. Everything still compiles fine and without error, but inside of the plugin’s HandleTranslationUnit method, Context.getTranslationUnitDecl() returns null. When using a clang compiled from the GitHub script, Context.getTranslationUnitDecl() does not return null, and works as expected.

Just to be clear, these two scripts build clang from the same source repository (stash), and compile it in very similar (the intention was identical although this is clearly not the case) manners. There must be something about how I’m building Clang through this script that is incorrect, but I can’t for the life of me figure it out.

It’s a lot to ask for everyone to read through these scripts and try to figure out what’s happening on behalf, however if someone has seen this before or is willing to talk off list about the details I would HUGELY appreciate it. 

I’ve attached the version of the install script that does not work. Unfortunately, I can’t attach the working one as its restricted to personal use due to ambiguity with the copyright. However, you can find the original GitHub repo at https://github.com/rsmmr/install-clang.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: install-atlas
Type: application/octet-stream
Size: 5069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151112/d5008ee7/attachment.obj>
-------------- next part --------------


Please let me know what kind of details and input I can provide as needed! I filed a Radar for this here, but was referred to this mailing group after confirming it’s my fault:

<rdar://problem/23431393> Context.getTranslationUnitDecl() Is Returning Null

Warm regards,
Nick




More information about the cfe-dev mailing list