1 This is a directory for Clang plugins that are designed to do analysis and/or 2 manipulation of PPAPI code. Clang is an open-source C front-end that allows 3 you to parse C, C++, or Objective-C code in to an abstract syntax tree (or AST) 4 for processing. This README assumes that you are working in a check-out of 5 chromium. 6 7 To use these plugins, you will need to get Clang. Clang is rapidly changing, 8 so you may want to download and build it yourself. See the instructions here: 9 - http://clang.llvm.org/get_started.html 10 11 To build the plugins, use the Makefile in this directory. If you want the 12 provided Makefile to work out-of-the-box, in step 2 of the instructions at the 13 above URL, you should do the following: 14 > mkdir ~/llvm 15 > cd ~/llvm 16 Now continue with the svn co command to check out llvm in ~/llvm/llvm. If you 17 choose to build llvm in another location, you can use environment variables to 18 force the Makefile to find your build of clang. See the Makefile for details. 19 20 To run a plugin, use clang with the -cc1 -load and -plugin flags and an 21 otherwise normal build line. For example, to run liBPrintNamesAndSizes.so, if 22 you currently build like this: 23 g++ (build_options) 24 Run this from the command-line instead: 25 clang -cc1 -load ppapi/tests/clang/libPrintNamesAndSizes.so \ 26 -plugin PrintNamesAndSizes (build_options) 27 28 Plugins: 29 PrintNamesAndSizes : print_names_and_sizes.cc 30 Print information about all top-level type definitions. You probably won't 31 need to run it by itself; instead see generate_ppapi_size_checks.py, which 32 uses the plugin. See print_names_and_sizes.cc for more detail on the plugin. 33 34 Example command-line: 35 python generate_ppapi_size_checks.py \ 36 --ppapi-root=/usr/local/google/chrome_build/src/ppapi 37 python generate_ppapi_size_checks.py --help 38 39 40 FindAffectedInterfaces : find_affected_interfaces.cc 41 Given typenames as parameters, print out all types that are affected 42 (including function pointer types and structs containing affected function 43 pointer types) if the given type(s) change. This is meant to be used for 44 determining what interfaces are affected by a change to a struct. 45 46 Example command-line: 47 clang -cc1 -load ppapi/tests/clang/libFindAffectedInterfaces.so \ 48 -plugin FindAffectedInterfaces -I. ppapi/tests/all_includes.h \ 49 -plugin-arg-FindAffectedInterfaces \ 50 "struct PP_VideoCompressedDataBuffer_Dev" 51 clang -cc1 -load tests/clang/libFindAffectedInterfaces.so \ 52 -plugin FindAffectedInterfaces -I../ tests/all_c_includes.h \ 53 -plugin-arg-FindAffectedInterfaces \ 54 "struct PP_VideoCompressedDataBuffer_Dev,struct PP_Var" 55 56 (This assumes that clang is in your path and you are running the plugin from 57 the ppapi subdirectory in a chrome checkout). 58