[cfe-dev] what's the best way to writing a code analyzer with clang?

John Smith lbalbalba at gmail.com
Wed Jan 2 03:47:31 PST 2013


Hi,


Since nobody replied yet, perhaps these pages can get you started ?

http://clang-analyzer.llvm.org/checker_dev_manual.html
http://clang-analyzer.llvm.org/potential_checkers.html


Regards,


John Smith.



From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu]
On Behalf Of kevinlynx
Sent: woensdag 2 januari 2013 10:13
To: David Blaikie
Cc: cfe-dev
Subject: Re: [cfe-dev] what's the best way to writing a code analyzer
with clang?


Thanks. Is `clangAnalysis` the Clang Static Analyzer ? It's a library
and i check out some header files, but i do not know how to use this
library. It seems there's no document about this library. I want to
write a static code analyzer, to get all functions/variables and other
more details information from a file.  Can you give me some more details
about this ? 

------------------ Original ------------------
From:  "David Blaikie"<dblaikie at gmail.com>;
Date:  Wed, Jan 2, 2013 03:06 AM
To:  "kevinlynx"<kevinlynx at gmail.com>; 
Cc:  "cfe-dev"<cfe-dev at cs.uiuc.edu>; 
Subject:  Re: [cfe-dev] what's the best way to writing a code analyzer
with clang?

On Tue, Jan 1, 2013 at 6:28 AM, kevinlynx <kevinlynx at gmail.com> wrote:
> I'm writing a c/c++ code analyzer recently. I read some clang
> documents/tutorials. It seems there're several ways to accomplish
this. And
> i'm using this tutorial
>
http://eli.thegreenplace.net/2012/06/08/basic-source-to-source-transform
ation-with-clang,
> because it's a real sample which can be get worked.
>
> So my question is, is there any other better ways to do this ?

What kind of analysis are you  trying to do? Static? (if so,
source-to-source transformation isn't really relevant - check out the
Clang Static Analyzer and Anna's talk from the 2012 dev meeting)
Dynamic? (again, source to source transformation probably isn't what
you want - see how Address Sanitizer is implemented - as an LLVM IR
pass adding in the instrumentation/checking at that level)





More information about the cfe-dev mailing list