11 This document contains the LLVM Developer Policy which defines the project's
12 policy towards developers and their contributions. The intent of this policy is
13 to eliminate miscommunication, rework, and confusion that might arise from the
14 distributed nature of LLVM's development. By stating the policy in clear terms,
15 we hope each developer can know ahead of time what to expect when making LLVM
16 contributions. This policy covers all llvm.org subprojects, including Clang,
19 This policy is also designed to accomplish the following objectives:
21 #. Attract both users and developers to the LLVM project.
23 #. Make life as simple and easy for contributors as possible.
25 #. Keep the top of Subversion trees as stable as possible.
27 #. Establish awareness of the project's :ref:`copyright, license, and patent
28 policies <copyright-license-patents>` with contributors to the project.
30 This policy is aimed at frequent contributors to LLVM. People interested in
31 contributing one-off patches can do so in an informal way by sending them to the
32 `llvm-commits mailing list
33 <http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>`_ and engaging another
34 developer to see it through the process.
39 This section contains policies that pertain to frequent LLVM developers. We
40 always welcome `one-off patches`_ from people who do not routinely contribute to
41 LLVM, but we expect more from frequent contributors to keep the system as
42 efficient as possible for everyone. Frequent LLVM contributors are expected to
43 meet the following requirements in order for LLVM to maintain a high standard of
49 Developers should stay informed by reading at least the "dev" mailing list for
50 the projects you are interested in, such as `llvmdev
51 <http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev>`_ for LLVM, `cfe-dev
52 <http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>`_ for Clang, or `lldb-dev
53 <http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev>`_ for LLDB. If you are
54 doing anything more than just casual work on LLVM, it is suggested that you also
55 subscribe to the "commits" mailing list for the subproject you're interested in,
57 <http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>`_, `cfe-commits
58 <http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits>`_, or `lldb-commits
59 <http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits>`_. Reading the
60 "commits" list and paying attention to changes being made by others is a good
61 way to see what other people are interested in and watching the flow of the
64 We recommend that active developers register an email account with `LLVM
65 Bugzilla <http://llvm.org/bugs/>`_ and preferably subscribe to the `llvm-bugs
66 <http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs>`_ email list to keep track
67 of bugs and enhancements occurring in LLVM. We really appreciate people who are
68 proactive at catching incoming bugs in their components and dealing with them
71 Please be aware that all public LLVM mailing lists are public and archived, and
72 that notices of confidentiality or non-disclosure cannot be respected.
80 When making a patch for review, the goal is to make it as easy for the reviewer
81 to read it as possible. As such, we recommend that you:
83 #. Make your patch against the Subversion trunk, not a branch, and not an old
84 version of LLVM. This makes it easy to apply the patch. For information on
85 how to check out SVN trunk, please see the `Getting Started
86 Guide <GettingStarted.html#checkout>`_.
88 #. Similarly, patches should be submitted soon after they are generated. Old
89 patches may not apply correctly if the underlying code changes between the
90 time the patch was created and the time it is applied.
92 #. Patches should be made with ``svn diff``, or similar. If you use a
93 different tool, make sure it uses the ``diff -u`` format and that it
94 doesn't contain clutter which makes it hard to read.
96 #. If you are modifying generated files, such as the top-level ``configure``
97 script, please separate out those changes into a separate patch from the rest
100 When sending a patch to a mailing list, it is a good idea to send it as an
101 *attachment* to the message, not embedded into the text of the message. This
102 ensures that your mailer will not mangle the patch when it sends it (e.g. by
103 making whitespace changes or by wrapping lines).
105 *For Thunderbird users:* Before submitting a patch, please open *Preferences >
106 Advanced > General > Config Editor*, find the key
107 ``mail.content_disposition_type``, and set its value to ``1``. Without this
108 setting, Thunderbird sends your attachment using ``Content-Disposition: inline``
109 rather than ``Content-Disposition: attachment``. Apple Mail gamely displays such
110 a file inline, making it difficult to work with for reviewers using that
113 When submitting patches, please do not add confidentiality or non-disclosure
114 notices to the patches themselves. These notices conflict with the `LLVM
115 License`_ and may result in your contribution being excluded.
122 LLVM has a code review policy. Code review is one way to increase the quality of
123 software. We generally follow these policies:
125 #. All developers are required to have significant changes reviewed before they
126 are committed to the repository.
128 #. Code reviews are conducted by email, usually on the llvm-commits list.
130 #. Code can be reviewed either before it is committed or after. We expect major
131 changes to be reviewed before being committed, but smaller changes (or
132 changes where the developer owns the component) can be reviewed after commit.
134 #. The developer responsible for a code change is also responsible for making
135 all necessary review-related changes.
137 #. Code review can be an iterative process, which continues until the patch is
138 ready to be committed. Specifically, once a patch is sent out for review, it
139 needs an explicit "looks good" before it is submitted. Do not assume silent
140 approval, or request active objections to the patch with a deadline.
142 Sometimes code reviews will take longer than you would hope for, especially for
143 larger features. Accepted ways to speed up review times for your patches are:
145 * Review other people's patches. If you help out, everybody will be more
146 willing to do the same for you; goodwill is our currency.
147 * Ping the patch. If it is urgent, provide reasons why it is important to you to
148 get this patch landed and ping it every couple of days. If it is
149 not urgent, the common courtesy ping rate is one week. Remember that you're
150 asking for valuable time from other professional developers.
151 * Ask for help on IRC. Developers on IRC will be able to either help you
152 directly, or tell you who might be a good reviewer.
153 * Split your patch into multiple smaller patches that build on each other. The
154 smaller your patch, the higher the probability that somebody will take a quick
157 Developers should participate in code reviews as both reviewers and
158 reviewees. If someone is kind enough to review your code, you should return the
159 favor for someone else. Note that anyone is welcome to review and give feedback
160 on a patch, but only people with Subversion write access can approve it.
162 There is a web based code review tool that can optionally be used
163 for code reviews. See :doc:`Phabricator`.
168 The LLVM Project relies on two features of its process to maintain rapid
169 development in addition to the high quality of its source base: the combination
170 of code review plus post-commit review for trusted maintainers. Having both is
171 a great way for the project to take advantage of the fact that most people do
172 the right thing most of the time, and only commit patches without pre-commit
173 review when they are confident they are right.
175 The trick to this is that the project has to guarantee that all patches that are
176 committed are reviewed after they go in: you don't want everyone to assume
177 someone else will review it, allowing the patch to go unreviewed. To solve this
178 problem, we have a notion of an 'owner' for a piece of the code. The sole
179 responsibility of a code owner is to ensure that a commit to their area of the
180 code is appropriately reviewed, either by themself or by someone else. The list
181 of current code owners can be found in the file
182 `CODE_OWNERS.TXT <http://llvm.org/viewvc/llvm-project/llvm/trunk/CODE_OWNERS.TXT?view=markup>`_
183 in the root of the LLVM source tree.
185 Note that code ownership is completely different than reviewers: anyone can
186 review a piece of code, and we welcome code review from anyone who is
187 interested. Code owners are the "last line of defense" to guarantee that all
188 patches that are committed are actually reviewed.
190 Being a code owner is a somewhat unglamorous position, but it is incredibly
191 important for the ongoing success of the project. Because people get busy,
192 interests change, and unexpected things happen, code ownership is purely opt-in,
193 and anyone can choose to resign their "title" at any time. For now, we do not
194 have an official policy on how one gets elected to be a code owner.
196 .. _include a testcase:
201 Developers are required to create test cases for any bugs fixed and any new
202 features added. Some tips for getting your testcase approved:
204 * All feature and regression test cases are added to the ``llvm/test``
205 directory. The appropriate sub-directory should be selected (see the
206 :doc:`Testing Guide <TestingGuide>` for details).
208 * Test cases should be written in `LLVM assembly language <LangRef.html>`_
209 unless the feature or regression being tested requires another language
210 (e.g. the bug being fixed or feature being implemented is in the llvm-gcc C++
211 front-end, in which case it must be written in C++).
213 * Test cases, especially for regressions, should be reduced as much as possible,
214 by `bugpoint <Bugpoint.html>`_ or manually. It is unacceptable to place an
215 entire failing program into ``llvm/test`` as this creates a *time-to-test*
216 burden on all developers. Please keep them short.
218 Note that llvm/test and clang/test are designed for regression and small feature
219 tests only. More extensive test cases (e.g., entire applications, benchmarks,
220 etc) should be added to the ``llvm-test`` test suite. The llvm-test suite is
221 for coverage (correctness, performance, etc) testing, not feature or regression
227 The minimum quality standards that any change must satisfy before being
228 committed to the main development branch are:
230 #. Code must adhere to the `LLVM Coding Standards <CodingStandards.html>`_.
232 #. Code must compile cleanly (no errors, no warnings) on at least one platform.
234 #. Bug fixes and new features should `include a testcase`_ so we know if the
235 fix/feature ever regresses in the future.
237 #. Code must pass the ``llvm/test`` test suite.
239 #. The code must not cause regressions on a reasonable subset of llvm-test,
240 where "reasonable" depends on the contributor's judgement and the scope of
241 the change (more invasive changes require more testing). A reasonable subset
242 might be something like "``llvm-test/MultiSource/Benchmarks``".
244 Additionally, the committer is responsible for addressing any problems found in
245 the future that the change is responsible for. For example:
247 * The code should compile cleanly on all supported platforms.
249 * The changes should not cause any correctness regressions in the ``llvm-test``
250 suite and must not cause any major performance regressions.
252 * The change set should not cause performance or correctness regressions for the
255 * The changes should not cause performance or correctness regressions in code
256 compiled by LLVM on all applicable targets.
258 * You are expected to address any `Bugzilla bugs <http://llvm.org/bugs/>`_ that
259 result from your change.
261 We prefer for this to be handled before submission but understand that it isn't
262 possible to test all of this for every submission. Our build bots and nightly
263 testing infrastructure normally finds these problems. A good rule of thumb is
264 to check the nightly testers for regressions the day after your change. Build
265 bots will directly email you if a group of commits that included yours caused a
266 failure. You are expected to check the build bot messages to see if they are
267 your fault and, if so, fix the breakage.
269 Commits that violate these quality standards (e.g. are very broken) may be
270 reverted. This is necessary when the change blocks other developers from making
271 progress. The developer is welcome to re-commit the change after the problem has
274 Obtaining Commit Access
275 -----------------------
277 We grant commit access to contributors with a track record of submitting high
278 quality patches. If you would like commit access, please send an email to
279 `Chris <mailto:sabre@nondot.org>`_ with the following information:
281 #. The user name you want to commit with, e.g. "hacker".
283 #. The full name and email address you want message to llvm-commits to come
284 from, e.g. "J. Random Hacker <hacker@yoyodyne.com>".
286 #. A "password hash" of the password you want to use, e.g. "``2ACR96qjUqsyM``".
287 Note that you don't ever tell us what your password is; you just give it to
288 us in an encrypted form. To get this, run "``htpasswd``" (a utility that
289 comes with apache) in crypt mode (often enabled with "``-d``"), or find a web
290 page that will do it for you.
292 Once you've been granted commit access, you should be able to check out an LLVM
293 tree with an SVN URL of "https://username@llvm.org/..." instead of the normal
294 anonymous URL of "http://llvm.org/...". The first time you commit you'll have
295 to type in your password. Note that you may get a warning from SVN about an
296 untrusted key; you can ignore this. To verify that your commit access works,
297 please do a test commit (e.g. change a comment or add a blank line). Your first
298 commit to a repository may require the autogenerated email to be approved by a
299 mailing list. This is normal and will be done when the mailing list owner has
302 If you have recently been granted commit access, these policies apply:
304 #. You are granted *commit-after-approval* to all parts of LLVM. To get
305 approval, submit a `patch`_ to `llvm-commits
306 <http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>`_. When approved,
307 you may commit it yourself.
309 #. You are allowed to commit patches without approval which you think are
310 obvious. This is clearly a subjective decision --- we simply expect you to
311 use good judgement. Examples include: fixing build breakage, reverting
312 obviously broken patches, documentation/comment changes, any other minor
315 #. You are allowed to commit patches without approval to those portions of LLVM
316 that you have contributed or maintain (i.e., have been assigned
317 responsibility for), with the proviso that such commits must not break the
318 build. This is a "trust but verify" policy, and commits of this nature are
319 reviewed after they are committed.
321 #. Multiple violations of these policies or a single egregious violation may
322 cause commit access to be revoked.
324 In any case, your changes are still subject to `code review`_ (either before or
325 after they are committed, depending on the nature of the change). You are
326 encouraged to review other peoples' patches as well, but you aren't required
329 .. _discuss the change/gather consensus:
331 Making a Major Change
332 ---------------------
334 When a developer begins a major new project with the aim of contributing it back
335 to LLVM, s/he should inform the community with an email to the `llvmdev
336 <http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev>`_ email list, to the extent
337 possible. The reason for this is to:
339 #. keep the community informed about future changes to LLVM,
341 #. avoid duplication of effort by preventing multiple parties working on the
342 same thing and not knowing about it, and
344 #. ensure that any technical issues around the proposed work are discussed and
345 resolved before any significant work is done.
347 The design of LLVM is carefully controlled to ensure that all the pieces fit
348 together well and are as consistent as possible. If you plan to make a major
349 change to the way LLVM works or want to add a major new extension, it is a good
350 idea to get consensus with the development community before you start working on
353 Once the design of the new feature is finalized, the work itself should be done
354 as a series of `incremental changes`_, not as a long-term development branch.
356 .. _incremental changes:
358 Incremental Development
359 -----------------------
361 In the LLVM project, we do all significant changes as a series of incremental
362 patches. We have a strong dislike for huge changes or long-term development
363 branches. Long-term development branches have a number of drawbacks:
365 #. Branches must have mainline merged into them periodically. If the branch
366 development and mainline development occur in the same pieces of code,
367 resolving merge conflicts can take a lot of time.
369 #. Other people in the community tend to ignore work on branches.
371 #. Huge changes (produced when a branch is merged back onto mainline) are
372 extremely difficult to `code review`_.
374 #. Branches are not routinely tested by our nightly tester infrastructure.
376 #. Changes developed as monolithic large changes often don't work until the
377 entire set of changes is done. Breaking it down into a set of smaller
378 changes increases the odds that any of the work will be committed to the main
381 To address these problems, LLVM uses an incremental development style and we
382 require contributors to follow this practice when making a large/invasive
385 * Large/invasive changes usually have a number of secondary changes that are
386 required before the big change can be made (e.g. API cleanup, etc). These
387 sorts of changes can often be done before the major change is done,
388 independently of that work.
390 * The remaining inter-related work should be decomposed into unrelated sets of
391 changes if possible. Once this is done, define the first increment and get
392 consensus on what the end goal of the change is.
394 * Each change in the set can be stand alone (e.g. to fix a bug), or part of a
395 planned series of changes that works towards the development goal.
397 * Each change should be kept as small as possible. This simplifies your work
398 (into a logical progression), simplifies code review and reduces the chance
399 that you will get negative feedback on the change. Small increments also
400 facilitate the maintenance of a high quality code base.
402 * Often, an independent precursor to a big change is to add a new API and slowly
403 migrate clients to use the new API. Each change to use the new API is often
404 "obvious" and can be committed without review. Once the new API is in place
405 and used, it is much easier to replace the underlying implementation of the
406 API. This implementation change is logically separate from the API
409 If you are interested in making a large change, and this scares you, please make
410 sure to first `discuss the change/gather consensus`_ then ask about the best way
411 to go about making the change.
413 Attribution of Changes
414 ----------------------
416 We believe in correct attribution of contributions to their contributors.
417 However, we do not want the source code to be littered with random attributions
418 "this code written by J. Random Hacker" (this is noisy and distracting). In
419 practice, the revision control system keeps a perfect history of who changed
420 what, and the CREDITS.txt file describes higher-level contributions. If you
421 commit a patch for someone else, please say "patch contributed by J. Random
422 Hacker!" in the commit message.
424 Overall, please do not add contributor names to the source code.
426 .. _copyright-license-patents:
428 Copyright, License, and Patents
429 ===============================
433 This section deals with legal matters but does not provide legal advice. We
434 are not lawyers --- please seek legal counsel from an attorney.
436 This section addresses the issues of copyright, license and patents for the LLVM
437 project. The copyright for the code is held by the individual contributors of
438 the code and the terms of its license to LLVM users and developers is the
439 `University of Illinois/NCSA Open Source License
440 <http://www.opensource.org/licenses/UoI-NCSA.php>`_ (with portions dual licensed
441 under the `MIT License <http://www.opensource.org/licenses/mit-license.php>`_,
442 see below). As contributor to the LLVM project, you agree to allow any
443 contributions to the project to licensed under these terms.
448 The LLVM project does not require copyright assignments, which means that the
449 copyright for the code in the project is held by its respective contributors who
450 have each agreed to release their contributed code under the terms of the `LLVM
453 An implication of this is that the LLVM license is unlikely to ever change:
454 changing it would require tracking down all the contributors to LLVM and getting
455 them to agree that a license change is acceptable for their contribution. Since
456 there are no plans to change the license, this is not a cause for concern.
458 As a contributor to the project, this means that you (or your company) retain
459 ownership of the code you contribute, that it cannot be used in a way that
460 contradicts the license (which is a liberal BSD-style license), and that the
461 license for your contributions won't change without your approval in the
469 We intend to keep LLVM perpetually open source and to use a liberal open source
470 license. **As a contributor to the project, you agree that any contributions be
471 licensed under the terms of the corresponding subproject.** All of the code in
472 LLVM is available under the `University of Illinois/NCSA Open Source License
473 <http://www.opensource.org/licenses/UoI-NCSA.php>`_, which boils down to
476 * You can freely distribute LLVM.
477 * You must retain the copyright notice if you redistribute LLVM.
478 * Binaries derived from LLVM must reproduce the copyright notice (e.g. in an
479 included readme file).
480 * You can't use our names to promote your LLVM derived products.
481 * There's no warranty on LLVM at all.
483 We believe this fosters the widest adoption of LLVM because it **allows
484 commercial products to be derived from LLVM** with few restrictions and without
485 a requirement for making any derived works also open source (i.e. LLVM's
486 license is not a "copyleft" license like the GPL). We suggest that you read the
487 `License <http://www.opensource.org/licenses/UoI-NCSA.php>`_ if further
488 clarification is needed.
490 In addition to the UIUC license, the runtime library components of LLVM
491 (**compiler_rt, libc++, and libclc**) are also licensed under the `MIT License
492 <http://www.opensource.org/licenses/mit-license.php>`_, which does not contain
493 the binary redistribution clause. As a user of these runtime libraries, it
494 means that you can choose to use the code under either license (and thus don't
495 need the binary redistribution clause), and as a contributor to the code that
496 you agree that any contributions to these libraries be licensed under both
497 licenses. We feel that this is important for runtime libraries, because they
498 are implicitly linked into applications and therefore should not subject those
499 applications to the binary redistribution clause. This also means that it is ok
500 to move code from (e.g.) libc++ to the LLVM core without concern, but that code
501 cannot be moved from the LLVM core to libc++ without the copyright owner's
504 Note that the LLVM Project does distribute llvm-gcc and dragonegg, **which are
505 GPL.** This means that anything "linked" into llvm-gcc must itself be compatible
506 with the GPL, and must be releasable under the terms of the GPL. This implies
507 that **any code linked into llvm-gcc and distributed to others may be subject to
508 the viral aspects of the GPL** (for example, a proprietary code generator linked
509 into llvm-gcc must be made available under the GPL). This is not a problem for
510 code already distributed under a more liberal license (like the UIUC license),
511 and GPL-containing subprojects are kept in separate SVN repositories whose
512 LICENSE.txt files specifically indicate that they contain GPL code.
514 We have no plans to change the license of LLVM. If you have questions or
515 comments about the license, please contact the `LLVM Developer's Mailing
516 List <mailto:llvmdev@cs.uiuc.edu>`_.
521 To the best of our knowledge, LLVM does not infringe on any patents (we have
522 actually removed code from LLVM in the past that was found to infringe). Having
523 code in LLVM that infringes on patents would violate an important goal of the
524 project by making it hard or impossible to reuse the code for arbitrary purposes
525 (including commercial use).
527 When contributing code, we expect contributors to notify us of any potential for
528 patent-related trouble with their changes (including from third parties). If
529 you or your employer own the rights to a patent and would like to contribute
530 code to LLVM that relies on it, we require that the copyright owner sign an
531 agreement that allows any other user of LLVM to freely use your patent. Please
532 contact the `oversight group <mailto:llvm-oversight@cs.uiuc.edu>`_ for more