Bill Wendling | bbc3be5 | 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 | |
Hans Wennborg | ef6469f | 2019-02-08 11:06:27 +0000 | [diff] [blame] | 25 | #. Keep the top of tree as stable as possible. |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 26 | |
Dmitri Gribenko | e17d858 | 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 | bbc3be5 | 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 | 377a984 | 2015-08-05 03:51:17 +0000 | [diff] [blame] | 33 | <http://lists.llvm.org/mailman/listinfo/llvm-commits>`_ and engaging another |
Bill Wendling | bbc3be5 | 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 | 377a984 | 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 | bbc3be5 | 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 | 377a984 | 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 | bbc3be5 | 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 | f93e288 | 2017-02-17 08:26:11 +0000 | [diff] [blame] | 65 | Bugzilla <https://bugs.llvm.org/>`_ and preferably subscribe to the `llvm-bugs |
Tanya Lattner | 377a984 | 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 | bbc3be5 | 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 | 46c6352 | 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 | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 74 | .. _patch: |
| 75 | .. _one-off patches: |
| 76 | |
Chandler Carruth | 36c48ca | 2014-01-10 00:08:34 +0000 | [diff] [blame] | 77 | Making and Submitting a Patch |
| 78 | ----------------------------- |
Bill Wendling | bbc3be5 | 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 | 8986b31 | 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 | bbc3be5 | 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 | 8986b31 | 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 | bbc3be5 | 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 | 36c48ca | 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 | bbc3be5 | 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 | 46c6352 | 2013-10-18 08:45:43 +0000 | [diff] [blame] | 115 | When submitting patches, please do not add confidentiality or non-disclosure |
| 116 | notices to the patches themselves. These notices conflict with the `LLVM |
| 117 | License`_ and may result in your contribution being excluded. |
| 118 | |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 119 | .. _code review: |
| 120 | |
| 121 | Code Reviews |
| 122 | ------------ |
| 123 | |
| 124 | LLVM has a code review policy. Code review is one way to increase the quality of |
| 125 | software. We generally follow these policies: |
| 126 | |
| 127 | #. All developers are required to have significant changes reviewed before they |
| 128 | are committed to the repository. |
| 129 | |
Chandler Carruth | 36c48ca | 2014-01-10 00:08:34 +0000 | [diff] [blame] | 130 | #. Code reviews are conducted by email on the relevant project's commit mailing |
| 131 | list, or alternatively on the project's development list or bug tracker. |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 132 | |
| 133 | #. Code can be reviewed either before it is committed or after. We expect major |
| 134 | changes to be reviewed before being committed, but smaller changes (or |
| 135 | changes where the developer owns the component) can be reviewed after commit. |
| 136 | |
| 137 | #. The developer responsible for a code change is also responsible for making |
| 138 | all necessary review-related changes. |
| 139 | |
| 140 | #. Code review can be an iterative process, which continues until the patch is |
Manuel Klimek | 4989188 | 2013-08-26 07:29:08 +0000 | [diff] [blame] | 141 | ready to be committed. Specifically, once a patch is sent out for review, it |
| 142 | needs an explicit "looks good" before it is submitted. Do not assume silent |
| 143 | approval, or request active objections to the patch with a deadline. |
| 144 | |
| 145 | Sometimes code reviews will take longer than you would hope for, especially for |
| 146 | larger features. Accepted ways to speed up review times for your patches are: |
| 147 | |
| 148 | * Review other people's patches. If you help out, everybody will be more |
| 149 | willing to do the same for you; goodwill is our currency. |
| 150 | * Ping the patch. If it is urgent, provide reasons why it is important to you to |
| 151 | get this patch landed and ping it every couple of days. If it is |
| 152 | not urgent, the common courtesy ping rate is one week. Remember that you're |
| 153 | asking for valuable time from other professional developers. |
| 154 | * Ask for help on IRC. Developers on IRC will be able to either help you |
| 155 | directly, or tell you who might be a good reviewer. |
| 156 | * Split your patch into multiple smaller patches that build on each other. The |
| 157 | smaller your patch, the higher the probability that somebody will take a quick |
| 158 | look at it. |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 159 | |
| 160 | Developers should participate in code reviews as both reviewers and |
| 161 | reviewees. If someone is kind enough to review your code, you should return the |
| 162 | favor for someone else. Note that anyone is welcome to review and give feedback |
| 163 | on a patch, but only people with Subversion write access can approve it. |
| 164 | |
Manuel Klimek | 81eb88f | 2012-10-11 19:40:46 +0000 | [diff] [blame] | 165 | There is a web based code review tool that can optionally be used |
Sean Silva | b92dfe0 | 2012-10-12 01:21:24 +0000 | [diff] [blame] | 166 | for code reviews. See :doc:`Phabricator`. |
Manuel Klimek | 81eb88f | 2012-10-11 19:40:46 +0000 | [diff] [blame] | 167 | |
Renato Golin | 302f15f | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 168 | .. _code owners: |
| 169 | |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 170 | Code Owners |
| 171 | ----------- |
| 172 | |
| 173 | The LLVM Project relies on two features of its process to maintain rapid |
| 174 | development in addition to the high quality of its source base: the combination |
| 175 | of code review plus post-commit review for trusted maintainers. Having both is |
| 176 | a great way for the project to take advantage of the fact that most people do |
| 177 | the right thing most of the time, and only commit patches without pre-commit |
| 178 | review when they are confident they are right. |
| 179 | |
| 180 | The trick to this is that the project has to guarantee that all patches that are |
| 181 | committed are reviewed after they go in: you don't want everyone to assume |
| 182 | someone else will review it, allowing the patch to go unreviewed. To solve this |
| 183 | problem, we have a notion of an 'owner' for a piece of the code. The sole |
| 184 | responsibility of a code owner is to ensure that a commit to their area of the |
Duncan Sands | 35b8760 | 2012-07-26 08:04:09 +0000 | [diff] [blame] | 185 | code is appropriately reviewed, either by themself or by someone else. The list |
James Y Knight | 8986b31 | 2019-01-14 22:27:32 +0000 | [diff] [blame] | 186 | of current code owners can be found in the file `CODE_OWNERS.TXT |
| 187 | <https://github.com/llvm/llvm-project/blob/master/llvm/CODE_OWNERS.TXT>`_ in the |
| 188 | root of the LLVM source tree. |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 189 | |
| 190 | Note that code ownership is completely different than reviewers: anyone can |
| 191 | review a piece of code, and we welcome code review from anyone who is |
| 192 | interested. Code owners are the "last line of defense" to guarantee that all |
| 193 | patches that are committed are actually reviewed. |
| 194 | |
| 195 | Being a code owner is a somewhat unglamorous position, but it is incredibly |
| 196 | important for the ongoing success of the project. Because people get busy, |
| 197 | interests change, and unexpected things happen, code ownership is purely opt-in, |
| 198 | and anyone can choose to resign their "title" at any time. For now, we do not |
| 199 | have an official policy on how one gets elected to be a code owner. |
| 200 | |
| 201 | .. _include a testcase: |
| 202 | |
| 203 | Test Cases |
| 204 | ---------- |
| 205 | |
| 206 | Developers are required to create test cases for any bugs fixed and any new |
| 207 | features added. Some tips for getting your testcase approved: |
| 208 | |
| 209 | * All feature and regression test cases are added to the ``llvm/test`` |
Sean Silva | ac99eed | 2012-11-14 21:09:30 +0000 | [diff] [blame] | 210 | directory. The appropriate sub-directory should be selected (see the |
| 211 | :doc:`Testing Guide <TestingGuide>` for details). |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 212 | |
Sean Silva | 7a8ca27 | 2014-02-19 00:12:34 +0000 | [diff] [blame] | 213 | * Test cases should be written in :doc:`LLVM assembly language <LangRef>`. |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 214 | |
| 215 | * Test cases, especially for regressions, should be reduced as much as possible, |
Sean Silva | 7a8ca27 | 2014-02-19 00:12:34 +0000 | [diff] [blame] | 216 | by :doc:`bugpoint <Bugpoint>` or manually. It is unacceptable to place an |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 217 | entire failing program into ``llvm/test`` as this creates a *time-to-test* |
| 218 | burden on all developers. Please keep them short. |
| 219 | |
| 220 | Note that llvm/test and clang/test are designed for regression and small feature |
| 221 | tests only. More extensive test cases (e.g., entire applications, benchmarks, |
| 222 | etc) should be added to the ``llvm-test`` test suite. The llvm-test suite is |
| 223 | for coverage (correctness, performance, etc) testing, not feature or regression |
| 224 | testing. |
| 225 | |
| 226 | Quality |
| 227 | ------- |
| 228 | |
| 229 | The minimum quality standards that any change must satisfy before being |
| 230 | committed to the main development branch are: |
| 231 | |
| 232 | #. Code must adhere to the `LLVM Coding Standards <CodingStandards.html>`_. |
| 233 | |
| 234 | #. Code must compile cleanly (no errors, no warnings) on at least one platform. |
| 235 | |
| 236 | #. Bug fixes and new features should `include a testcase`_ so we know if the |
| 237 | fix/feature ever regresses in the future. |
| 238 | |
| 239 | #. Code must pass the ``llvm/test`` test suite. |
| 240 | |
| 241 | #. The code must not cause regressions on a reasonable subset of llvm-test, |
| 242 | where "reasonable" depends on the contributor's judgement and the scope of |
| 243 | the change (more invasive changes require more testing). A reasonable subset |
| 244 | might be something like "``llvm-test/MultiSource/Benchmarks``". |
| 245 | |
| 246 | Additionally, the committer is responsible for addressing any problems found in |
| 247 | the future that the change is responsible for. For example: |
| 248 | |
| 249 | * The code should compile cleanly on all supported platforms. |
| 250 | |
| 251 | * The changes should not cause any correctness regressions in the ``llvm-test`` |
| 252 | suite and must not cause any major performance regressions. |
| 253 | |
| 254 | * The change set should not cause performance or correctness regressions for the |
| 255 | LLVM tools. |
| 256 | |
| 257 | * The changes should not cause performance or correctness regressions in code |
| 258 | compiled by LLVM on all applicable targets. |
| 259 | |
Ismail Donmez | f93e288 | 2017-02-17 08:26:11 +0000 | [diff] [blame] | 260 | * You are expected to address any `Bugzilla bugs <https://bugs.llvm.org/>`_ that |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 261 | result from your change. |
| 262 | |
| 263 | We prefer for this to be handled before submission but understand that it isn't |
| 264 | possible to test all of this for every submission. Our build bots and nightly |
| 265 | testing infrastructure normally finds these problems. A good rule of thumb is |
| 266 | to check the nightly testers for regressions the day after your change. Build |
| 267 | bots will directly email you if a group of commits that included yours caused a |
| 268 | failure. You are expected to check the build bot messages to see if they are |
| 269 | your fault and, if so, fix the breakage. |
| 270 | |
| 271 | Commits that violate these quality standards (e.g. are very broken) may be |
| 272 | reverted. This is necessary when the change blocks other developers from making |
| 273 | progress. The developer is welcome to re-commit the change after the problem has |
| 274 | been fixed. |
| 275 | |
Renato Golin | dca7882 | 2015-03-15 21:15:48 +0000 | [diff] [blame] | 276 | .. _commit messages: |
| 277 | |
| 278 | Commit messages |
| 279 | --------------- |
| 280 | |
| 281 | Although we don't enforce the format of commit messages, we prefer that |
| 282 | you follow these guidelines to help review, search in logs, email formatting |
| 283 | and so on. These guidelines are very similar to rules used by other open source |
| 284 | projects. |
| 285 | |
| 286 | Most importantly, the contents of the message should be carefully written to |
| 287 | convey the rationale of the change (without delving too much in detail). It |
| 288 | also should avoid being vague or overly specific. For example, "bits were not |
| 289 | set right" will leave the reviewer wondering about which bits, and why they |
| 290 | weren't right, while "Correctly set overflow bits in TargetInfo" conveys almost |
| 291 | all there is to the change. |
| 292 | |
| 293 | Below are some guidelines about the format of the message itself: |
| 294 | |
| 295 | * Separate the commit message into title, body and, if you're not the original |
| 296 | author, a "Patch by" attribution line (see below). |
| 297 | |
| 298 | * The title should be concise. Because all commits are emailed to the list with |
| 299 | the first line as the subject, long titles are frowned upon. Short titles |
| 300 | also look better in `git log`. |
| 301 | |
| 302 | * When the changes are restricted to a specific part of the code (e.g. a |
| 303 | back-end or optimization pass), it is customary to add a tag to the |
| 304 | beginning of the line in square brackets. For example, "[SCEV] ..." |
| 305 | or "[OpenMP] ...". This helps email filters and searches for post-commit |
| 306 | reviews. |
| 307 | |
| 308 | * The body, if it exists, should be separated from the title by an empty line. |
| 309 | |
| 310 | * The body should be concise, but explanatory, including a complete |
| 311 | reasoning. Unless it is required to understand the change, examples, |
| 312 | code snippets and gory details should be left to bug comments, web |
| 313 | review or the mailing list. |
| 314 | |
| 315 | * If the patch fixes a bug in bugzilla, please include the PR# in the message. |
| 316 | |
| 317 | * `Attribution of Changes`_ should be in a separate line, after the end of |
| 318 | the body, as simple as "Patch by John Doe.". This is how we officially |
| 319 | handle attribution, and there are automated processes that rely on this |
| 320 | format. |
| 321 | |
| 322 | * Text formatting and spelling should follow the same rules as documentation |
| 323 | and in-code comments, ex. capitalization, full stop, etc. |
| 324 | |
Nick Lewycky | 2b5899e | 2015-05-14 23:21:33 +0000 | [diff] [blame] | 325 | * If the commit is a bug fix on top of another recently committed patch, or a |
Justin Bogner | d0db0de | 2015-05-14 23:56:58 +0000 | [diff] [blame] | 326 | revert or reapply of a patch, include the svn revision number of the prior |
| 327 | related commit. This could be as simple as "Revert rNNNN because it caused |
| 328 | PR#". |
Nick Lewycky | 2b5899e | 2015-05-14 23:21:33 +0000 | [diff] [blame] | 329 | |
Renato Golin | dca7882 | 2015-03-15 21:15:48 +0000 | [diff] [blame] | 330 | For minor violations of these recommendations, the community normally favors |
| 331 | reminding the contributor of this policy over reverting. Minor corrections and |
| 332 | omissions can be handled by sending a reply to the commits mailing list. |
| 333 | |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 334 | Obtaining Commit Access |
| 335 | ----------------------- |
| 336 | |
| 337 | We grant commit access to contributors with a track record of submitting high |
| 338 | quality patches. If you would like commit access, please send an email to |
Chris Lattner | bac9cdf | 2016-06-23 16:29:22 +0000 | [diff] [blame] | 339 | `Chris <mailto:clattner@llvm.org>`_ with the following information: |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 340 | |
| 341 | #. The user name you want to commit with, e.g. "hacker". |
| 342 | |
| 343 | #. The full name and email address you want message to llvm-commits to come |
| 344 | from, e.g. "J. Random Hacker <hacker@yoyodyne.com>". |
| 345 | |
| 346 | #. A "password hash" of the password you want to use, e.g. "``2ACR96qjUqsyM``". |
John Criswell | 24dcc20 | 2013-04-15 17:38:06 +0000 | [diff] [blame] | 347 | Note that you don't ever tell us what your password is; you just give it to |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 348 | us in an encrypted form. To get this, run "``htpasswd``" (a utility that |
Chris Lattner | c8eaae6 | 2016-05-11 03:47:36 +0000 | [diff] [blame] | 349 | comes with apache) in *crypt* mode (often enabled with "``-d``"), or find a web |
| 350 | page that will do it for you. Note that our system does not work with MD5 |
| 351 | hashes. These are significantly longer than a crypt hash - e.g. |
Chris Lattner | ba1a49d | 2016-07-14 02:52:04 +0000 | [diff] [blame] | 352 | "``$apr1$vea6bBV2$Z8IFx.AfeD8LhqlZFqJer0``", we only accept the shorter crypt hash. |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 353 | |
| 354 | Once you've been granted commit access, you should be able to check out an LLVM |
| 355 | tree with an SVN URL of "https://username@llvm.org/..." instead of the normal |
| 356 | anonymous URL of "http://llvm.org/...". The first time you commit you'll have |
| 357 | to type in your password. Note that you may get a warning from SVN about an |
John Criswell | 24dcc20 | 2013-04-15 17:38:06 +0000 | [diff] [blame] | 358 | untrusted key; you can ignore this. To verify that your commit access works, |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 359 | please do a test commit (e.g. change a comment or add a blank line). Your first |
| 360 | commit to a repository may require the autogenerated email to be approved by a |
Sylvestre Ledru | 3f24abf | 2018-09-20 07:43:24 +0000 | [diff] [blame] | 361 | moderator of the mailing list. |
| 362 | This is normal and will be done when the mailing list owner has time. |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 363 | |
| 364 | If you have recently been granted commit access, these policies apply: |
| 365 | |
| 366 | #. You are granted *commit-after-approval* to all parts of LLVM. To get |
| 367 | approval, submit a `patch`_ to `llvm-commits |
Tanya Lattner | 377a984 | 2015-08-05 03:51:17 +0000 | [diff] [blame] | 368 | <http://lists.llvm.org/mailman/listinfo/llvm-commits>`_. When approved, |
Sean Silva | a177a51 | 2012-09-18 22:21:43 +0000 | [diff] [blame] | 369 | you may commit it yourself. |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 370 | |
| 371 | #. You are allowed to commit patches without approval which you think are |
| 372 | obvious. This is clearly a subjective decision --- we simply expect you to |
| 373 | use good judgement. Examples include: fixing build breakage, reverting |
| 374 | obviously broken patches, documentation/comment changes, any other minor |
Aaron Ballman | 5aaa820 | 2018-08-10 17:26:07 +0000 | [diff] [blame] | 375 | changes. Avoid committing formatting- or whitespace-only changes outside of |
| 376 | code you plan to make subsequent changes to. Also, try to separate |
| 377 | formatting or whitespace changes from functional changes, either by |
| 378 | correcting the format first (ideally) or afterward. Such changes should be |
| 379 | highly localized and the commit message should clearly state that the commit |
| 380 | is not intended to change functionality, usually by stating it is |
| 381 | :ref:`NFC <nfc>`. |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 382 | |
| 383 | #. You are allowed to commit patches without approval to those portions of LLVM |
| 384 | that you have contributed or maintain (i.e., have been assigned |
| 385 | responsibility for), with the proviso that such commits must not break the |
John Criswell | 24dcc20 | 2013-04-15 17:38:06 +0000 | [diff] [blame] | 386 | build. This is a "trust but verify" policy, and commits of this nature are |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 387 | reviewed after they are committed. |
| 388 | |
| 389 | #. Multiple violations of these policies or a single egregious violation may |
| 390 | cause commit access to be revoked. |
| 391 | |
| 392 | In any case, your changes are still subject to `code review`_ (either before or |
| 393 | after they are committed, depending on the nature of the change). You are |
| 394 | encouraged to review other peoples' patches as well, but you aren't required |
John Criswell | 24dcc20 | 2013-04-15 17:38:06 +0000 | [diff] [blame] | 395 | to do so. |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 396 | |
| 397 | .. _discuss the change/gather consensus: |
| 398 | |
| 399 | Making a Major Change |
| 400 | --------------------- |
| 401 | |
| 402 | When a developer begins a major new project with the aim of contributing it back |
Tanya Lattner | 377a984 | 2015-08-05 03:51:17 +0000 | [diff] [blame] | 403 | to LLVM, they should inform the community with an email to the `llvm-dev |
| 404 | <http://lists.llvm.org/mailman/listinfo/llvm-dev>`_ email list, to the extent |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 405 | possible. The reason for this is to: |
| 406 | |
| 407 | #. keep the community informed about future changes to LLVM, |
| 408 | |
| 409 | #. avoid duplication of effort by preventing multiple parties working on the |
| 410 | same thing and not knowing about it, and |
| 411 | |
| 412 | #. ensure that any technical issues around the proposed work are discussed and |
| 413 | resolved before any significant work is done. |
| 414 | |
| 415 | The design of LLVM is carefully controlled to ensure that all the pieces fit |
| 416 | together well and are as consistent as possible. If you plan to make a major |
| 417 | change to the way LLVM works or want to add a major new extension, it is a good |
| 418 | idea to get consensus with the development community before you start working on |
| 419 | it. |
| 420 | |
| 421 | Once the design of the new feature is finalized, the work itself should be done |
| 422 | as a series of `incremental changes`_, not as a long-term development branch. |
| 423 | |
| 424 | .. _incremental changes: |
| 425 | |
| 426 | Incremental Development |
| 427 | ----------------------- |
| 428 | |
| 429 | In the LLVM project, we do all significant changes as a series of incremental |
| 430 | patches. We have a strong dislike for huge changes or long-term development |
| 431 | branches. Long-term development branches have a number of drawbacks: |
| 432 | |
| 433 | #. Branches must have mainline merged into them periodically. If the branch |
| 434 | development and mainline development occur in the same pieces of code, |
| 435 | resolving merge conflicts can take a lot of time. |
| 436 | |
| 437 | #. Other people in the community tend to ignore work on branches. |
| 438 | |
| 439 | #. Huge changes (produced when a branch is merged back onto mainline) are |
| 440 | extremely difficult to `code review`_. |
| 441 | |
| 442 | #. Branches are not routinely tested by our nightly tester infrastructure. |
| 443 | |
| 444 | #. Changes developed as monolithic large changes often don't work until the |
| 445 | entire set of changes is done. Breaking it down into a set of smaller |
| 446 | changes increases the odds that any of the work will be committed to the main |
| 447 | repository. |
| 448 | |
| 449 | To address these problems, LLVM uses an incremental development style and we |
| 450 | require contributors to follow this practice when making a large/invasive |
| 451 | change. Some tips: |
| 452 | |
| 453 | * Large/invasive changes usually have a number of secondary changes that are |
| 454 | required before the big change can be made (e.g. API cleanup, etc). These |
| 455 | sorts of changes can often be done before the major change is done, |
| 456 | independently of that work. |
| 457 | |
| 458 | * The remaining inter-related work should be decomposed into unrelated sets of |
| 459 | changes if possible. Once this is done, define the first increment and get |
| 460 | consensus on what the end goal of the change is. |
| 461 | |
| 462 | * Each change in the set can be stand alone (e.g. to fix a bug), or part of a |
| 463 | planned series of changes that works towards the development goal. |
| 464 | |
| 465 | * Each change should be kept as small as possible. This simplifies your work |
| 466 | (into a logical progression), simplifies code review and reduces the chance |
| 467 | that you will get negative feedback on the change. Small increments also |
| 468 | facilitate the maintenance of a high quality code base. |
| 469 | |
| 470 | * Often, an independent precursor to a big change is to add a new API and slowly |
| 471 | migrate clients to use the new API. Each change to use the new API is often |
| 472 | "obvious" and can be committed without review. Once the new API is in place |
| 473 | and used, it is much easier to replace the underlying implementation of the |
| 474 | API. This implementation change is logically separate from the API |
| 475 | change. |
| 476 | |
| 477 | If you are interested in making a large change, and this scares you, please make |
| 478 | sure to first `discuss the change/gather consensus`_ then ask about the best way |
| 479 | to go about making the change. |
| 480 | |
| 481 | Attribution of Changes |
| 482 | ---------------------- |
| 483 | |
Chandler Carruth | 36c48ca | 2014-01-10 00:08:34 +0000 | [diff] [blame] | 484 | When contributors submit a patch to an LLVM project, other developers with |
| 485 | commit access may commit it for the author once appropriate (based on the |
| 486 | progression of code review, etc.). When doing so, it is important to retain |
| 487 | correct attribution of contributions to their contributors. However, we do not |
| 488 | want the source code to be littered with random attributions "this code written |
| 489 | by J. Random Hacker" (this is noisy and distracting). In practice, the revision |
| 490 | control system keeps a perfect history of who changed what, and the CREDITS.txt |
| 491 | file describes higher-level contributions. If you commit a patch for someone |
Renato Golin | dca7882 | 2015-03-15 21:15:48 +0000 | [diff] [blame] | 492 | else, please follow the attribution of changes in the simple manner as outlined |
| 493 | by the `commit messages`_ section. Overall, please do not add contributor names |
| 494 | to the source code. |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 495 | |
Chandler Carruth | 36c48ca | 2014-01-10 00:08:34 +0000 | [diff] [blame] | 496 | Also, don't commit patches authored by others unless they have submitted the |
| 497 | patch to the project or you have been authorized to submit them on their behalf |
| 498 | (you work together and your company authorized you to contribute the patches, |
| 499 | etc.). The author should first submit them to the relevant project's commit |
| 500 | list, development list, or LLVM bug tracker component. If someone sends you |
| 501 | a patch privately, encourage them to submit it to the appropriate list first. |
| 502 | |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 503 | |
Renato Golin | 302f15f | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 504 | .. _IR backwards compatibility: |
| 505 | |
Rafael Espindola | b74b954 | 2014-07-23 22:43:22 +0000 | [diff] [blame] | 506 | IR Backwards Compatibility |
| 507 | -------------------------- |
| 508 | |
| 509 | When the IR format has to be changed, keep in mind that we try to maintain some |
| 510 | backwards compatibility. The rules are intended as a balance between convenience |
| 511 | for llvm users and not imposing a big burden on llvm developers: |
| 512 | |
| 513 | * The textual format is not backwards compatible. We don't change it too often, |
| 514 | but there are no specific promises. |
| 515 | |
Duncan P. N. Exon Smith | 82e3e48 | 2015-07-31 20:44:32 +0000 | [diff] [blame] | 516 | * Additions and changes to the IR should be reflected in |
| 517 | ``test/Bitcode/compatibility.ll``. |
| 518 | |
Hans Wennborg | 5337a14 | 2016-07-18 17:51:04 +0000 | [diff] [blame] | 519 | * The current LLVM version supports loading any bitcode since version 3.0. |
Sean Silva | c169fa6 | 2015-08-06 22:03:54 +0000 | [diff] [blame] | 520 | |
| 521 | * After each X.Y release, ``compatibility.ll`` must be copied to |
| 522 | ``compatibility-X.Y.ll``. The corresponding bitcode file should be assembled |
| 523 | using the X.Y build and committed as ``compatibility-X.Y.ll.bc``. |
Rafael Espindola | b74b954 | 2014-07-23 22:43:22 +0000 | [diff] [blame] | 524 | |
| 525 | * Newer releases can ignore features from older releases, but they cannot |
| 526 | miscompile them. For example, if nsw is ever replaced with something else, |
| 527 | dropping it would be a valid way to upgrade the IR. |
| 528 | |
| 529 | * Debug metadata is special in that it is currently dropped during upgrades. |
| 530 | |
| 531 | * Non-debug metadata is defined to be safe to drop, so a valid way to upgrade |
| 532 | it is to drop it. That is not very user friendly and a bit more effort is |
| 533 | expected, but no promises are made. |
| 534 | |
Eric Christopher | 7a5bb66 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 535 | C API Changes |
| 536 | ---------------- |
| 537 | |
Eric Christopher | e4b6881 | 2015-12-10 21:38:56 +0000 | [diff] [blame] | 538 | * Stability Guarantees: The C API is, in general, a "best effort" for stability. |
Eric Christopher | 67b9896 | 2015-12-10 22:04:11 +0000 | [diff] [blame] | 539 | This means that we make every attempt to keep the C API stable, but that |
| 540 | stability will be limited by the abstractness of the interface and the |
| 541 | stability of the C++ API that it wraps. In practice, this means that things |
| 542 | like "create debug info" or "create this type of instruction" are likely to be |
| 543 | less stable than "take this IR file and JIT it for my current machine". |
Eric Christopher | 7a5bb66 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 544 | |
Eric Christopher | 7e0619a | 2015-12-10 21:47:38 +0000 | [diff] [blame] | 545 | * Release stability: We won't break the C API on the release branch with patches |
Eric Christopher | 3719f99 | 2015-12-11 00:51:59 +0000 | [diff] [blame] | 546 | that go on that branch, with the exception that we will fix an unintentional |
Eric Christopher | 67b9896 | 2015-12-10 22:04:11 +0000 | [diff] [blame] | 547 | C API break that will keep the release consistent with both the previous and |
| 548 | next release. |
Eric Christopher | 7a5bb66 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 549 | |
| 550 | * Testing: Patches to the C API are expected to come with tests just like any |
Eric Christopher | 67b9896 | 2015-12-10 22:04:11 +0000 | [diff] [blame] | 551 | other patch. |
Eric Christopher | 7a5bb66 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 552 | |
| 553 | * Including new things into the API: If an LLVM subcomponent has a C API already |
Eric Christopher | 67b9896 | 2015-12-10 22:04:11 +0000 | [diff] [blame] | 554 | included, then expanding that C API is acceptable. Adding C API for |
Eric Christopher | 337570a | 2015-12-10 22:29:26 +0000 | [diff] [blame] | 555 | subcomponents that don't currently have one needs to be discussed on the |
| 556 | mailing list for design and maintainability feedback prior to implementation. |
Eric Christopher | 7a5bb66 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 557 | |
| 558 | * Documentation: Any changes to the C API are required to be documented in the |
Eric Christopher | 67b9896 | 2015-12-10 22:04:11 +0000 | [diff] [blame] | 559 | release notes so that it's clear to external users who do not follow the |
| 560 | project how the C API is changing and evolving. |
Eric Christopher | 7a5bb66 | 2015-12-10 21:33:53 +0000 | [diff] [blame] | 561 | |
Renato Golin | 302f15f | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 562 | New Targets |
| 563 | ----------- |
| 564 | |
| 565 | LLVM is very receptive to new targets, even experimental ones, but a number of |
| 566 | problems can appear when adding new large portions of code, and back-ends are |
Chris Lattner | 915cd42 | 2016-08-17 22:17:03 +0000 | [diff] [blame] | 567 | normally added in bulk. We have found that landing large pieces of new code |
| 568 | and then trying to fix emergent problems in-tree is problematic for a variety |
| 569 | of reasons. |
Renato Golin | 302f15f | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 570 | |
| 571 | For these reasons, new targets are *always* added as *experimental* until |
Chris Lattner | 915cd42 | 2016-08-17 22:17:03 +0000 | [diff] [blame] | 572 | they can be proven stable, and later moved to non-experimental. The difference |
Renato Golin | 302f15f | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 573 | between both classes is that experimental targets are not built by default |
| 574 | (need to be added to -DLLVM_TARGETS_TO_BUILD at CMake time). |
| 575 | |
Chris Lattner | 915cd42 | 2016-08-17 22:17:03 +0000 | [diff] [blame] | 576 | The basic rules for a back-end to be upstreamed in **experimental** mode are: |
Renato Golin | 302f15f | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 577 | |
| 578 | * Every target must have a :ref:`code owner<code owners>`. The `CODE_OWNERS.TXT` |
| 579 | file has to be updated as part of the first merge. The code owner makes sure |
| 580 | that changes to the target get reviewed and steers the overall effort. |
| 581 | |
| 582 | * There must be an active community behind the target. This community |
Chris Lattner | 915cd42 | 2016-08-17 22:17:03 +0000 | [diff] [blame] | 583 | will help maintain the target by providing buildbots, fixing |
Renato Golin | 302f15f | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 584 | bugs, answering the LLVM community's questions and making sure the new |
| 585 | target doesn't break any of the other targets, or generic code. This |
| 586 | behavior is expected to continue throughout the lifetime of the |
| 587 | target's code. |
| 588 | |
| 589 | * The code must be free of contentious issues, for example, large |
| 590 | changes in how the IR behaves or should be formed by the front-ends, |
| 591 | unless agreed by the majority of the community via refactoring of the |
| 592 | (:doc:`IR standard<LangRef>`) **before** the merge of the new target changes, |
| 593 | following the :ref:`IR backwards compatibility`. |
| 594 | |
| 595 | * The code conforms to all of the policies laid out in this developer policy |
| 596 | document, including license, patent, and coding standards. |
| 597 | |
| 598 | * The target should have either reasonable documentation on how it |
| 599 | works (ISA, ABI, etc.) or a publicly available simulator/hardware |
Chris Lattner | 915cd42 | 2016-08-17 22:17:03 +0000 | [diff] [blame] | 600 | (either free or cheap enough) - preferably both. This allows |
| 601 | developers to validate assumptions, understand constraints and review code |
| 602 | that can affect the target. |
Renato Golin | 302f15f | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 603 | |
Chris Lattner | 915cd42 | 2016-08-17 22:17:03 +0000 | [diff] [blame] | 604 | In addition, the rules for a back-end to be promoted to **official** are: |
Renato Golin | 302f15f | 2016-08-17 20:38:09 +0000 | [diff] [blame] | 605 | |
| 606 | * The target must have addressed every other minimum requirement and |
| 607 | have been stable in tree for at least 3 months. This cool down |
| 608 | period is to make sure that the back-end and the target community can |
| 609 | endure continuous upstream development for the foreseeable future. |
| 610 | |
| 611 | * The target's code must have been completely adapted to this policy |
| 612 | as well as the :doc:`coding standards<CodingStandards>`. Any exceptions that |
| 613 | were made to move into experimental mode must have been fixed **before** |
| 614 | becoming official. |
| 615 | |
| 616 | * The test coverage needs to be broad and well written (small tests, |
| 617 | well documented). The build target ``check-all`` must pass with the |
| 618 | new target built, and where applicable, the ``test-suite`` must also |
| 619 | pass without errors, in at least one configuration (publicly |
| 620 | demonstrated, for example, via buildbots). |
| 621 | |
| 622 | * Public buildbots need to be created and actively maintained, unless |
| 623 | the target requires no additional buildbots (ex. ``check-all`` covers |
| 624 | all tests). The more relevant and public the new target's CI infrastructure |
| 625 | is, the more the LLVM community will embrace it. |
| 626 | |
| 627 | To **continue** as a supported and official target: |
| 628 | |
| 629 | * The maintainer(s) must continue following these rules throughout the lifetime |
| 630 | of the target. Continuous violations of aforementioned rules and policies |
| 631 | could lead to complete removal of the target from the code base. |
| 632 | |
| 633 | * Degradation in support, documentation or test coverage will make the target as |
| 634 | nuisance to other targets and be considered a candidate for deprecation and |
| 635 | ultimately removed. |
| 636 | |
| 637 | In essences, these rules are necessary for targets to gain and retain their |
| 638 | status, but also markers to define bit-rot, and will be used to clean up the |
| 639 | tree from unmaintained targets. |
| 640 | |
Hans Wennborg | ef6469f | 2019-02-08 11:06:27 +0000 | [diff] [blame] | 641 | .. _toolchain: |
| 642 | |
| 643 | Updating Toolchain Requirements |
| 644 | ------------------------------- |
| 645 | |
| 646 | We intend to require newer toolchains as time goes by. This means LLVM's |
| 647 | codebase can use newer versions of C++ as they get standardized. Requiring newer |
| 648 | toolchains to build LLVM can be painful for those building LLVM; therefore, it |
| 649 | will only be done through the following process: |
| 650 | |
| 651 | * Generally, try to support LLVM and GCC versions from the last 3 years at a |
| 652 | minimum. This time-based guideline is not strict: we may support much older |
| 653 | compilers, or decide to support fewer versions. |
| 654 | |
| 655 | * An RFC is sent to the `llvm-dev mailing list <http://lists.llvm.org/mailman/listinfo/llvm-dev>`_ |
| 656 | |
| 657 | - Detail upsides of the version increase (e.g. which newer C++ language or |
| 658 | library features LLVM should use; avoid miscompiles in particular compiler |
| 659 | versions, etc). |
| 660 | - Detail downsides on important platforms (e.g. Ubuntu LTS status). |
| 661 | |
| 662 | * Once the RFC reaches consensus, update the CMake toolchain version checks as |
| 663 | well as the :doc:`getting started<GettingStarted>` guide. We want to |
| 664 | soft-error when developers compile LLVM. We say "soft-error" because the |
| 665 | error can be turned into a warning using a CMake flag. This is an important |
| 666 | step: LLVM still doesn't have code which requires the new toolchains, but it |
| 667 | soon will. If you compile LLVM but don't read the mailing list, we should |
| 668 | tell you! |
| 669 | |
| 670 | * Ensure that at least one LLVM release has had this soft-error. Not all |
| 671 | developers compile LLVM top-of-tree. These release-bound developers should |
| 672 | also be told about upcoming changes. |
| 673 | |
| 674 | * Turn the soft-error into a hard-error after said LLVM release has branched. |
| 675 | |
| 676 | * Update the :doc:`coding standards<CodingStandards>` to allow the new |
| 677 | features we've explicitly approved in the RFC. |
| 678 | |
| 679 | * Start using the new features in LLVM's codebase. |
| 680 | |
| 681 | |
Dmitri Gribenko | e17d858 | 2012-12-09 23:14:26 +0000 | [diff] [blame] | 682 | .. _copyright-license-patents: |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 683 | |
| 684 | Copyright, License, and Patents |
| 685 | =============================== |
| 686 | |
| 687 | .. note:: |
| 688 | |
| 689 | This section deals with legal matters but does not provide legal advice. We |
| 690 | are not lawyers --- please seek legal counsel from an attorney. |
| 691 | |
| 692 | This section addresses the issues of copyright, license and patents for the LLVM |
| 693 | project. The copyright for the code is held by the individual contributors of |
| 694 | the code and the terms of its license to LLVM users and developers is the |
| 695 | `University of Illinois/NCSA Open Source License |
| 696 | <http://www.opensource.org/licenses/UoI-NCSA.php>`_ (with portions dual licensed |
| 697 | under the `MIT License <http://www.opensource.org/licenses/mit-license.php>`_, |
| 698 | see below). As contributor to the LLVM project, you agree to allow any |
| 699 | contributions to the project to licensed under these terms. |
| 700 | |
| 701 | Copyright |
| 702 | --------- |
| 703 | |
| 704 | The LLVM project does not require copyright assignments, which means that the |
| 705 | copyright for the code in the project is held by its respective contributors who |
| 706 | have each agreed to release their contributed code under the terms of the `LLVM |
| 707 | License`_. |
| 708 | |
| 709 | An implication of this is that the LLVM license is unlikely to ever change: |
| 710 | changing it would require tracking down all the contributors to LLVM and getting |
| 711 | them to agree that a license change is acceptable for their contribution. Since |
| 712 | there are no plans to change the license, this is not a cause for concern. |
| 713 | |
| 714 | As a contributor to the project, this means that you (or your company) retain |
| 715 | ownership of the code you contribute, that it cannot be used in a way that |
| 716 | contradicts the license (which is a liberal BSD-style license), and that the |
| 717 | license for your contributions won't change without your approval in the |
| 718 | future. |
| 719 | |
| 720 | .. _LLVM License: |
| 721 | |
| 722 | License |
| 723 | ------- |
| 724 | |
| 725 | We intend to keep LLVM perpetually open source and to use a liberal open source |
| 726 | license. **As a contributor to the project, you agree that any contributions be |
| 727 | licensed under the terms of the corresponding subproject.** All of the code in |
| 728 | LLVM is available under the `University of Illinois/NCSA Open Source License |
| 729 | <http://www.opensource.org/licenses/UoI-NCSA.php>`_, which boils down to |
| 730 | this: |
| 731 | |
| 732 | * You can freely distribute LLVM. |
| 733 | * You must retain the copyright notice if you redistribute LLVM. |
| 734 | * Binaries derived from LLVM must reproduce the copyright notice (e.g. in an |
| 735 | included readme file). |
| 736 | * You can't use our names to promote your LLVM derived products. |
| 737 | * There's no warranty on LLVM at all. |
| 738 | |
| 739 | We believe this fosters the widest adoption of LLVM because it **allows |
| 740 | commercial products to be derived from LLVM** with few restrictions and without |
| 741 | a requirement for making any derived works also open source (i.e. LLVM's |
| 742 | license is not a "copyleft" license like the GPL). We suggest that you read the |
| 743 | `License <http://www.opensource.org/licenses/UoI-NCSA.php>`_ if further |
| 744 | clarification is needed. |
| 745 | |
| 746 | In addition to the UIUC license, the runtime library components of LLVM |
| 747 | (**compiler_rt, libc++, and libclc**) are also licensed under the `MIT License |
| 748 | <http://www.opensource.org/licenses/mit-license.php>`_, which does not contain |
| 749 | the binary redistribution clause. As a user of these runtime libraries, it |
| 750 | means that you can choose to use the code under either license (and thus don't |
| 751 | need the binary redistribution clause), and as a contributor to the code that |
| 752 | you agree that any contributions to these libraries be licensed under both |
| 753 | licenses. We feel that this is important for runtime libraries, because they |
| 754 | are implicitly linked into applications and therefore should not subject those |
| 755 | applications to the binary redistribution clause. This also means that it is ok |
| 756 | to move code from (e.g.) libc++ to the LLVM core without concern, but that code |
| 757 | cannot be moved from the LLVM core to libc++ without the copyright owner's |
| 758 | permission. |
| 759 | |
Sean Silva | 7a8ca27 | 2014-02-19 00:12:34 +0000 | [diff] [blame] | 760 | Note that the LLVM Project does distribute dragonegg, **which is |
| 761 | GPL.** This means that anything "linked" into dragonegg must itself be compatible |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 762 | with the GPL, and must be releasable under the terms of the GPL. This implies |
Sean Silva | 7a8ca27 | 2014-02-19 00:12:34 +0000 | [diff] [blame] | 763 | that **any code linked into dragonegg and distributed to others may be subject to |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 764 | the viral aspects of the GPL** (for example, a proprietary code generator linked |
Sean Silva | 7a8ca27 | 2014-02-19 00:12:34 +0000 | [diff] [blame] | 765 | into dragonegg must be made available under the GPL). This is not a problem for |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 766 | code already distributed under a more liberal license (like the UIUC license), |
| 767 | and GPL-containing subprojects are kept in separate SVN repositories whose |
| 768 | LICENSE.txt files specifically indicate that they contain GPL code. |
| 769 | |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 770 | Patents |
| 771 | ------- |
| 772 | |
| 773 | To the best of our knowledge, LLVM does not infringe on any patents (we have |
| 774 | actually removed code from LLVM in the past that was found to infringe). Having |
| 775 | code in LLVM that infringes on patents would violate an important goal of the |
| 776 | project by making it hard or impossible to reuse the code for arbitrary purposes |
| 777 | (including commercial use). |
| 778 | |
| 779 | When contributing code, we expect contributors to notify us of any potential for |
| 780 | patent-related trouble with their changes (including from third parties). If |
| 781 | you or your employer own the rights to a patent and would like to contribute |
| 782 | code to LLVM that relies on it, we require that the copyright owner sign an |
| 783 | agreement that allows any other user of LLVM to freely use your patent. Please |
Tanya Lattner | 8522330 | 2015-07-21 20:14:20 +0000 | [diff] [blame] | 784 | contact the `LLVM Foundation Board of Directors <mailto:board@llvm.org>`_ for more |
Bill Wendling | bbc3be5 | 2012-06-20 11:20:07 +0000 | [diff] [blame] | 785 | details. |