[cfe-dev] facebook clang plugins

Mathieu Baudet mathieubaudet at fb.com
Thu Jun 19 10:48:32 PDT 2014


Awesome! Sending patches to contribute the new analyzer checkers sounds good to me.

Thanks for the insights on the Xml/Json dumpers. I am totally fine with letting this plugin out for now.

Out of curiosity, though, I have a couple of questions on some of the requirements you mention:

  - Documented, with appropriate Schema against which we can validate the output
What platform is available to run the validation?
Here we are using the “atd” language for the schema and an ocaml tool “atdgen”: http://mjambon.com/atdgen/atdgen-manual.html

  - Designed for C/C++/Objective-C, not Clang's specific ASTs
I’m not sure to understand this part. Can you elaborate?

  - Stable across Clang versions
I guess it would need to be maintained the same way ASTDumper.cpp is. Also, it does not seem impossible to merge the two files.

Mathieu


On Jun 19, 2014, at 9:48 AM, Nico Weber <thakis at chromium.org<mailto:thakis at chromium.org>> wrote:

Hi,

cool!

The analyzer checkers look like they're generally useful from a quick glance. http://llvm.org/docs/DeveloperPolicy.html<https://urldefense.proofpoint.com/v1/url?u=http://llvm.org/docs/DeveloperPolicy.html&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=DySJRSwIPwJgrlWcFuOjhjgW2TvEV7mDN%2BhK5RWHkOA%3D%0A&m=ELms8rEkCZHaJvhkuz9R9Rp4GzMgRk3fM6w0haB9MTY%3D%0A&s=16f0cc743787852a9cfae176ca709cf30701ea3bd223e998c909b5ee1b5ed434> describes how to contribute patches. Look at the existing checker tests in the clang repo on how to write tests in clang's test suite.

There currently aren't any frontend plugins checked in. Ocaml tools for parsing json seem out of scope for the clang repo. Clang used to have a "dump xml" flag which was removed here: http://llvm.org/viewvc/llvm-project?view=revision&revision=127141<https://urldefense.proofpoint.com/v1/url?u=http://llvm.org/viewvc/llvm-project?view%3Drevision%26revision%3D127141&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=DySJRSwIPwJgrlWcFuOjhjgW2TvEV7mDN%2BhK5RWHkOA%3D%0A&m=ELms8rEkCZHaJvhkuz9R9Rp4GzMgRk3fM6w0haB9MTY%3D%0A&s=e9057ea6d77784d38531d6c8a54b84d5c8cb77db1ad25506cd7f63bc8fe0ec4a> Adding json output to clang itself seems reasonable if it fulfills the requirements in that commit log, but it should probably be done without a plugin. So I think the frontend plugin should probably continue living out of tree.

Nico


On Thu, Jun 19, 2014 at 9:30 AM, Mathieu Baudet <mathieubaudet at fb.com<mailto:mathieubaudet at fb.com>> wrote:
Hi,

I am looking for feedback on the possibility of contributing some of the clang plugins used at Facebook back to clang.

We just made available a first subset of plugins here:  https://github.com/facebook/facebook-clang-plugins<https://urldefense.proofpoint.com/v1/url?u=https://github.com/facebook/facebook-clang-plugins&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=DySJRSwIPwJgrlWcFuOjhjgW2TvEV7mDN%2BhK5RWHkOA%3D%0A&m=ELms8rEkCZHaJvhkuz9R9Rp4GzMgRk3fM6w0haB9MTY%3D%0A&s=d81ede14e210e443d06b0466bea8398e3d7f37618e3fcc26d3c33d4177b0b868>

The plugins fall into two groups:
1) Clang analyzer checkers for iOS;
2) A clang frontend plugin to export the internal AST of clang in an Ocaml-friendly Json. This plugin comes with Ocaml libraries for testing, parsing, and visiting the AST.

Except for the naming conventions, which are not uniform yet, and the need to update the referenced version of clang, the code should be in a relatively good state. In particular, everything has been tested quite at scale.

Thanks!
—
Mathieu Baudet
_______________________________________________
cfe-dev mailing list
cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=DySJRSwIPwJgrlWcFuOjhjgW2TvEV7mDN%2BhK5RWHkOA%3D%0A&m=ELms8rEkCZHaJvhkuz9R9Rp4GzMgRk3fM6w0haB9MTY%3D%0A&s=73892c108031d43218c75ab5890955e44579010b61427cc72495152b3c45ccd5>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140619/2a55cfaa/attachment.html>


More information about the cfe-dev mailing list