On 1/6/14, 11:32 AM, Martin Thomson wrote:

On 2014-01-06, at 11:25, Gregory Szorc <g...@mozilla.com> wrote:

Clang provides access to the low-level token stream [1]. This is available via 
libclang (the C API) and the Python bindings and I'm pretty sure you can access 
this info from plugins.

Each token is associated with a source location (file, line, column, etc). So, 
you can tell it which files are allowed to contain certain tokens and not fail 
the build if something like NULL is in 3rd party or system headers.

You should also be able to scan the token stream to look for things like 
missing braces on if blocks. Lots of possibilities.

Both are probably good clang-analyser plugins to write.  
http://clang-analyzer.llvm.org/

True. Although I don't believe we run clang-analyzer in automation... yet.

A benefit of integrating "style checks" into the compiler plugin is that local developers can install the compiler plugin and get build failures as part of the regular developer workflow. I don't think many people people run or will run clang-analyzer as part of the regular development workflow. That being said, we could integrate clang-analyzer into the build system and have it run automagically if that's what people want.

I /think/ the C++ for a compiler plugin or a clang-analyzer plugin would be very similar. So the first step either way is for someone to write said code.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to