OLD | NEW |
1 This is a directory for Clang plugins that are designed to do analysis and/or ma
nipulation of PPAPI code. Clang is an open-source C front-end that allows you t
o parse C, C++, or Objective-C code in to an abstract syntax tree (or AST) for p
rocessing. | 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. |
2 | 6 |
3 To use these plugins, you will need to get Clang. Clang is rapidly changing, so
you may want to download and build it yourself. See the instructions here: | 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: |
4 - http://clang.llvm.org/get_started.html | 9 - http://clang.llvm.org/get_started.html |
5 | 10 |
6 To build the plugins, use the Makefile in this directory. If you want the provi
ded Makefile to work out-of-the-box, in step 2 of the instructions at the above
URL, you should do the following: | 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: |
7 > mkdir ~/llvm | 14 > mkdir ~/llvm |
8 > cd ~/llvm | 15 > cd ~/llvm |
9 Now continue with the svn co command to check out llvm in ~/llvm/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. |
10 | 19 |
11 To run a plugin, use clang with the -cc1 -load and -plugin flags and an otherwis
e normal build line. For example, to run liBPrintNamesAndSizes.so, if you curre
ntly build like this: | 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: |
12 g++ (build_options) | 23 g++ (build_options) |
13 Run this from the command-line instead: | 24 Run this from the command-line instead: |
14 clang -cc1 -load ppapi/tests/clang/libPrintNamesAndSizes.so -plugin PrintNamesAn
dSizes (build_options) | 25 clang -cc1 -load ppapi/tests/clang/libPrintNamesAndSizes.so \ |
| 26 -plugin PrintNamesAndSizes (build_options) |
15 | 27 |
16 Plugins: | 28 Plugins: |
17 PrintNamesAndSizes : print_names_and_sizes.cc | 29 PrintNamesAndSizes : print_names_and_sizes.cc |
18 Print information about all top-level type definitions. You probably won't need
to run it by itself; instead see generate_ppapi_size_checks.py, which uses the
plugin. | 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. |
19 | 33 |
20 Example command-line: | 34 Example command-line: |
21 python generate_ppapi_size_checks.py --ppapi-root=/usr/local/google/chrome_bui
ld/src/ppapi | 35 python generate_ppapi_size_checks.py \ |
22 python generate_ppapi_size_checks.py --help | 36 --ppapi-root=/usr/local/google/chrome_build/src/ppapi |
| 37 python generate_ppapi_size_checks.py --help |
23 | 38 |
24 | 39 |
25 FindAffectedInterfaces : find_affected_interfaces.cc | 40 FindAffectedInterfaces : find_affected_interfaces.cc |
26 Given typenames as parameters, print out all types that are affected (including
function pointer types and structs containing affected function pointer types) i
f the given type(s) change. This is meant to be used for determining what inter
faces are affected by a change to a struct. | 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. |
27 | 45 |
28 Example command-line: | 46 Example command-line: |
29 clang -cc1 -load ppapi/tests/clang/libFindAffectedInterfaces.so -plugin FindAf
fectedInterfaces -I. ppapi/tests/all_includes.h -plugin-arg-FindAffectedInterfac
es "struct PP_VideoCompressedDataBuffer_Dev" | 47 clang -cc1 -load ppapi/tests/clang/libFindAffectedInterfaces.so \ |
30 clang -cc1 -load tests/clang/libFindAffectedInterfaces.so -plugin FindAffected
Interfaces -I../ tests/all_c_includes.h -plugin-arg-FindAffectedInterfaces "stru
ct PP_VideoCompressedDataBuffer_Dev,struct PP_Var" | 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" |
31 | 55 |
32 (This assumes that clang is in your path and you are running the plugin from the
ppapi subdirectory in a chrome checkout). | 56 (This assumes that clang is in your path and you are running the plugin from |
| 57 the ppapi subdirectory in a chrome checkout). |
OLD | NEW |