Method of Building Clang Silently Breaks My Plugin

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.

install-atlas (4.95 KB)