Hi,
I am a newbie to clang. I am trying to make a few modifications to the already available checkers in the Static Analyzer . Now , to see the reflected changes should I execute 'make clang’ inside the build directory after every change or is there a easier way to do it?
Regards,
Ashwin
Hi,
I am a newbie to clang. I am trying to make a few modifications to the already available checkers in the Static Analyzer . Now , to see the reflected changes should I execute 'make clang’ inside the build directory after every change or is there a easier way to do it?
You do need to build clang in order to compile your changes for the static analyzer.
Using ninja builds could be faster. I do not know if we have detailed documentation on using cmake with ninja…
You’d also need to check your changes by running the regression tests as described in http://llvm.org/docs/TestingGuide.html. It is possible to only run tests in a single folder by running lit directly. All static analysis tests are in tests/Analysis.
Anna.
To expand on Anna’s comment, in many cases, using Ninja instead of make is as simple as ensuring that Ninja is installed, and adding ‘-G Ninja’ to your cmake line.
So,
cmake …/
becomes
cmake -G Ninja …/
And instead of running ‘make’ to build, you run ‘ninja’. I’ve heard that this can shave off > 10% of build times, so it may be worth your while to look into. 
George
Thanks for the inputs , will try them. Initially when I tried building I got "ld terminated with signal 9 error ", after which I increased the swap file sizeThen, it got successfully built once.
Next I tried building this plugin as given in https://kevinaboos.wordpress.com/2013/07/29/clang-tutorial-part-iii-plugin-example/ . Even building a plugin requires building clang executable again? In this case , I received this error, "error: ld terminated with signal 7 [Bus error], core dumped ". Why did this happen?
Basically I want to change the checker GenericTaintChecker.cpp into a plugin . Where can i find the required instructions?
Regards,
Ashwin
Thanks for the inputs , will try them. Initially when I tried building I
got "ld terminated with signal 9 error ", after which I increased the swap
file sizeThen, it got successfully built once.
Next I tried building this plugin as given in
Clang Tutorial Part III: Plugin Example | Bits, Bytes, Boos .
Even building a plugin requires building clang executable again? In this
case , I received this error, "error: ld terminated with signal 7 [Bus
error], core dumped ". Why did this happen?
You are using too much memory when invoking the linker in parallel.
On Linux, switching to the gold linker (which involves putting an
appropriate symlink in /usr/local/bin nowadays) will solve this.
Or configuring with -fuse-ld=gold
How do I use it with cmake? I was just following this link http://llvm.lyngvig.org/Articles/How-to-Enable-the-Gold-Linker-on-Arch-Linux
Is running ‘export LD = ld.gold’ before building clang enough?
I do it by passing -DCMAKE_CFLAGS=-fuse-ld=gold -DCMAKE_CXX_FLAGS=-fuse-ld=gold
DCMAKE_C_FLAGS, not DCMAKE_CFLAGS