Hi, I’m now interested in Clang Static Analyzer. The related document says the analyzer is 100% open source and is part of the Clang project. But is there anybody that can tell where to get the source code of it? Any ideas?
It *is* a part of Clang, so you simply get the Clang source code.
Files of interest are mostly located under lib/Checker.
hi, sanghyeon. Thanks for your immediate reply. But what I’m expecting is a bundle of stand-alone codes allowing to analyze and build the analyzer. Can it be possible?
The Analyzer is clang.
To use it you do
clang --analyze …
So your stand-alone code is llvm + clang
check out llvm
checkout clang in llvm/tool/clang
go to the llvm dir
configure && make
and you’re done.
is that the case? If it was true, it would be so frustrating. Maybe I’ll have to make another further research. Thank you all the same.
As Jean-Daniel said, the analyzer itself is contained within a library. The ‘clang’ executable simply links in that library and has some boilerplate logic to drive it. You are perfectly free to use the analyzer logic in a different context.
Is it possible to build a clang analyzer executable without requiring
building and linking LLVM?
Or does the analyzer actually depend on CodeGen?
It doesn't depend on CodeGen, but LLVM contains other supporting libraries that are used by the non-codegen aspects of Clang (e.g. libSupport).
Right now the driver executable for the clang analyzer is the same as the compiler (they are all in the executable 'clang'). There's nothing fundamental about them being in the same executable; that's just how they've been packaged.