trailofbits / pasta

Peter's Amazing Syntax Tree Analyzer
Apache License 2.0
123 stars 9 forks source link
ast clang compiler llvm static-analysis

PASTA

PASTA is a C++ library that abstracts the Clang compiler toolchain, and provides detailed access to compilation artifacts using APIs that mirror those available in Clang. PASTA tries to achieve the following goals:

Getting and Building the Code

First, update aptitude and get install the baseline dependencies such is for example git, cmake, ninja and your compiler of choice (remember it needs to support C++20). It is useful to use the same compiler at every subset to avoid some name mangling problems. If you're using macOS then we recommend installing Homebrew, and ensuring that you have Python 3.9 installed, along with an up-to-date cmake and ninja.

PASTA

And finally to build PASTA itself.

On Linux

git clone https://github.com/trailofbits/pasta.git
mkdir -p pasta-build
cd pasta-build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DPASTA_ENABLE_INSTALL=ON \
    -GNinja \
    ../pasta
ninja install

On macOS

On macOS, you may need to manually specify the Clang compiler. You can't, however, just specify clang or clang++, because then vcpkg will try to take over and produce unusual results. Therefore, you should give the absolute path to your Clang.

git clone https://github.com/trailofbits/pasta.git
mkdir -p pasta-build
cd pasta-build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_C_COMPILER=`which clang` \
    -DCMAKE_CXX_COMPILER=`which clang++` \
    -DPASTA_ENABLE_INSTALL=ON \
    -GNinja \
    ../pasta
ninja install

License

PASTA is licensed according to the Apache 2.0 license. Large parts of PASTA are semi-autogenerated from Clang APIs. Clang is also licensed under Apache 2.0, with LLVM exceptions.

This research was developed with funding from the Defense Advanced Research Projects Agency (DARPA). The views, opinions and/or findings expressed are those of the author and should not be interpreted as representing the official views or policies of the Department of Defense or the U.S. Government.

Distribution Statement A – Approved for Public Release, Distribution Unlimited