| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 1 | ===================== |
| 2 | LLVM Developer Policy |
| 3 | ===================== |
| 4 | |
| 5 | .. contents:: |
| 6 | :local: |
| 7 | |
| 8 | Introduction |
| 9 | ============ |
| 10 | |
| 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, |
| 17 | LLDB, libc++, etc. |
| 18 | |
| 19 | This policy is also designed to accomplish the following objectives: |
| 20 | |
| 21 | #. Attract both users and developers to the LLVM project. |
| 22 | |
| 23 | #. Make life as simple and easy for contributors as possible. |
| 24 | |
| JF Bastien | 6e69db5 | 2019-01-21 23:53:52 +0000 | [diff] [blame] | 25 | #. Keep the top of tree as stable as possible. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 26 | |
| Dmitri Gribenko | 38782b8 | 2012-12-09 23:14:26 +0000 | [diff] [blame] | 27 | #. Establish awareness of the project's :ref:`copyright, license, and patent |
| 28 | policies <copyright-license-patents>` with contributors to the project. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 29 | |
| 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 |
| Tanya Lattner | 0d28f80 | 2015-08-05 03:51:17 +0000 | [diff] [blame] | 33 | <http://lists.llvm.org/mailman/listinfo/llvm-commits>`_ and engaging another |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 34 | developer to see it through the process. |
| 35 | |
| 36 | Developer Policies |
| 37 | ================== |
| 38 | |
| 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 |
| 44 | quality. |
| 45 | |
| 46 | Stay Informed |
| 47 | ------------- |
| 48 | |
| 49 | Developers should stay informed by reading at least the "dev" mailing list for |
| Tanya Lattner | 0d28f80 | 2015-08-05 03:51:17 +0000 | [diff] [blame] | 50 | the projects you are interested in, such as `llvm-dev |
| 51 | <http://lists.llvm.org/mailman/listinfo/llvm-dev>`_ for LLVM, `cfe-dev |
| 52 | <http://lists.llvm.org/mailman/listinfo/cfe-dev>`_ for Clang, or `lldb-dev |
| 53 | <http://lists.llvm.org/mailman/listinfo/lldb-dev>`_ for LLDB. If you are |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 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, |
| 56 | such as `llvm-commits |
| Tanya Lattner | 0d28f80 | 2015-08-05 03:51:17 +0000 | [diff] [blame] | 57 | <http://lists.llvm.org/mailman/listinfo/llvm-commits>`_, `cfe-commits |
| 58 | <http://lists.llvm.org/mailman/listinfo/cfe-commits>`_, or `lldb-commits |
| 59 | <http://lists.llvm.org/mailman/listinfo/lldb-commits>`_. Reading the |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 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 |
| 62 | project as a whole. |
| 63 | |
| 64 | We recommend that active developers register an email account with `LLVM |
| Ismail Donmez | c7ff814 | 2017-02-17 08:26:11 +0000 | [diff] [blame] | 65 | Bugzilla <https://bugs.llvm.org/>`_ and preferably subscribe to the `llvm-bugs |
| Tanya Lattner | 0d28f80 | 2015-08-05 03:51:17 +0000 | [diff] [blame] | 66 | <http://lists.llvm.org/mailman/listinfo/llvm-bugs>`_ email list to keep track |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 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 |
| 69 | promptly. |
| 70 | |
| Alp Toker | 4655259 | 2013-10-18 08:45:43 +0000 | [diff] [blame] | 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. |
| 73 | |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 74 | .. _patch: |
| 75 | .. _one-off patches: |
| 76 | |
| Chandler Carruth | 85dac69 | 2014-01-10 00:08:34 +0000 | [diff] [blame] | 77 | Making and Submitting a Patch |
| 78 | ----------------------------- |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 79 | |
| 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: |
| 82 | |
| James Y Knight | 7865588 | 2019-01-14 22:27:32 +0000 | [diff] [blame] | 83 | #. Make your patch against git master, not a branch, and not an old version |
| 84 | of LLVM. This makes it easy to apply the patch. For information on how to |
| 85 | clone from git, please see the :ref:`Getting Started Guide |
| 86 | <checkout>`. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 87 | |
| 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. |
| 91 | |
| James Y Knight | 7865588 | 2019-01-14 22:27:32 +0000 | [diff] [blame] | 92 | #. Patches should be made with ``git format-patch``, or similar. If you use a |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 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. |
| 95 | |
| Chandler Carruth | 85dac69 | 2014-01-10 00:08:34 +0000 | [diff] [blame] | 96 | Once your patch is ready, submit it by emailing it to the appropriate project's |
| 97 | commit mailing list (or commit it directly if applicable). Alternatively, some |
| 98 | patches get sent to the project's development list or component of the LLVM bug |
| 99 | tracker, but the commit list is the primary place for reviews and should |
| 100 | generally be preferred. |
| 101 | |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 102 | When sending a patch to a mailing list, it is a good idea to send it as an |
| 103 | *attachment* to the message, not embedded into the text of the message. This |
| 104 | ensures that your mailer will not mangle the patch when it sends it (e.g. by |
| 105 | making whitespace changes or by wrapping lines). |
| 106 | |
| 107 | *For Thunderbird users:* Before submitting a patch, please open *Preferences > |
| 108 | Advanced > General > Config Editor*, find the key |
| 109 | ``mail.content_disposition_type``, and set its value to ``1``. Without this |
| 110 | setting, Thunderbird sends your attachment using ``Content-Disposition: inline`` |
| 111 | rather than ``Content-Disposition: attachment``. Apple Mail gamely displays such |
| 112 | a file inline, making it difficult to work with for reviewers using that |
| 113 | program. |
| 114 | |
| Alp Toker | 4655259 | 2013-10-18 08:45:43 +0000 | [diff] [blame] | 115 | When submitting patches, please do not add confidentiality or non-disclosure |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 116 | notices to the patches themselves. These notices conflict with the LLVM |
| 117 | licensing terms and may result in your contribution being excluded. |
| Alp Toker | 4655259 | 2013-10-18 08:45:43 +0000 | [diff] [blame] | 118 | |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 119 | .. _code review: |
| 120 | |
| 121 | Code Reviews |
| 122 | ------------ |
| 123 | |
| Hal Finkel | 4d0339a | 2019-12-26 21:56:26 +0000 | [diff] [blame] | 124 | LLVM has a code-review policy. Code review is one way to increase the quality of |
| 125 | software. Please see :doc:`CodeReview` for more information on LLVM's code-review |
| 126 | process. |
| Manuel Klimek | 8398126 | 2012-10-11 19:40:46 +0000 | [diff] [blame] | 127 | |
| Renato Golin | 891a49c | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 128 | .. _code owners: |
| 129 | |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 130 | Code Owners |
| 131 | ----------- |
| 132 | |
| 133 | The LLVM Project relies on two features of its process to maintain rapid |
| 134 | development in addition to the high quality of its source base: the combination |
| 135 | of code review plus post-commit review for trusted maintainers. Having both is |
| 136 | a great way for the project to take advantage of the fact that most people do |
| 137 | the right thing most of the time, and only commit patches without pre-commit |
| 138 | review when they are confident they are right. |
| 139 | |
| 140 | The trick to this is that the project has to guarantee that all patches that are |
| 141 | committed are reviewed after they go in: you don't want everyone to assume |
| 142 | someone else will review it, allowing the patch to go unreviewed. To solve this |
| 143 | problem, we have a notion of an 'owner' for a piece of the code. The sole |
| 144 | responsibility of a code owner is to ensure that a commit to their area of the |
| Duncan Sands | c769cca | 2012-07-26 08:04:09 +0000 | [diff] [blame] | 145 | code is appropriately reviewed, either by themself or by someone else. The list |
| James Y Knight | 7865588 | 2019-01-14 22:27:32 +0000 | [diff] [blame] | 146 | of current code owners can be found in the file `CODE_OWNERS.TXT |
| 147 | <https://github.com/llvm/llvm-project/blob/master/llvm/CODE_OWNERS.TXT>`_ in the |
| 148 | root of the LLVM source tree. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 149 | |
| 150 | Note that code ownership is completely different than reviewers: anyone can |
| 151 | review a piece of code, and we welcome code review from anyone who is |
| 152 | interested. Code owners are the "last line of defense" to guarantee that all |
| 153 | patches that are committed are actually reviewed. |
| 154 | |
| 155 | Being a code owner is a somewhat unglamorous position, but it is incredibly |
| 156 | important for the ongoing success of the project. Because people get busy, |
| 157 | interests change, and unexpected things happen, code ownership is purely opt-in, |
| 158 | and anyone can choose to resign their "title" at any time. For now, we do not |
| 159 | have an official policy on how one gets elected to be a code owner. |
| 160 | |
| 161 | .. _include a testcase: |
| 162 | |
| 163 | Test Cases |
| 164 | ---------- |
| 165 | |
| 166 | Developers are required to create test cases for any bugs fixed and any new |
| 167 | features added. Some tips for getting your testcase approved: |
| 168 | |
| 169 | * All feature and regression test cases are added to the ``llvm/test`` |
| Sean Silva | a89edf6 | 2012-11-14 21:09:30 +0000 | [diff] [blame] | 170 | directory. The appropriate sub-directory should be selected (see the |
| 171 | :doc:`Testing Guide <TestingGuide>` for details). |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 172 | |
| Sean Silva | e0ddc73 | 2014-02-19 00:12:34 +0000 | [diff] [blame] | 173 | * Test cases should be written in :doc:`LLVM assembly language <LangRef>`. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 174 | |
| 175 | * Test cases, especially for regressions, should be reduced as much as possible, |
| Sean Silva | e0ddc73 | 2014-02-19 00:12:34 +0000 | [diff] [blame] | 176 | by :doc:`bugpoint <Bugpoint>` or manually. It is unacceptable to place an |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 177 | entire failing program into ``llvm/test`` as this creates a *time-to-test* |
| 178 | burden on all developers. Please keep them short. |
| 179 | |
| 180 | Note that llvm/test and clang/test are designed for regression and small feature |
| 181 | tests only. More extensive test cases (e.g., entire applications, benchmarks, |
| 182 | etc) should be added to the ``llvm-test`` test suite. The llvm-test suite is |
| 183 | for coverage (correctness, performance, etc) testing, not feature or regression |
| 184 | testing. |
| 185 | |
| 186 | Quality |
| 187 | ------- |
| 188 | |
| 189 | The minimum quality standards that any change must satisfy before being |
| 190 | committed to the main development branch are: |
| 191 | |
| 192 | #. Code must adhere to the `LLVM Coding Standards <CodingStandards.html>`_. |
| 193 | |
| 194 | #. Code must compile cleanly (no errors, no warnings) on at least one platform. |
| 195 | |
| 196 | #. Bug fixes and new features should `include a testcase`_ so we know if the |
| 197 | fix/feature ever regresses in the future. |
| 198 | |
| 199 | #. Code must pass the ``llvm/test`` test suite. |
| 200 | |
| 201 | #. The code must not cause regressions on a reasonable subset of llvm-test, |
| 202 | where "reasonable" depends on the contributor's judgement and the scope of |
| 203 | the change (more invasive changes require more testing). A reasonable subset |
| 204 | might be something like "``llvm-test/MultiSource/Benchmarks``". |
| 205 | |
| 206 | Additionally, the committer is responsible for addressing any problems found in |
| 207 | the future that the change is responsible for. For example: |
| 208 | |
| 209 | * The code should compile cleanly on all supported platforms. |
| 210 | |
| 211 | * The changes should not cause any correctness regressions in the ``llvm-test`` |
| 212 | suite and must not cause any major performance regressions. |
| 213 | |
| 214 | * The change set should not cause performance or correctness regressions for the |
| 215 | LLVM tools. |
| 216 | |
| 217 | * The changes should not cause performance or correctness regressions in code |
| 218 | compiled by LLVM on all applicable targets. |
| 219 | |
| Ismail Donmez | c7ff814 | 2017-02-17 08:26:11 +0000 | [diff] [blame] | 220 | * You are expected to address any `Bugzilla bugs <https://bugs.llvm.org/>`_ that |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 221 | result from your change. |
| 222 | |
| 223 | We prefer for this to be handled before submission but understand that it isn't |
| 224 | possible to test all of this for every submission. Our build bots and nightly |
| 225 | testing infrastructure normally finds these problems. A good rule of thumb is |
| 226 | to check the nightly testers for regressions the day after your change. Build |
| 227 | bots will directly email you if a group of commits that included yours caused a |
| 228 | failure. You are expected to check the build bot messages to see if they are |
| 229 | your fault and, if so, fix the breakage. |
| 230 | |
| 231 | Commits that violate these quality standards (e.g. are very broken) may be |
| 232 | reverted. This is necessary when the change blocks other developers from making |
| 233 | progress. The developer is welcome to re-commit the change after the problem has |
| 234 | been fixed. |
| 235 | |
| Renato Golin | dabbaca | 2015-03-15 21:15:48 +0000 | [diff] [blame] | 236 | .. _commit messages: |
| 237 | |
| 238 | Commit messages |
| 239 | --------------- |
| 240 | |
| 241 | Although we don't enforce the format of commit messages, we prefer that |
| 242 | you follow these guidelines to help review, search in logs, email formatting |
| 243 | and so on. These guidelines are very similar to rules used by other open source |
| 244 | projects. |
| 245 | |
| 246 | Most importantly, the contents of the message should be carefully written to |
| 247 | convey the rationale of the change (without delving too much in detail). It |
| 248 | also should avoid being vague or overly specific. For example, "bits were not |
| 249 | set right" will leave the reviewer wondering about which bits, and why they |
| 250 | weren't right, while "Correctly set overflow bits in TargetInfo" conveys almost |
| 251 | all there is to the change. |
| 252 | |
| 253 | Below are some guidelines about the format of the message itself: |
| 254 | |
| Daniel Sanders | a5230ac | 2020-01-09 10:32:32 -0800 | [diff] [blame] | 255 | * Separate the commit message into title and body separated by a blank line. |
| 256 | |
| 257 | * If you're not the original author, ensure the 'Author' property of the commit is |
| 258 | set to the original author and the 'Committer' property is set to yourself. |
| 259 | You can use a command similar to |
| 260 | ``git commit --amend --author="John Doe <jdoe@llvm.org>`` to correct the |
| 261 | author property if it is incorrect. See `Attribution of Changes`_ for more |
| 262 | information including the method we used for attribution before the project |
| 263 | migrated to git. |
| Renato Golin | dabbaca | 2015-03-15 21:15:48 +0000 | [diff] [blame] | 264 | |
| 265 | * The title should be concise. Because all commits are emailed to the list with |
| 266 | the first line as the subject, long titles are frowned upon. Short titles |
| 267 | also look better in `git log`. |
| 268 | |
| 269 | * When the changes are restricted to a specific part of the code (e.g. a |
| 270 | back-end or optimization pass), it is customary to add a tag to the |
| 271 | beginning of the line in square brackets. For example, "[SCEV] ..." |
| 272 | or "[OpenMP] ...". This helps email filters and searches for post-commit |
| 273 | reviews. |
| 274 | |
| 275 | * The body, if it exists, should be separated from the title by an empty line. |
| 276 | |
| 277 | * The body should be concise, but explanatory, including a complete |
| 278 | reasoning. Unless it is required to understand the change, examples, |
| 279 | code snippets and gory details should be left to bug comments, web |
| 280 | review or the mailing list. |
| 281 | |
| 282 | * If the patch fixes a bug in bugzilla, please include the PR# in the message. |
| 283 | |
| Renato Golin | dabbaca | 2015-03-15 21:15:48 +0000 | [diff] [blame] | 284 | * Text formatting and spelling should follow the same rules as documentation |
| 285 | and in-code comments, ex. capitalization, full stop, etc. |
| 286 | |
| Nick Lewycky | ffc2009 | 2015-05-14 23:21:33 +0000 | [diff] [blame] | 287 | * If the commit is a bug fix on top of another recently committed patch, or a |
| Jinsong Ji | baf3a53 | 2020-02-12 21:07:40 +0000 | [diff] [blame] | 288 | revert or reapply of a patch, include the git commit hash of the prior |
| 289 | related commit. This could be as simple as "Revert commit NNNN because it |
| 290 | caused PR#". |
| Nick Lewycky | ffc2009 | 2015-05-14 23:21:33 +0000 | [diff] [blame] | 291 | |
| Renato Golin | dabbaca | 2015-03-15 21:15:48 +0000 | [diff] [blame] | 292 | For minor violations of these recommendations, the community normally favors |
| 293 | reminding the contributor of this policy over reverting. Minor corrections and |
| 294 | omissions can be handled by sending a reply to the commits mailing list. |
| 295 | |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 296 | Obtaining Commit Access |
| 297 | ----------------------- |
| 298 | |
| Tom Stellard | 27bfee0 | 2019-10-24 15:46:08 -0700 | [diff] [blame] | 299 | New Contributors |
| 300 | ^^^^^^^^^^^^^^^^ |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 301 | We grant commit access to contributors with a track record of submitting high |
| 302 | quality patches. If you would like commit access, please send an email to |
| Tom Stellard | 27bfee0 | 2019-10-24 15:46:08 -0700 | [diff] [blame] | 303 | `Chris <mailto:clattner@llvm.org>`_ with your GitHub username. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 304 | |
| Daniel Sanders | a5230ac | 2020-01-09 10:32:32 -0800 | [diff] [blame] | 305 | Prior to obtaining commit access, it is common practice to request that |
| 306 | someone with commit access commits on your behalf. When doing so, please |
| 307 | provide the name and email address you would like to use in the Author |
| 308 | property of the commit. |
| 309 | |
| Tom Stellard | 27bfee0 | 2019-10-24 15:46:08 -0700 | [diff] [blame] | 310 | Your first commit to a repository may require the autogenerated email to be |
| 311 | approved by a moderator of the mailing list. |
| Sylvestre Ledru | 439c29f | 2018-09-20 07:43:24 +0000 | [diff] [blame] | 312 | This is normal and will be done when the mailing list owner has time. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 313 | |
| 314 | If you have recently been granted commit access, these policies apply: |
| 315 | |
| Hal Finkel | 4d0339a | 2019-12-26 21:56:26 +0000 | [diff] [blame] | 316 | #. You are granted *commit-after-approval* to all parts of LLVM. For |
| 317 | information on how to get approval for a patch, please see :doc:`CodeReview`. |
| 318 | When approved, you may commit it yourself. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 319 | |
| 320 | #. You are allowed to commit patches without approval which you think are |
| 321 | obvious. This is clearly a subjective decision --- we simply expect you to |
| 322 | use good judgement. Examples include: fixing build breakage, reverting |
| 323 | obviously broken patches, documentation/comment changes, any other minor |
| Aaron Ballman | cd27070 | 2018-08-10 17:26:07 +0000 | [diff] [blame] | 324 | changes. Avoid committing formatting- or whitespace-only changes outside of |
| 325 | code you plan to make subsequent changes to. Also, try to separate |
| 326 | formatting or whitespace changes from functional changes, either by |
| 327 | correcting the format first (ideally) or afterward. Such changes should be |
| 328 | highly localized and the commit message should clearly state that the commit |
| 329 | is not intended to change functionality, usually by stating it is |
| 330 | :ref:`NFC <nfc>`. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 331 | |
| 332 | #. You are allowed to commit patches without approval to those portions of LLVM |
| 333 | that you have contributed or maintain (i.e., have been assigned |
| 334 | responsibility for), with the proviso that such commits must not break the |
| John Criswell | 02fc72d | 2013-04-15 17:38:06 +0000 | [diff] [blame] | 335 | build. This is a "trust but verify" policy, and commits of this nature are |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 336 | reviewed after they are committed. |
| 337 | |
| 338 | #. Multiple violations of these policies or a single egregious violation may |
| 339 | cause commit access to be revoked. |
| 340 | |
| 341 | In any case, your changes are still subject to `code review`_ (either before or |
| 342 | after they are committed, depending on the nature of the change). You are |
| 343 | encouraged to review other peoples' patches as well, but you aren't required |
| John Criswell | 02fc72d | 2013-04-15 17:38:06 +0000 | [diff] [blame] | 344 | to do so. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 345 | |
| Kazuaki Ishizaki | f65d4aa | 2020-01-22 11:30:57 +0800 | [diff] [blame] | 346 | Current Contributors - Transferring from SVN |
| 347 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| Tom Stellard | 27bfee0 | 2019-10-24 15:46:08 -0700 | [diff] [blame] | 348 | If you had commit access to SVN and would like to request commit access to |
| 349 | GitHub, please email `llvm-admin <mailto:llvm-admin@lists.llvm.org>`_ with your |
| 350 | SVN username and GitHub username. |
| 351 | |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 352 | .. _discuss the change/gather consensus: |
| 353 | |
| 354 | Making a Major Change |
| 355 | --------------------- |
| 356 | |
| 357 | When a developer begins a major new project with the aim of contributing it back |
| Tanya Lattner | 0d28f80 | 2015-08-05 03:51:17 +0000 | [diff] [blame] | 358 | to LLVM, they should inform the community with an email to the `llvm-dev |
| 359 | <http://lists.llvm.org/mailman/listinfo/llvm-dev>`_ email list, to the extent |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 360 | possible. The reason for this is to: |
| 361 | |
| 362 | #. keep the community informed about future changes to LLVM, |
| 363 | |
| 364 | #. avoid duplication of effort by preventing multiple parties working on the |
| 365 | same thing and not knowing about it, and |
| 366 | |
| 367 | #. ensure that any technical issues around the proposed work are discussed and |
| 368 | resolved before any significant work is done. |
| 369 | |
| 370 | The design of LLVM is carefully controlled to ensure that all the pieces fit |
| 371 | together well and are as consistent as possible. If you plan to make a major |
| 372 | change to the way LLVM works or want to add a major new extension, it is a good |
| 373 | idea to get consensus with the development community before you start working on |
| 374 | it. |
| 375 | |
| 376 | Once the design of the new feature is finalized, the work itself should be done |
| 377 | as a series of `incremental changes`_, not as a long-term development branch. |
| 378 | |
| 379 | .. _incremental changes: |
| 380 | |
| 381 | Incremental Development |
| 382 | ----------------------- |
| 383 | |
| 384 | In the LLVM project, we do all significant changes as a series of incremental |
| 385 | patches. We have a strong dislike for huge changes or long-term development |
| 386 | branches. Long-term development branches have a number of drawbacks: |
| 387 | |
| 388 | #. Branches must have mainline merged into them periodically. If the branch |
| 389 | development and mainline development occur in the same pieces of code, |
| 390 | resolving merge conflicts can take a lot of time. |
| 391 | |
| 392 | #. Other people in the community tend to ignore work on branches. |
| 393 | |
| 394 | #. Huge changes (produced when a branch is merged back onto mainline) are |
| 395 | extremely difficult to `code review`_. |
| 396 | |
| 397 | #. Branches are not routinely tested by our nightly tester infrastructure. |
| 398 | |
| 399 | #. Changes developed as monolithic large changes often don't work until the |
| 400 | entire set of changes is done. Breaking it down into a set of smaller |
| 401 | changes increases the odds that any of the work will be committed to the main |
| 402 | repository. |
| 403 | |
| 404 | To address these problems, LLVM uses an incremental development style and we |
| 405 | require contributors to follow this practice when making a large/invasive |
| 406 | change. Some tips: |
| 407 | |
| 408 | * Large/invasive changes usually have a number of secondary changes that are |
| 409 | required before the big change can be made (e.g. API cleanup, etc). These |
| 410 | sorts of changes can often be done before the major change is done, |
| 411 | independently of that work. |
| 412 | |
| 413 | * The remaining inter-related work should be decomposed into unrelated sets of |
| 414 | changes if possible. Once this is done, define the first increment and get |
| 415 | consensus on what the end goal of the change is. |
| 416 | |
| 417 | * Each change in the set can be stand alone (e.g. to fix a bug), or part of a |
| 418 | planned series of changes that works towards the development goal. |
| 419 | |
| 420 | * Each change should be kept as small as possible. This simplifies your work |
| 421 | (into a logical progression), simplifies code review and reduces the chance |
| 422 | that you will get negative feedback on the change. Small increments also |
| 423 | facilitate the maintenance of a high quality code base. |
| 424 | |
| 425 | * Often, an independent precursor to a big change is to add a new API and slowly |
| 426 | migrate clients to use the new API. Each change to use the new API is often |
| 427 | "obvious" and can be committed without review. Once the new API is in place |
| 428 | and used, it is much easier to replace the underlying implementation of the |
| 429 | API. This implementation change is logically separate from the API |
| 430 | change. |
| 431 | |
| 432 | If you are interested in making a large change, and this scares you, please make |
| 433 | sure to first `discuss the change/gather consensus`_ then ask about the best way |
| 434 | to go about making the change. |
| 435 | |
| 436 | Attribution of Changes |
| 437 | ---------------------- |
| 438 | |
| Chandler Carruth | 85dac69 | 2014-01-10 00:08:34 +0000 | [diff] [blame] | 439 | When contributors submit a patch to an LLVM project, other developers with |
| 440 | commit access may commit it for the author once appropriate (based on the |
| 441 | progression of code review, etc.). When doing so, it is important to retain |
| 442 | correct attribution of contributions to their contributors. However, we do not |
| 443 | want the source code to be littered with random attributions "this code written |
| 444 | by J. Random Hacker" (this is noisy and distracting). In practice, the revision |
| 445 | control system keeps a perfect history of who changed what, and the CREDITS.txt |
| 446 | file describes higher-level contributions. If you commit a patch for someone |
| Renato Golin | dabbaca | 2015-03-15 21:15:48 +0000 | [diff] [blame] | 447 | else, please follow the attribution of changes in the simple manner as outlined |
| 448 | by the `commit messages`_ section. Overall, please do not add contributor names |
| 449 | to the source code. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 450 | |
| Chandler Carruth | 85dac69 | 2014-01-10 00:08:34 +0000 | [diff] [blame] | 451 | Also, don't commit patches authored by others unless they have submitted the |
| 452 | patch to the project or you have been authorized to submit them on their behalf |
| 453 | (you work together and your company authorized you to contribute the patches, |
| 454 | etc.). The author should first submit them to the relevant project's commit |
| 455 | list, development list, or LLVM bug tracker component. If someone sends you |
| 456 | a patch privately, encourage them to submit it to the appropriate list first. |
| 457 | |
| Daniel Sanders | a5230ac | 2020-01-09 10:32:32 -0800 | [diff] [blame] | 458 | Our previous version control system (subversion) did not distinguish between the |
| 459 | author and the committer like git does. As such, older commits used a different |
| 460 | attribution mechanism. The previous method was to include "Patch by John Doe." |
| 461 | in a separate line of the commit message and there are automated processes that |
| 462 | rely on this format. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 463 | |
| Renato Golin | 891a49c | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 464 | .. _IR backwards compatibility: |
| 465 | |
| Rafael Espindola | 8d5432c | 2014-07-23 22:43:22 +0000 | [diff] [blame] | 466 | IR Backwards Compatibility |
| 467 | -------------------------- |
| 468 | |
| 469 | When the IR format has to be changed, keep in mind that we try to maintain some |
| 470 | backwards compatibility. The rules are intended as a balance between convenience |
| 471 | for llvm users and not imposing a big burden on llvm developers: |
| 472 | |
| 473 | * The textual format is not backwards compatible. We don't change it too often, |
| 474 | but there are no specific promises. |
| 475 | |
| Duncan P. N. Exon Smith | 375fa13 | 2015-07-31 20:44:32 +0000 | [diff] [blame] | 476 | * Additions and changes to the IR should be reflected in |
| 477 | ``test/Bitcode/compatibility.ll``. |
| 478 | |
| Hans Wennborg | c714d7c | 2016-07-18 17:51:04 +0000 | [diff] [blame] | 479 | * The current LLVM version supports loading any bitcode since version 3.0. |
| Sean Silva | 6cdd2fe | 2015-08-06 22:03:54 +0000 | [diff] [blame] | 480 | |
| 481 | * After each X.Y release, ``compatibility.ll`` must be copied to |
| 482 | ``compatibility-X.Y.ll``. The corresponding bitcode file should be assembled |
| 483 | using the X.Y build and committed as ``compatibility-X.Y.ll.bc``. |
| Rafael Espindola | 8d5432c | 2014-07-23 22:43:22 +0000 | [diff] [blame] | 484 | |
| 485 | * Newer releases can ignore features from older releases, but they cannot |
| 486 | miscompile them. For example, if nsw is ever replaced with something else, |
| 487 | dropping it would be a valid way to upgrade the IR. |
| 488 | |
| 489 | * Debug metadata is special in that it is currently dropped during upgrades. |
| 490 | |
| 491 | * Non-debug metadata is defined to be safe to drop, so a valid way to upgrade |
| 492 | it is to drop it. That is not very user friendly and a bit more effort is |
| 493 | expected, but no promises are made. |
| 494 | |
| Eric Christopher | d9f8ce9 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 495 | C API Changes |
| 496 | ---------------- |
| 497 | |
| Eric Christopher | b5c2b8d | 2015-12-10 21:38:56 +0000 | [diff] [blame] | 498 | * Stability Guarantees: The C API is, in general, a "best effort" for stability. |
| Eric Christopher | 2ec6a49 | 2015-12-10 22:04:11 +0000 | [diff] [blame] | 499 | This means that we make every attempt to keep the C API stable, but that |
| 500 | stability will be limited by the abstractness of the interface and the |
| 501 | stability of the C++ API that it wraps. In practice, this means that things |
| 502 | like "create debug info" or "create this type of instruction" are likely to be |
| 503 | less stable than "take this IR file and JIT it for my current machine". |
| Eric Christopher | d9f8ce9 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 504 | |
| Eric Christopher | df2e4d2 | 2015-12-10 21:47:38 +0000 | [diff] [blame] | 505 | * Release stability: We won't break the C API on the release branch with patches |
| Eric Christopher | 5e834a5 | 2015-12-11 00:51:59 +0000 | [diff] [blame] | 506 | that go on that branch, with the exception that we will fix an unintentional |
| Eric Christopher | 2ec6a49 | 2015-12-10 22:04:11 +0000 | [diff] [blame] | 507 | C API break that will keep the release consistent with both the previous and |
| 508 | next release. |
| Eric Christopher | d9f8ce9 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 509 | |
| 510 | * Testing: Patches to the C API are expected to come with tests just like any |
| Eric Christopher | 2ec6a49 | 2015-12-10 22:04:11 +0000 | [diff] [blame] | 511 | other patch. |
| Eric Christopher | d9f8ce9 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 512 | |
| 513 | * Including new things into the API: If an LLVM subcomponent has a C API already |
| Eric Christopher | 2ec6a49 | 2015-12-10 22:04:11 +0000 | [diff] [blame] | 514 | included, then expanding that C API is acceptable. Adding C API for |
| Eric Christopher | 86e031a | 2015-12-10 22:29:26 +0000 | [diff] [blame] | 515 | subcomponents that don't currently have one needs to be discussed on the |
| 516 | mailing list for design and maintainability feedback prior to implementation. |
| Eric Christopher | d9f8ce9 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 517 | |
| 518 | * Documentation: Any changes to the C API are required to be documented in the |
| Eric Christopher | 2ec6a49 | 2015-12-10 22:04:11 +0000 | [diff] [blame] | 519 | release notes so that it's clear to external users who do not follow the |
| 520 | project how the C API is changing and evolving. |
| Eric Christopher | d9f8ce9 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 521 | |
| Renato Golin | 891a49c | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 522 | New Targets |
| 523 | ----------- |
| 524 | |
| 525 | LLVM is very receptive to new targets, even experimental ones, but a number of |
| 526 | problems can appear when adding new large portions of code, and back-ends are |
| Chris Lattner | a5e039c4 | 2016-08-17 22:17:03 +0000 | [diff] [blame] | 527 | normally added in bulk. We have found that landing large pieces of new code |
| 528 | and then trying to fix emergent problems in-tree is problematic for a variety |
| 529 | of reasons. |
| Renato Golin | 891a49c | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 530 | |
| 531 | For these reasons, new targets are *always* added as *experimental* until |
| James Henderson | 4e1c49c | 2020-02-13 10:21:55 +0000 | [diff] [blame] | 532 | they can be proven stable, and later moved to non-experimental. The differences |
| 533 | between both classes are: |
| 534 | |
| 535 | * Experimental targets are not built by default (they need to be explicitly |
| 536 | enabled at CMake time). |
| 537 | |
| 538 | * Test failures, bugs, and build breakages that only appear when the |
| 539 | experimental target is enabled, caused by changes unrelated to the target, are |
| 540 | the responsibility of the community behind the target to fix. |
| Renato Golin | 891a49c | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 541 | |
| Chris Lattner | a5e039c4 | 2016-08-17 22:17:03 +0000 | [diff] [blame] | 542 | The basic rules for a back-end to be upstreamed in **experimental** mode are: |
| Renato Golin | 891a49c | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 543 | |
| 544 | * Every target must have a :ref:`code owner<code owners>`. The `CODE_OWNERS.TXT` |
| 545 | file has to be updated as part of the first merge. The code owner makes sure |
| 546 | that changes to the target get reviewed and steers the overall effort. |
| 547 | |
| 548 | * There must be an active community behind the target. This community |
| Chris Lattner | a5e039c4 | 2016-08-17 22:17:03 +0000 | [diff] [blame] | 549 | will help maintain the target by providing buildbots, fixing |
| Renato Golin | 891a49c | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 550 | bugs, answering the LLVM community's questions and making sure the new |
| 551 | target doesn't break any of the other targets, or generic code. This |
| 552 | behavior is expected to continue throughout the lifetime of the |
| 553 | target's code. |
| 554 | |
| 555 | * The code must be free of contentious issues, for example, large |
| 556 | changes in how the IR behaves or should be formed by the front-ends, |
| 557 | unless agreed by the majority of the community via refactoring of the |
| 558 | (:doc:`IR standard<LangRef>`) **before** the merge of the new target changes, |
| 559 | following the :ref:`IR backwards compatibility`. |
| 560 | |
| 561 | * The code conforms to all of the policies laid out in this developer policy |
| 562 | document, including license, patent, and coding standards. |
| 563 | |
| 564 | * The target should have either reasonable documentation on how it |
| 565 | works (ISA, ABI, etc.) or a publicly available simulator/hardware |
| Chris Lattner | a5e039c4 | 2016-08-17 22:17:03 +0000 | [diff] [blame] | 566 | (either free or cheap enough) - preferably both. This allows |
| 567 | developers to validate assumptions, understand constraints and review code |
| 568 | that can affect the target. |
| Renato Golin | 891a49c | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 569 | |
| Chris Lattner | a5e039c4 | 2016-08-17 22:17:03 +0000 | [diff] [blame] | 570 | In addition, the rules for a back-end to be promoted to **official** are: |
| Renato Golin | 891a49c | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 571 | |
| 572 | * The target must have addressed every other minimum requirement and |
| 573 | have been stable in tree for at least 3 months. This cool down |
| 574 | period is to make sure that the back-end and the target community can |
| 575 | endure continuous upstream development for the foreseeable future. |
| 576 | |
| 577 | * The target's code must have been completely adapted to this policy |
| 578 | as well as the :doc:`coding standards<CodingStandards>`. Any exceptions that |
| 579 | were made to move into experimental mode must have been fixed **before** |
| 580 | becoming official. |
| 581 | |
| 582 | * The test coverage needs to be broad and well written (small tests, |
| 583 | well documented). The build target ``check-all`` must pass with the |
| 584 | new target built, and where applicable, the ``test-suite`` must also |
| 585 | pass without errors, in at least one configuration (publicly |
| 586 | demonstrated, for example, via buildbots). |
| 587 | |
| 588 | * Public buildbots need to be created and actively maintained, unless |
| 589 | the target requires no additional buildbots (ex. ``check-all`` covers |
| 590 | all tests). The more relevant and public the new target's CI infrastructure |
| 591 | is, the more the LLVM community will embrace it. |
| 592 | |
| 593 | To **continue** as a supported and official target: |
| 594 | |
| 595 | * The maintainer(s) must continue following these rules throughout the lifetime |
| 596 | of the target. Continuous violations of aforementioned rules and policies |
| 597 | could lead to complete removal of the target from the code base. |
| 598 | |
| 599 | * Degradation in support, documentation or test coverage will make the target as |
| 600 | nuisance to other targets and be considered a candidate for deprecation and |
| 601 | ultimately removed. |
| 602 | |
| 603 | In essences, these rules are necessary for targets to gain and retain their |
| 604 | status, but also markers to define bit-rot, and will be used to clean up the |
| 605 | tree from unmaintained targets. |
| 606 | |
| JF Bastien | 6e69db5 | 2019-01-21 23:53:52 +0000 | [diff] [blame] | 607 | .. _toolchain: |
| 608 | |
| 609 | Updating Toolchain Requirements |
| 610 | ------------------------------- |
| 611 | |
| 612 | We intend to require newer toolchains as time goes by. This means LLVM's |
| 613 | codebase can use newer versions of C++ as they get standardized. Requiring newer |
| 614 | toolchains to build LLVM can be painful for those building LLVM; therefore, it |
| 615 | will only be done through the following process: |
| 616 | |
| 617 | * Generally, try to support LLVM and GCC versions from the last 3 years at a |
| 618 | minimum. This time-based guideline is not strict: we may support much older |
| 619 | compilers, or decide to support fewer versions. |
| 620 | |
| 621 | * An RFC is sent to the `llvm-dev mailing list <http://lists.llvm.org/mailman/listinfo/llvm-dev>`_ |
| 622 | |
| 623 | - Detail upsides of the version increase (e.g. which newer C++ language or |
| 624 | library features LLVM should use; avoid miscompiles in particular compiler |
| 625 | versions, etc). |
| 626 | - Detail downsides on important platforms (e.g. Ubuntu LTS status). |
| 627 | |
| 628 | * Once the RFC reaches consensus, update the CMake toolchain version checks as |
| 629 | well as the :doc:`getting started<GettingStarted>` guide. We want to |
| 630 | soft-error when developers compile LLVM. We say "soft-error" because the |
| 631 | error can be turned into a warning using a CMake flag. This is an important |
| 632 | step: LLVM still doesn't have code which requires the new toolchains, but it |
| 633 | soon will. If you compile LLVM but don't read the mailing list, we should |
| 634 | tell you! |
| 635 | |
| 636 | * Ensure that at least one LLVM release has had this soft-error. Not all |
| 637 | developers compile LLVM top-of-tree. These release-bound developers should |
| 638 | also be told about upcoming changes. |
| 639 | |
| 640 | * Turn the soft-error into a hard-error after said LLVM release has branched. |
| 641 | |
| 642 | * Update the :doc:`coding standards<CodingStandards>` to allow the new |
| 643 | features we've explicitly approved in the RFC. |
| 644 | |
| 645 | * Start using the new features in LLVM's codebase. |
| 646 | |
| JF Bastien | d5dbe83 | 2019-01-31 23:18:11 +0000 | [diff] [blame] | 647 | Here's a `sample RFC |
| 648 | <http://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html>`_ and the |
| 649 | `corresponding change <https://reviews.llvm.org/D57264>`_. |
| JF Bastien | 6e69db5 | 2019-01-21 23:53:52 +0000 | [diff] [blame] | 650 | |
| Dmitri Gribenko | 38782b8 | 2012-12-09 23:14:26 +0000 | [diff] [blame] | 651 | .. _copyright-license-patents: |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 652 | |
| 653 | Copyright, License, and Patents |
| 654 | =============================== |
| 655 | |
| 656 | .. note:: |
| 657 | |
| 658 | This section deals with legal matters but does not provide legal advice. We |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 659 | are not lawyers --- please seek legal counsel from a licensed attorney. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 660 | |
| 661 | This section addresses the issues of copyright, license and patents for the LLVM |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 662 | project. The copyright for the code is held by the contributors of |
| 663 | the code. The code is licensed under permissive `open source licensing terms`_, |
| 664 | namely the Apache 2 license, which includes a copyright and `patent license`_. |
| 665 | When you contribute code to the LLVM project, you license it under these terms. |
| 666 | |
| 667 | If you have questions or comments about these topics, please contact the |
| 668 | `LLVM Developer's Mailing List <mailto:llvm-dev@lists.llvm.org>`_. However, |
| 669 | please realize that most compiler developers are not lawyers, and therefore you |
| 670 | will not be getting official legal advice. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 671 | |
| 672 | Copyright |
| 673 | --------- |
| 674 | |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 675 | The LLVM project does not collect copyright assignments, which means that the |
| 676 | copyright for the code in the project is held by the respective contributors. |
| 677 | Because you (or your company) |
| 678 | retain ownership of the code you contribute, you know it may only be used under |
| 679 | the terms of the open source license you contributed it under: the license for |
| 680 | your contributions cannot be changed in the future without your approval. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 681 | |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 682 | Because the LLVM project does not require copyright assignments, changing the |
| 683 | LLVM license requires tracking down the |
| 684 | contributors to LLVM and getting them to agree that a license change is |
| 685 | acceptable for their contributions. We feel that a high burden for relicensing |
| 686 | is good for the project, because contributors do not have to fear that their |
| 687 | code will be used in a way with which they disagree. |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 688 | |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 689 | Relicensing |
| 690 | ----------- |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 691 | |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 692 | The last paragraph notwithstanding, the LLVM Project is in the middle of a large |
| 693 | effort to change licenses, which aims to solve several problems: |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 694 | |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 695 | * The old licenses made it difficult to move code from (e.g.) the compiler to |
| 696 | runtime libraries, because runtime libraries used a different license from the |
| 697 | rest of the compiler. |
| 698 | * Some contributions were not submitted to LLVM due to concerns that |
| 699 | the patent grant required by the project was overly broad. |
| 700 | * The patent grant was unique to the LLVM Project, not written by a lawyer, and |
| Richard Sandiford | ea36cdc | 2019-07-15 08:09:21 +0000 | [diff] [blame] | 701 | was difficult to determine what protection was provided (if any). |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 702 | |
| 703 | The scope of relicensing is all code that is considered part of the LLVM |
| 704 | project, including the main LLVM repository, runtime libraries (compiler_rt, |
| 705 | OpenMP, etc), Polly, and all other subprojects. There are a few exceptions: |
| 706 | |
| 707 | * Code imported from other projects (e.g. Google Test, Autoconf, etc) will |
| 708 | remain as it is. This code isn't developed as part of the LLVM project, it |
| 709 | is used by LLVM. |
| 710 | * Some subprojects are impractical or uninteresting to relicense (e.g. llvm-gcc |
| 711 | and dragonegg). These will be split off from the LLVM project (e.g. to |
| Kazuaki Ishizaki | f65d4aa | 2020-01-22 11:30:57 +0800 | [diff] [blame] | 712 | separate GitHub projects), allowing interested people to continue their |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 713 | development elsewhere. |
| 714 | |
| 715 | To relicense LLVM, we will be seeking approval from all of the copyright holders |
| 716 | of code in the repository, or potentially remove/rewrite code if we cannot. |
| 717 | This is a large |
| 718 | and challenging project which will take a significant amount of time to |
| 719 | complete. In the interim, **all contributions to the project will be made under |
| 720 | the terms of both the new license and the legacy license scheme** (each of which |
| 721 | is described below). The exception to this is the legacy patent grant, which |
| 722 | will not be required for new contributions. |
| 723 | |
| 724 | When all of the code in the project has been converted to the new license or |
| 725 | removed, we will drop the requirement to contribute under the legacy license. |
| 726 | This will achieve the goal of having |
| 727 | a single standardized license for the entire codebase. |
| 728 | |
| 729 | If you are a prior contributor to LLVM and have not done so already, please do |
| 730 | *TODO* to allow us to use your code. *Add a link to a separate page here, which |
| 731 | is probably a click through web form or something like that. Details to be |
| 732 | determined later*. |
| 733 | |
| 734 | |
| 735 | .. _open source licensing terms: |
| 736 | |
| 737 | New LLVM Project License Framework |
| 738 | ---------------------------------- |
| 739 | |
| 740 | Contributions to LLVM are licensed under the `Apache License, Version 2.0 |
| 741 | <https://www.apache.org/licenses/LICENSE-2.0>`_, with two limited |
| 742 | exceptions intended to ensure that LLVM is very permissively licensed. |
| 743 | Collectively, the name of this license is "Apache 2.0 License with LLVM |
| 744 | exceptions". The exceptions read: |
| 745 | |
| 746 | :: |
| 747 | |
| 748 | ---- LLVM Exceptions to the Apache 2.0 License ---- |
| 749 | |
| 750 | As an exception, if, as a result of your compiling your source code, portions |
| 751 | of this Software are embedded into an Object form of such source code, you |
| 752 | may redistribute such embedded portions in such Object form without complying |
| 753 | with the conditions of Sections 4(a), 4(b) and 4(d) of the License. |
| 754 | |
| 755 | In addition, if you combine or link compiled forms of this Software with |
| 756 | software that is licensed under the GPLv2 ("Combined Software") and if a |
| 757 | court of competent jurisdiction determines that the patent provision (Section |
| 758 | 3), the indemnity provision (Section 9) or other Section of the License |
| 759 | conflicts with the conditions of the GPLv2, you may retroactively and |
| 760 | prospectively choose to deem waived or otherwise exclude such Section(s) of |
| 761 | the License, but only in their entirety and only with respect to the Combined |
| 762 | Software. |
| 763 | |
| 764 | |
| 765 | We intend to keep LLVM perpetually open source and available under a permissive |
| 766 | license - this fosters the widest adoption of LLVM by |
| 767 | **allowing commercial products to be derived from LLVM** with few restrictions |
| 768 | and without a requirement for making any derived works also open source. In |
| 769 | particular, LLVM's license is not a "copyleft" license like the GPL. |
| 770 | |
| 771 | The "Apache 2.0 License with LLVM exceptions" allows you to: |
| 772 | |
| 773 | * freely download and use LLVM (in whole or in part) for personal, internal, or |
| 774 | commercial purposes. |
| 775 | * include LLVM in packages or distributions you create. |
| 776 | * combine LLVM with code licensed under every other major open source |
| 777 | license (including BSD, MIT, GPLv2, GPLv3...). |
| 778 | * make changes to LLVM code without being required to contribute it back |
| 779 | to the project - contributions are appreciated though! |
| 780 | |
| 781 | However, it imposes these limitations on you: |
| 782 | |
| 783 | * You must retain the copyright notice if you redistribute LLVM: You cannot |
| 784 | strip the copyright headers off or replace them with your own. |
| 785 | * Binaries that include LLVM must reproduce the copyright notice (e.g. in an |
| 786 | included README file or in an "About" box), unless the LLVM code was added as |
| 787 | a by-product of compilation. For example, if an LLVM runtime library like |
| 788 | compiler_rt or libc++ was automatically included into your application by the |
| 789 | compiler, you do not need to attribute it. |
| 790 | * You can't use our names to promote your products (LLVM derived or not) - |
| 791 | though you can make truthful statements about your use of the LLVM code, |
| 792 | without implying our sponsorship. |
| 793 | * There's no warranty on LLVM at all. |
| 794 | |
| 795 | We want LLVM code to be widely used, and believe that this provides a model that |
| 796 | is great for contributors and users of the project. For more information about |
| 797 | the Apache 2.0 License, please see the `Apache License FAQ |
| 798 | <http://www.apache.org/foundation/license-faq.html>`_, maintained by the |
| 799 | Apache Project. |
| 800 | |
| 801 | |
| 802 | .. note:: |
| 803 | |
| 804 | The LLVM Project includes some really old subprojects (dragonegg, |
| 805 | llvm-gcc-4.0, and llvm-gcc-4.2), which are licensed under **GPL |
| 806 | licenses**. This code is not actively maintained - it does not even |
| 807 | build successfully. This code is cleanly separated into distinct SVN |
| 808 | repositories from the rest of LLVM, and the LICENSE.txt files specifically |
| 809 | indicate that they contain GPL code. When LLVM transitions from SVN to Git, |
| 810 | we plan to drop these code bases from the new repository structure. |
| 811 | |
| 812 | |
| 813 | .. _patent license: |
| 814 | |
| 815 | Patents |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 816 | ------- |
| 817 | |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 818 | Section 3 of the Apache 2.0 license is a patent grant under which |
| 819 | contributors of code to the project contribute the rights to use any of |
| 820 | their patents that would otherwise be infringed by that code contribution |
| 821 | (protecting uses of that code). Further, the patent grant is revoked |
| 822 | from anyone who files a patent lawsuit about code in LLVM - this protects the |
| 823 | community by providing a "patent commons" for the code base and reducing the |
| 824 | odds of patent lawsuits in general. |
| 825 | |
| 826 | The license specifically scopes which patents are included with code |
| 827 | contributions. To help explain this, the `Apache License FAQ |
| 828 | <http://www.apache.org/foundation/license-faq.html>`_ explains this scope using |
| 829 | some questions and answers, which we reproduce here for your convenience (for |
| 830 | reference, the "ASF" is the Apache Software Foundation, the guidance still |
| 831 | holds though):: |
| 832 | |
| 833 | Q1: If I own a patent and contribute to a Work, and, at the time my |
| 834 | contribution is included in that Work, none of my patent's claims are subject |
| 835 | to Apache's Grant of Patent License, is there a way any of those claims would |
| 836 | later become subject to the Grant of Patent License solely due to subsequent |
| 837 | contributions by other parties who are not licensees of that patent. |
| 838 | |
| 839 | A1: No. |
| 840 | |
| 841 | Q2: If at any time after my contribution, I am able to license other patent |
| 842 | claims that would have been subject to Apache's Grant of Patent License if |
| Kazuaki Ishizaki | f65d4aa | 2020-01-22 11:30:57 +0800 | [diff] [blame] | 843 | they were licensable by me at the time of my contribution, do those other |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 844 | claims become subject to the Grant of Patent License? |
| 845 | |
| 846 | A2: Yes. |
| 847 | |
| 848 | Q3: If I own or control a licensable patent and contribute code to a specific |
| 849 | Apache product, which of my patent claims are subject to Apache's Grant of |
| 850 | Patent License? |
| 851 | |
| 852 | A3: The only patent claims that are licensed to the ASF are those you own or |
| 853 | have the right to license that read on your contribution or on the |
| 854 | combination of your contribution with the specific Apache product to which |
| 855 | you contributed as it existed at the time of your contribution. No additional |
| 856 | patent claims become licensed as a result of subsequent combinations of your |
| 857 | contribution with any other software. Note, however, that licensable patent |
| 858 | claims include those that you acquire in the future, as long as they read on |
| 859 | your original contribution as made at the original time. Once a patent claim |
| 860 | is subject to Apache's Grant of Patent License, it is licensed under the |
| 861 | terms of that Grant to the ASF and to recipients of any software distributed |
| 862 | by the ASF for any Apache software product whatsoever. |
| 863 | |
| Chandler Carruth | 4a1b95b | 2019-01-21 09:52:34 +0000 | [diff] [blame] | 864 | .. _legacy: |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 865 | |
| 866 | Legacy License Structure |
| 867 | ------------------------ |
| 868 | |
| 869 | .. note:: |
| 870 | The code base was previously licensed under the Terms described here. |
| 871 | We are in the middle of relicensing to a new approach (described above), but |
| 872 | until this effort is complete, the code is also still available under these |
| 873 | terms. Once we finish the relicensing project, new versions of the code will |
| 874 | not be available under these terms. However, nothing takes away your right |
| 875 | to use old versions under the licensing terms under which they were |
| 876 | originally released. |
| 877 | |
| 878 | We intend to keep LLVM perpetually open source and to use a permissive open |
| 879 | source license. The code in |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 880 | LLVM is available under the `University of Illinois/NCSA Open Source License |
| 881 | <http://www.opensource.org/licenses/UoI-NCSA.php>`_, which boils down to |
| 882 | this: |
| 883 | |
| 884 | * You can freely distribute LLVM. |
| 885 | * You must retain the copyright notice if you redistribute LLVM. |
| 886 | * Binaries derived from LLVM must reproduce the copyright notice (e.g. in an |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 887 | included README file). |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 888 | * You can't use our names to promote your LLVM derived products. |
| 889 | * There's no warranty on LLVM at all. |
| 890 | |
| 891 | We believe this fosters the widest adoption of LLVM because it **allows |
| 892 | commercial products to be derived from LLVM** with few restrictions and without |
| Chandler Carruth | 469bdef | 2019-01-19 06:14:24 +0000 | [diff] [blame] | 893 | a requirement for making any derived works also open source (i.e. LLVM's |
| Bill Wendling | f42595a | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 894 | license is not a "copyleft" license like the GPL). We suggest that you read the |
| 895 | `License <http://www.opensource.org/licenses/UoI-NCSA.php>`_ if further |
| 896 | clarification is needed. |
| 897 | |
| 898 | In addition to the UIUC license, the runtime library components of LLVM |
| 899 | (**compiler_rt, libc++, and libclc**) are also licensed under the `MIT License |
| 900 | <http://www.opensource.org/licenses/mit-license.php>`_, which does not contain |
| 901 | the binary redistribution clause. As a user of these runtime libraries, it |
| 902 | means that you can choose to use the code under either license (and thus don't |
| 903 | need the binary redistribution clause), and as a contributor to the code that |
| 904 | you agree that any contributions to these libraries be licensed under both |
| 905 | licenses. We feel that this is important for runtime libraries, because they |
| 906 | are implicitly linked into applications and therefore should not subject those |
| 907 | applications to the binary redistribution clause. This also means that it is ok |
| 908 | to move code from (e.g.) libc++ to the LLVM core without concern, but that code |
| 909 | cannot be moved from the LLVM core to libc++ without the copyright owner's |
| 910 | permission. |