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 TODO: although cs.chromium.org | |
6 [finds](https://code.google.com/p/chromium/codesearch#chromium/src/third_party/l
lvm/) | |
7 `src/third_party/llvm`, it | |
8 [does not exist in Gitiles](https://chromium.googlesource.com/src/third_party/ll
vm/). | |
9 | |
10 Make sure you really want to write a clang plugin. | 5 Make sure you really want to write a clang plugin. |
11 | 6 |
12 * 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 |
13 responsible for making sure it's updated when we update clang. | 8 responsible for making sure it's updated when we update clang. |
14 * 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 |
15 clang, not to a plugin. | 10 clang, not to a plugin. |
16 * 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 |
17 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). |
18 | 13 |
19 Valid reasons for writing a plugin are for example: | 14 Valid reasons for writing a plugin are for example: |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 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 |
157 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 |
158 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 |
159 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 |
160 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 |
161 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 |
162 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, |
163 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 |
164 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 |
165 codebase is clean. | 160 codebase is clean. |
OLD | NEW |