OLD | NEW |
1 # Don't write a clang plugin | 1 # Don't write a clang plugin |
2 | 2 |
3 [TOC] | 3 [TOC] |
4 | 4 |
5 Make sure you really want to write a clang plugin. | 5 Make sure you really want to write a clang plugin. |
6 | 6 |
7 * The clang plugin api is not stable. If you write a plugin, _you_ are | 7 * The clang plugin api is not stable. If you write a plugin, _you_ are |
8 responsible for making sure it's updated when we update clang. | 8 responsible for making sure it's updated when we update clang. |
9 * If you're adding a generally useful warning, it should be added to upstream | 9 * If you're adding a generally useful warning, it should be added to upstream |
10 clang, not to a plugin. | 10 clang, not to a plugin. |
11 * You should not use a clang plugin to do things that can be done in a | 11 * You should not use a clang plugin to do things that can be done in a |
12 PRESUBMIT check (e.g. checking that the headers in a file are sorted). | 12 PRESUBMIT check (e.g. checking that the headers in a file are sorted). |
13 | 13 |
14 Valid reasons for writing a plugin are for example: | 14 Valid reasons for writing a plugin are for example: |
15 | 15 |
16 * You want to add a chromium-specific error message. | 16 * You want to add a chromium-specific error message. |
17 * You want to write an automatic code rewriter. | 17 * You want to write an automatic code rewriter. |
18 | 18 |
19 In both cases, please inform | 19 In both cases, please inform |
20 [clang@chromium.org](http://groups.google.com/a/chromium.org/group/clang/topics) | 20 [clang@chromium.org](https://groups.google.com/a/chromium.org/group/clang/topics
) |
21 of your plans before you pursue them. | 21 of your plans before you pursue them. |
22 | 22 |
23 # Having said that | 23 # Having said that |
24 | 24 |
25 clang currently has minimal documentation on its plugin interface; it's mostly | 25 clang currently has minimal documentation on its plugin interface; it's mostly |
26 doxygen annotations in the source. This is an attempt to be half map to the | 26 doxygen annotations in the source. This is an attempt to be half map to the |
27 header files/half tutorial. | 27 header files/half tutorial. |
28 | 28 |
29 # Building your plugin | 29 # Building your plugin |
30 | 30 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 If you want to add additional checks to the existing plugins, be sure to add the | 151 If you want to add additional checks to the existing plugins, be sure to add the |
152 new diagnostic behind a flag (there are several examples of this in the plugins | 152 new diagnostic behind a flag (there are several examples of this in the plugins |
153 already). The reason for this is that the plugin is bundled with clang, and the | 153 already). The reason for this is that the plugin is bundled with clang, and the |
154 new check will get deployed with the next clang roll. If your check fires, then | 154 new check will get deployed with the next clang roll. If your check fires, then |
155 the next clang roll would now be blocked on cleaning up the whole codebase for | 155 the next clang roll would now be blocked on cleaning up the whole codebase for |
156 your check – and even if the check doesn't fire at the moment, maybe that | 156 your check – and even if the check doesn't fire at the moment, maybe that |
157 regresses until the next clang roll happens. If your new check is behind a flag, | 157 regresses until the next clang roll happens. If your new check is behind a flag, |
158 then the clang roll can happen first, and you can add the flag to enable your | 158 then the clang roll can happen first, and you can add the flag to enable your |
159 check after that, and then turn on the check everywhere once you know that the | 159 check after that, and then turn on the check everywhere once you know that the |
160 codebase is clean. | 160 codebase is clean. |
OLD | NEW |