Code Monkey home page Code Monkey logo

facebook-clang-plugins's Introduction

Facebook Clang Plugins

This repository aims to share some useful clang plugins developed at Facebook.

It contains two kinds of plugins to the clang compiler:

  • analyzer plugins use the internal APIs of clang analyzer to find bugs and report them;

  • frontend plugins process the syntax of source files directly to accomplish more general tasks; specifically, we have developed a clang-to-ocaml bridge to make code analyses easier.

Most of the plugins here have been written with iOS in mind. However, different platforms may be considered in the future.

Pre-release notes

This pre-release is meant to spark interest and gather early feedback. Plugins are still subject to be deleted, moved, added, or heavily rewritten.

Structure of the repository

  • analyzer : plugins for clang analyzer,

  • libtooling : frontend plugins (currently a clang-to-json AST exporter),

  • clang-ocaml : ocaml libraries to process the JSON output of frontend plugins,

  • extra-repo-example : example of external repository where to add plugins and piggyback on the build system.

Quick start

The current version of the plugins requires recent version of the clang compiler, re-compiled from source. Clang source which is used by this project can be found in clang/src/

General instructions to compile clang can be found here: http://clang.llvm.org/get_started.html

To compile and use the required version of clang, please run ./clang/setup.sh. Using this script should make the variable CLANG_PREFIX unnecessary to compile the plugin.

Caveat:

  • Because of the nature of C++, clang and the plugins need to be compiled with the exact same C++ libraries.
  • Also, the default stripping command of clang in release mode breaks plugins.

Once the target compiler is installed, make test should run the unit tests.

Ocaml users may also run:

make -C clang-ocaml test  #requires proper ocaml libraries, see included clang-ocaml/README

Mac users may create an Xcode project as follows:

export CLANG_PREFIX=/usr/local #should be the same as above
make xcode

Additional configuration options are available in Makefile.config (and possibly CMakeLists.txt).

facebook-clang-plugins's People

Contributors

da319 avatar ddino avatar dulmarod avatar hansonw avatar jberdine avatar jvillard avatar ma2bd avatar martinoluca avatar mbouaziz avatar milend avatar tarikozket avatar xvilka avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.