1=====================
2LLVM Developer Policy
3=====================
4
5.. contents::
6   :local:
7
8Introduction
9============
10
11This document contains the LLVM Developer Policy which defines the project's
12policy towards developers and their contributions. The intent of this policy is
13to eliminate miscommunication, rework, and confusion that might arise from the
14distributed nature of LLVM's development.  By stating the policy in clear terms,
15we hope each developer can know ahead of time what to expect when making LLVM
16contributions.  This policy covers all llvm.org subprojects, including Clang,
17LLDB, libc++, etc.
18
19This 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
25#. Keep the top of tree as stable as possible.
26
27#. Establish awareness of the project's :ref:`copyright, license, and patent
28   policies <copyright-license-patents>` with contributors to the project.
29
30This policy is aimed at frequent contributors to LLVM. People interested in
31contributing one-off patches can do so in an informal way by sending them to the
32`llvm-commits mailing list
33<http://lists.llvm.org/mailman/listinfo/llvm-commits>`_ and engaging another
34developer to see it through the process.
35
36Developer Policies
37==================
38
39This section contains policies that pertain to frequent LLVM developers.  We
40always welcome `one-off patches`_ from people who do not routinely contribute to
41LLVM, but we expect more from frequent contributors to keep the system as
42efficient as possible for everyone.  Frequent LLVM contributors are expected to
43meet the following requirements in order for LLVM to maintain a high standard of
44quality.
45
46Stay Informed
47-------------
48
49Developers should stay informed by reading the `LLVM Discourse forums`_.
50If you are doing anything more than just casual work on LLVM, it is suggested that you also
51subscribe to the "commits" mailing list for the subproject you're interested in,
52such as `llvm-commits
53<http://lists.llvm.org/mailman/listinfo/llvm-commits>`_, `cfe-commits
54<http://lists.llvm.org/mailman/listinfo/cfe-commits>`_, or `lldb-commits
55<http://lists.llvm.org/mailman/listinfo/lldb-commits>`_.  Reading the
56"commits" list and paying attention to changes being made by others is a good
57way to see what other people are interested in and watching the flow of the
58project as a whole.
59
60We recommend that active developers monitor incoming issues to our `GitHub issue tracker <https://github.com/llvm/llvm-project/issues>`_ and preferably subscribe to the `llvm-bugs
61<http://lists.llvm.org/mailman/listinfo/llvm-bugs>`_ email list to keep track
62of bugs and enhancements occurring in LLVM.  We really appreciate people who are
63proactive at catching incoming bugs in their components and dealing with them
64promptly.
65
66Please be aware that all public LLVM mailing lists and discourse forums are public and archived, and
67that notices of confidentiality or non-disclosure cannot be respected.
68
69.. _patch:
70.. _one-off patches:
71
72Making and Submitting a Patch
73-----------------------------
74
75When making a patch for review, the goal is to make it as easy for the reviewer
76to read it as possible.  As such, we recommend that you:
77
78#. Make your patch against git main, not a branch, and not an old version
79   of LLVM.  This makes it easy to apply the patch.  For information on how to
80   clone from git, please see the :ref:`Getting Started Guide
81   <checkout>`.
82
83#. Similarly, patches should be submitted soon after they are generated.  Old
84   patches may not apply correctly if the underlying code changes between the
85   time the patch was created and the time it is applied.
86
87#. Patches should be made with ``git format-patch``, or similar (see special
88   commands for `Requesting Phabricator review via the web interface
89   <Phabricator.html#phabricator-request-review-web>`_ ). If you use a
90   different tool, make sure it uses the ``diff -u`` format and that it
91   doesn't contain clutter which makes it hard to read.
92
93Once your patch is ready, submit it by emailing it to the appropriate project's
94commit mailing list (or commit it directly if applicable). Alternatively, some
95patches get sent to the project's development list or component of the LLVM bug
96tracker, but the commit list is the primary place for reviews and should
97generally be preferred.
98
99When sending a patch to a mailing list, it is a good idea to send it as an
100*attachment* to the message, not embedded into the text of the message.  This
101ensures that your mailer will not mangle the patch when it sends it (e.g. by
102making whitespace changes or by wrapping lines).
103
104*For Thunderbird users:* Before submitting a patch, please open *Preferences >
105Advanced > General > Config Editor*, find the key
106``mail.content_disposition_type``, and set its value to ``1``. Without this
107setting, Thunderbird sends your attachment using ``Content-Disposition: inline``
108rather than ``Content-Disposition: attachment``. Apple Mail gamely displays such
109a file inline, making it difficult to work with for reviewers using that
110program.
111
112When submitting patches, please do not add confidentiality or non-disclosure
113notices to the patches themselves.  These notices conflict with the LLVM
114licensing terms and may result in your contribution being excluded.
115
116.. _code review:
117
118Code Reviews
119------------
120
121LLVM has a code-review policy. Code review is one way to increase the quality of
122software. Please see :doc:`CodeReview` for more information on LLVM's code-review
123process.
124
125.. _code owners:
126
127Code Owners
128-----------
129
130The LLVM Project relies on two features of its process to maintain rapid
131development in addition to the high quality of its source base: the combination
132of code review plus post-commit review for trusted maintainers.  Having both is
133a great way for the project to take advantage of the fact that most people do
134the right thing most of the time, and only commit patches without pre-commit
135review when they are confident they are right.
136
137The trick to this is that the project has to guarantee that all patches that are
138committed are reviewed after they go in: you don't want everyone to assume
139someone else will review it, allowing the patch to go unreviewed.  To solve this
140problem, we have a notion of an 'owner' for a piece of the code.  The sole
141responsibility of a code owner is to ensure that a commit to their area of the
142code is appropriately reviewed, either by themself or by someone else.  The list
143of current code owners can be found in the file `CODE_OWNERS.TXT
144<https://github.com/llvm/llvm-project/blob/main/llvm/CODE_OWNERS.TXT>`_ in the
145root of the LLVM source tree.
146
147Note that code ownership is completely different than reviewers: anyone can
148review a piece of code, and we welcome code review from anyone who is
149interested.  Code owners are the "last line of defense" to guarantee that all
150patches that are committed are actually reviewed.
151
152Being a code owner is a somewhat unglamorous position, but it is incredibly
153important for the ongoing success of the project.  Because people get busy,
154interests change, and unexpected things happen, code ownership is purely opt-in,
155and anyone can choose to resign their "title" at any time. For now, we do not
156have an official policy on how one gets elected to be a code owner.
157
158.. _include a testcase:
159
160Test Cases
161----------
162
163Developers are required to create test cases for any bugs fixed and any new
164features added.  Some tips for getting your testcase approved:
165
166* All feature and regression test cases are added to the ``llvm/test``
167  directory. The appropriate sub-directory should be selected (see the
168  :doc:`Testing Guide <TestingGuide>` for details).
169
170* Test cases should be written in :doc:`LLVM assembly language <LangRef>`.
171
172* Test cases, especially for regressions, should be reduced as much as possible,
173  by :doc:`bugpoint <Bugpoint>` or manually. It is unacceptable to place an
174  entire failing program into ``llvm/test`` as this creates a *time-to-test*
175  burden on all developers. Please keep them short.
176
177Note that llvm/test and clang/test are designed for regression and small feature
178tests only. More extensive test cases (e.g., entire applications, benchmarks,
179etc) should be added to the ``llvm-test`` test suite.  The llvm-test suite is
180for coverage (correctness, performance, etc) testing, not feature or regression
181testing.
182
183Release Notes
184-------------
185
186Many projects in LLVM communicate important changes to users through release
187notes, typically found in ``docs/ReleaseNotes.rst`` for the project. Changes to
188a project that are user-facing, or that users may wish to know about, should be
189added to the project's release notes at the author's or code reviewer's
190discretion, preferably as part of the commit landing the changes. Examples of
191changes that would typically warrant adding a release note (this list is not
192exhaustive):
193
194* Adding, removing, or modifying command-line options.
195* Adding, removing, or regrouping a diagnostic.
196* Fixing a bug that potentially has significant user-facing impact (please link
197  to the issue fixed in the bug database).
198* Adding or removing optimizations that have widespread impact or enables new
199  programming paradigms.
200* Modifying a C stable API.
201* Notifying users about a potentially disruptive change expected to be made in
202  a future release, such as removal of a deprecated feature.
203
204Code reviewers are encouraged to request a release note if they think one is
205warranted when performing a code review.
206
207Quality
208-------
209
210The minimum quality standards that any change must satisfy before being
211committed to the main development branch are:
212
213#. Code must adhere to the `LLVM Coding Standards <CodingStandards.html>`_.
214
215#. Code must compile cleanly (no errors, no warnings) on at least one platform.
216
217#. Bug fixes and new features should `include a testcase`_ so we know if the
218   fix/feature ever regresses in the future.
219
220#. Code must pass the ``llvm/test`` test suite.
221
222#. The code must not cause regressions on a reasonable subset of llvm-test,
223   where "reasonable" depends on the contributor's judgement and the scope of
224   the change (more invasive changes require more testing). A reasonable subset
225   might be something like "``llvm-test/MultiSource/Benchmarks``".
226
227Additionally, the committer is responsible for addressing any problems found in
228the future that the change is responsible for.  For example:
229
230* The code should compile cleanly on all supported platforms.
231
232* The changes should not cause any correctness regressions in the ``llvm-test``
233  suite and must not cause any major performance regressions.
234
235* The change set should not cause performance or correctness regressions for the
236  LLVM tools.
237
238* The changes should not cause performance or correctness regressions in code
239  compiled by LLVM on all applicable targets.
240
241* You are expected to address any `GitHub Issues <https://github.com/llvm/llvm-project/issues>`_ that
242  result from your change.
243
244We prefer for this to be handled before submission but understand that it isn't
245possible to test all of this for every submission.  Our build bots and nightly
246testing infrastructure normally finds these problems.  A good rule of thumb is
247to check the nightly testers for regressions the day after your change.  Build
248bots will directly email you if a group of commits that included yours caused a
249failure.  You are expected to check the build bot messages to see if they are
250your fault and, if so, fix the breakage.
251
252Commits that violate these quality standards (e.g. are very broken) may be
253reverted. This is necessary when the change blocks other developers from making
254progress. The developer is welcome to re-commit the change after the problem has
255been fixed.
256
257.. _commit messages:
258
259Commit messages
260---------------
261
262Although we don't enforce the format of commit messages, we prefer that
263you follow these guidelines to help review, search in logs, email formatting
264and so on. These guidelines are very similar to rules used by other open source
265projects.
266
267Most importantly, the contents of the message should be carefully written to
268convey the rationale of the change (without delving too much in detail). It
269also should avoid being vague or overly specific. For example, "bits were not
270set right" will leave the reviewer wondering about which bits, and why they
271weren't right, while "Correctly set overflow bits in TargetInfo" conveys almost
272all there is to the change.
273
274Below are some guidelines about the format of the message itself:
275
276* Separate the commit message into title and body separated by a blank line.
277
278* If you're not the original author, ensure the 'Author' property of the commit is
279  set to the original author and the 'Committer' property is set to yourself.
280  You can use a command similar to
281  ``git commit --amend --author="John Doe <[email protected]>"`` to correct the
282  author property if it is incorrect. See `Attribution of Changes`_ for more
283  information including the method we used for attribution before the project
284  migrated to git.
285
286* The title should be concise. Because all commits are emailed to the list with
287  the first line as the subject, long titles are frowned upon.  Short titles
288  also look better in `git log`.
289
290* When the changes are restricted to a specific part of the code (e.g. a
291  back-end or optimization pass), it is customary to add a tag to the
292  beginning of the line in square brackets.  For example, "[SCEV] ..."
293  or "[OpenMP] ...". This helps email filters and searches for post-commit
294  reviews.
295
296* The body, if it exists, should be separated from the title by an empty line.
297
298* The body should be concise, but explanatory, including a complete
299  reasoning.  Unless it is required to understand the change, examples,
300  code snippets and gory details should be left to bug comments, web
301  review or the mailing list.
302
303* If the patch fixes a bug in GitHub Issues, please include the PR# in the message.
304
305* Text formatting and spelling should follow the same rules as documentation
306  and in-code comments, ex. capitalization, full stop, etc.
307
308* If the commit is a bug fix on top of another recently committed patch, or a
309  revert or reapply of a patch, include the git commit hash of the prior
310  related commit. This could be as simple as "Revert commit NNNN because it
311  caused PR#".
312
313* If the patch has been reviewed, add a link to its review page, as shown
314  `here <https://www.llvm.org/docs/Phabricator.html#committing-a-change>`_.
315
316For minor violations of these recommendations, the community normally favors
317reminding the contributor of this policy over reverting. Minor corrections and
318omissions can be handled by sending a reply to the commits mailing list.
319
320.. _revert_policy:
321
322Patch reversion policy
323----------------------
324
325As a community, we strongly value having the tip of tree in a good state while
326allowing rapid iterative development.  As such, we tend to make much heavier
327use of reverts to keep the tree healthy than some other open source projects,
328and our norms are a bit different.
329
330How should you respond if someone reverted your change?
331
332* Remember, it is normal and healthy to have patches reverted.  Having a patch
333  reverted does not necessarily mean you did anything wrong.
334* We encourage explicitly thanking the person who reverted the patch for doing
335  the task on your behalf.
336* If you need more information to address the problem, please follow up in the
337  original commit thread with the reverting patch author.
338
339When should you revert your own change?
340
341* Any time you learn of a serious problem with a change, you should revert it.
342  We strongly encourage "revert to green" as opposed to "fixing forward".  We
343  encourage reverting first, investigating offline, and then reapplying the
344  fixed patch - possibly after another round of review if warranted.
345* If you break a buildbot in a way which can't be quickly fixed, please revert.
346* If a test case that demonstrates a problem is reported in the commit thread,
347  please revert and investigate offline.
348* If you receive substantial :ref:`post-commit review <post_commit_review>`
349  feedback, please revert and address said feedback before recommitting.
350  (Possibly after another round of review.)
351* If you are asked to revert by another contributor, please revert and discuss
352  the merits of the request offline (unless doing so would further destabilize
353  tip of tree).
354
355When should you revert someone else's change?
356
357* In general, if the author themselves would revert the change per these
358  guidelines, we encourage other contributors to do so as a courtesy to the
359  author.  This is one of the major cases where our norms differ from others;
360  we generally consider reverting a normal part of development.  We don't
361  expect contributors to be always available, and the assurance that a
362  problematic patch will be reverted and we can return to it at our next
363  opportunity enables this.
364
365What are the expectations around a revert?
366
367* Use your best judgment. If you're uncertain, please start an email on
368  the commit thread asking for assistance.  We aren't trying to enumerate
369  every case, but rather give a set of guidelines.
370* You should be sure that reverting the change improves the stability of tip
371  of tree.  Sometimes reverting one change in a series can worsen things
372  instead of improving them.  We expect reasonable judgment to ensure that
373  the proper patch or set of patches is being reverted.
374* The commit message for the reverting commit should explain why patch
375  is being reverted.
376* It is customary to respond to the original commit email mentioning the
377  revert.  This serves as both a notice to the original author that their
378  patch was reverted, and helps others following llvm-commits track context.
379* Ideally, you should have a publicly reproducible test case ready to share.
380  Where possible, we encourage sharing of test cases in commit threads, or
381  in PRs.  We encourage the reverter to minimize the test case and to prune
382  dependencies where practical.  This even applies when reverting your own
383  patch; documenting the reasons for others who might be following along
384  is critical.
385* It is not considered reasonable to revert without at least the promise to
386  provide a means for the patch author to debug the root issue.  If a situation
387  arises where a public reproducer can not be shared for some reason (e.g.
388  requires hardware patch author doesn't have access to, sharp regression in
389  compile time of internal workload, etc.), the reverter is expected to be
390  proactive about working with the patch author to debug and test candidate
391  patches.
392* Reverts should be reasonably timely.  A change submitted two hours ago
393  can be reverted without prior discussion.  A change submitted two years ago
394  should not be.  Where exactly the transition point is is hard to say, but
395  it's probably in the handful of days in tree territory.  If you are unsure,
396  we encourage you to reply to the commit thread, give the author a bit to
397  respond, and then proceed with the revert if the author doesn't seem to be
398  actively responding.
399* When re-applying a reverted patch, the commit message should be updated to
400  indicate the problem that was addressed and how it was addressed.
401
402Obtaining Commit Access
403-----------------------
404
405We grant commit access to contributors with a track record of submitting high
406quality patches.  If you would like commit access, please send an email to
407`Chris <mailto:[email protected]>`_ with your GitHub username.  This is true
408for former contributors with SVN access as well as new contributors.
409
410Prior to obtaining commit access, it is common practice to request that
411someone with commit access commits on your behalf. When doing so, please
412provide the name and email address you would like to use in the Author
413property of the commit.
414
415Your first commit to a repository may require the autogenerated email to be
416approved by a moderator of the mailing list.
417This is normal and will be done when the mailing list owner has time.
418
419If you have recently been granted commit access, these policies apply:
420
421#. You are granted *commit-after-approval* to all parts of LLVM. For
422   information on how to get approval for a patch, please see :doc:`CodeReview`.
423   When approved, you may commit it yourself.
424
425#. You are allowed to commit patches without approval which you think are
426   obvious. This is clearly a subjective decision --- we simply expect you to
427   use good judgement.  Examples include: fixing build breakage, reverting
428   obviously broken patches, documentation/comment changes, any other minor
429   changes. Avoid committing formatting- or whitespace-only changes outside of
430   code you plan to make subsequent changes to. Also, try to separate
431   formatting or whitespace changes from functional changes, either by
432   correcting the format first (ideally) or afterward. Such changes should be
433   highly localized and the commit message should clearly state that the commit
434   is not intended to change functionality, usually by stating it is
435   :ref:`NFC <nfc>`.
436
437#. You are allowed to commit patches without approval to those portions of LLVM
438   that you have contributed or maintain (i.e., have been assigned
439   responsibility for), with the proviso that such commits must not break the
440   build.  This is a "trust but verify" policy, and commits of this nature are
441   reviewed after they are committed.
442
443#. Multiple violations of these policies or a single egregious violation may
444   cause commit access to be revoked.
445
446In any case, your changes are still subject to `code review`_ (either before or
447after they are committed, depending on the nature of the change).  You are
448encouraged to review other peoples' patches as well, but you aren't required
449to do so.
450
451.. _discuss the change/gather consensus:
452
453Making a Major Change
454---------------------
455
456When a developer begins a major new project with the aim of contributing it back
457to LLVM, they should inform the community with a post to the `LLVM Discourse forums`_, to the extent
458possible. The reason for this is to:
459
460#. keep the community informed about future changes to LLVM,
461
462#. avoid duplication of effort by preventing multiple parties working on the
463   same thing and not knowing about it, and
464
465#. ensure that any technical issues around the proposed work are discussed and
466   resolved before any significant work is done.
467
468The design of LLVM is carefully controlled to ensure that all the pieces fit
469together well and are as consistent as possible. If you plan to make a major
470change to the way LLVM works or want to add a major new extension, it is a good
471idea to get consensus with the development community before you start working on
472it.
473
474Once the design of the new feature is finalized, the work itself should be done
475as a series of `incremental changes`_, not as a long-term development branch.
476
477.. _incremental changes:
478
479Incremental Development
480-----------------------
481
482In the LLVM project, we do all significant changes as a series of incremental
483patches.  We have a strong dislike for huge changes or long-term development
484branches.  Long-term development branches have a number of drawbacks:
485
486#. Branches must have mainline merged into them periodically.  If the branch
487   development and mainline development occur in the same pieces of code,
488   resolving merge conflicts can take a lot of time.
489
490#. Other people in the community tend to ignore work on branches.
491
492#. Huge changes (produced when a branch is merged back onto mainline) are
493   extremely difficult to `code review`_.
494
495#. Branches are not routinely tested by our nightly tester infrastructure.
496
497#. Changes developed as monolithic large changes often don't work until the
498   entire set of changes is done.  Breaking it down into a set of smaller
499   changes increases the odds that any of the work will be committed to the main
500   repository.
501
502To address these problems, LLVM uses an incremental development style and we
503require contributors to follow this practice when making a large/invasive
504change.  Some tips:
505
506* Large/invasive changes usually have a number of secondary changes that are
507  required before the big change can be made (e.g. API cleanup, etc).  These
508  sorts of changes can often be done before the major change is done,
509  independently of that work.
510
511* The remaining inter-related work should be decomposed into unrelated sets of
512  changes if possible.  Once this is done, define the first increment and get
513  consensus on what the end goal of the change is.
514
515* Each change in the set can be stand alone (e.g. to fix a bug), or part of a
516  planned series of changes that works towards the development goal.
517
518* Each change should be kept as small as possible. This simplifies your work
519  (into a logical progression), simplifies code review and reduces the chance
520  that you will get negative feedback on the change. Small increments also
521  facilitate the maintenance of a high quality code base.
522
523* Often, an independent precursor to a big change is to add a new API and slowly
524  migrate clients to use the new API.  Each change to use the new API is often
525  "obvious" and can be committed without review.  Once the new API is in place
526  and used, it is much easier to replace the underlying implementation of the
527  API.  This implementation change is logically separate from the API
528  change.
529
530If you are interested in making a large change, and this scares you, please make
531sure to first `discuss the change/gather consensus`_ then ask about the best way
532to go about making the change.
533
534Attribution of Changes
535----------------------
536
537When contributors submit a patch to an LLVM project, other developers with
538commit access may commit it for the author once appropriate (based on the
539progression of code review, etc.). When doing so, it is important to retain
540correct attribution of contributions to their contributors. However, we do not
541want the source code to be littered with random attributions "this code written
542by J. Random Hacker" (this is noisy and distracting). In practice, the revision
543control system keeps a perfect history of who changed what, and the CREDITS.txt
544file describes higher-level contributions. If you commit a patch for someone
545else, please follow the attribution of changes in the simple manner as outlined
546by the `commit messages`_ section. Overall, please do not add contributor names
547to the source code.
548
549Also, don't commit patches authored by others unless they have submitted the
550patch to the project or you have been authorized to submit them on their behalf
551(you work together and your company authorized you to contribute the patches,
552etc.). The author should first submit them to the relevant project's commit
553list, development list, or LLVM bug tracker component. If someone sends you
554a patch privately, encourage them to submit it to the appropriate list first.
555
556Our previous version control system (subversion) did not distinguish between the
557author and the committer like git does. As such, older commits used a different
558attribution mechanism. The previous method was to include "Patch by John Doe."
559in a separate line of the commit message and there are automated processes that
560rely on this format.
561
562.. _IR backwards compatibility:
563
564IR Backwards Compatibility
565--------------------------
566
567When the IR format has to be changed, keep in mind that we try to maintain some
568backwards compatibility. The rules are intended as a balance between convenience
569for llvm users and not imposing a big burden on llvm developers:
570
571* The textual format is not backwards compatible. We don't change it too often,
572  but there are no specific promises.
573
574* Additions and changes to the IR should be reflected in
575  ``test/Bitcode/compatibility.ll``.
576
577* The current LLVM version supports loading any bitcode since version 3.0.
578
579* After each X.Y release, ``compatibility.ll`` must be copied to
580  ``compatibility-X.Y.ll``. The corresponding bitcode file should be assembled
581  using the X.Y build and committed as ``compatibility-X.Y.ll.bc``.
582
583* Newer releases can ignore features from older releases, but they cannot
584  miscompile them. For example, if nsw is ever replaced with something else,
585  dropping it would be a valid way to upgrade the IR.
586
587* Debug metadata is special in that it is currently dropped during upgrades.
588
589* Non-debug metadata is defined to be safe to drop, so a valid way to upgrade
590  it is to drop it. That is not very user friendly and a bit more effort is
591  expected, but no promises are made.
592
593C API Changes
594----------------
595
596* Stability Guarantees: The C API is, in general, a "best effort" for stability.
597  This means that we make every attempt to keep the C API stable, but that
598  stability will be limited by the abstractness of the interface and the
599  stability of the C++ API that it wraps. In practice, this means that things
600  like "create debug info" or "create this type of instruction" are likely to be
601  less stable than "take this IR file and JIT it for my current machine".
602
603* Release stability: We won't break the C API on the release branch with patches
604  that go on that branch, with the exception that we will fix an unintentional
605  C API break that will keep the release consistent with both the previous and
606  next release.
607
608* Testing: Patches to the C API are expected to come with tests just like any
609  other patch.
610
611* Including new things into the API: If an LLVM subcomponent has a C API already
612  included, then expanding that C API is acceptable. Adding C API for
613  subcomponents that don't currently have one needs to be discussed on the
614  `LLVM Discourse forums`_ for design and maintainability feedback prior to implementation.
615
616* Documentation: Any changes to the C API are required to be documented in the
617  release notes so that it's clear to external users who do not follow the
618  project how the C API is changing and evolving.
619
620.. _toolchain:
621
622Updating Toolchain Requirements
623-------------------------------
624
625We intend to require newer toolchains as time goes by. This means LLVM's
626codebase can use newer versions of C++ as they get standardized. Requiring newer
627toolchains to build LLVM can be painful for those building LLVM; therefore, it
628will only be done through the following process:
629
630  * It is a general goal to support LLVM and GCC versions from the last 3 years
631    at a minimum. This time-based guideline is not strict: we may support much
632    older compilers, or decide to support fewer versions.
633
634  * An RFC is sent to the `LLVM Discourse forums`_
635
636    - Detail upsides of the version increase (e.g. which newer C++ language or
637      library features LLVM should use; avoid miscompiles in particular compiler
638      versions, etc).
639    - Detail downsides on important platforms (e.g. Ubuntu LTS status).
640
641  * Once the RFC reaches consensus, update the CMake toolchain version checks as
642    well as the :doc:`getting started<GettingStarted>` guide.  This provides a
643    softer transition path for developers compiling LLVM, because the
644    error can be turned into a warning using a CMake flag. This is an important
645    step: LLVM still doesn't have code which requires the new toolchains, but it
646    soon will. If you compile LLVM but don't read the forums, we should
647    tell you!
648
649  * Ensure that at least one LLVM release has had this soft-error. Not all
650    developers compile LLVM top-of-tree. These release-bound developers should
651    also be told about upcoming changes.
652
653  * Turn the soft-error into a hard-error after said LLVM release has branched.
654
655  * Update the :doc:`coding standards<CodingStandards>` to allow the new
656    features we've explicitly approved in the RFC.
657
658  * Start using the new features in LLVM's codebase.
659
660Here's a `sample RFC
661<https://discourse.llvm.org/t/rfc-migrating-past-c-11/50943>`_ and the
662`corresponding change <https://reviews.llvm.org/D57264>`_.
663
664.. _ci-usage:
665
666Working with the CI system
667--------------------------
668
669The main continuous integration (CI) tool for the LLVM project is the
670`LLVM Buildbot <https://lab.llvm.org/buildbot/>`_. It uses different *builders*
671to cover a wide variety of sub-projects and configurations. The builds are
672executed on different *workers*. Builders and workers are configured and
673provided by community members.
674
675The Buildbot tracks the commits on the main branch and the release branches.
676This means that patches are built and tested after they are merged to the these
677branches (aka post-merge testing). This also means it's okay to break the build
678occasionally, as it's unreasonable to expect contributors to build and test
679their patch with every possible configuration.
680
681*If your commit broke the build:*
682
683* Fix the build as soon as possible as this might block other contributors or
684  downstream users.
685* If you need more time to analyze and fix the bug, please revert your change to
686  unblock others.
687
688*If someone else broke the build and this blocks your work*
689
690* Comment on the code review in `Phabricator <https://reviews.llvm.org/>`_
691  (if available) or email the author, explain the problem and how this impacts
692  you. Add a link to the broken build and the error message so folks can
693  understand the problem.
694* Revert the commit if this blocks your work, see revert_policy_ .
695
696*If a build/worker is permanently broken*
697
698* 1st step: contact the owner of the worker. You can find the name and contact
699  information for the *Admin* of worker on the page of the build in the
700  *Worker* tab:
701
702  .. image:: buildbot_worker_contact.png
703
704* 2nd step: If the owner does not respond or fix the worker, please escalate
705  to Galina Kostanova, the maintainer of the BuildBot master.
706* 3rd step: If Galina could not help you, please escalate to the
707  `Infrastructure Working Group <mailto:[email protected]>`_.
708
709.. _new-llvm-components:
710
711Introducing New Components into LLVM
712====================================
713
714The LLVM community is a vibrant and exciting place to be, and we look to be
715inclusive of new projects and foster new communities, and increase
716collaboration across industry and academia.
717
718That said, we need to strike a balance between being inclusive of new ideas and
719people and the cost of ongoing maintenance that new code requires.  As such, we
720have a general :doc:`support policy<SupportPolicy>` for introducing major new
721components into the LLVM world, depending on the degree of detail and
722responsibility required. *Core* projects need a higher degree of scrutiny
723than *peripheral* projects, and the latter may have additional differences.
724
725However, this is really only intended to cover common cases
726that we have seen arise: different situations are different, and we are open
727to discussing unusual cases as well - just start an RFC thread on the
728`LLVM Discourse forums`_.
729
730Adding a New Target
731-------------------
732
733LLVM is very receptive to new targets, even experimental ones, but a number of
734problems can appear when adding new large portions of code, and back-ends are
735normally added in bulk. New targets need the same level of support as other
736*core* parts of the compiler, so they are covered in the *core tier* of our
737:doc:`support policy<SupportPolicy>`.
738
739We have found that landing large pieces of new code and then trying to fix
740emergent problems in-tree is problematic for a variety of reasons. For these
741reasons, new targets are *always* added as *experimental* until they can be
742proven stable, and later moved to non-experimental.
743
744The differences between both classes are:
745
746* Experimental targets are not built by default (they need to be explicitly
747  enabled at CMake time).
748
749* Test failures, bugs, and build breakages that only appear when the
750  experimental target is enabled, caused by changes unrelated to the target, are
751  the responsibility of the community behind the target to fix.
752
753The basic rules for a back-end to be upstreamed in **experimental** mode are:
754
755* Every target must have a :ref:`code owner<code owners>`. The `CODE_OWNERS.TXT`
756  file has to be updated as part of the first merge. The code owner makes sure
757  that changes to the target get reviewed and steers the overall effort.
758
759* There must be an active community behind the target. This community
760  will help maintain the target by providing buildbots, fixing
761  bugs, answering the LLVM community's questions and making sure the new
762  target doesn't break any of the other targets, or generic code. This
763  behavior is expected to continue throughout the lifetime of the
764  target's code.
765
766* The code must be free of contentious issues, for example, large
767  changes in how the IR behaves or should be formed by the front-ends,
768  unless agreed by the majority of the community via refactoring of the
769  (:doc:`IR standard<LangRef>`) **before** the merge of the new target changes,
770  following the :ref:`IR backwards compatibility`.
771
772* The code conforms to all of the policies laid out in this developer policy
773  document, including license, patent, and coding standards.
774
775* The target should have either reasonable documentation on how it
776  works (ISA, ABI, etc.) or a publicly available simulator/hardware
777  (either free or cheap enough) - preferably both.  This allows
778  developers to validate assumptions, understand constraints and review code
779  that can affect the target.
780
781In addition, the rules for a back-end to be promoted to **official** are:
782
783* The target must have addressed every other minimum requirement and
784  have been stable in tree for at least 3 months. This cool down
785  period is to make sure that the back-end and the target community can
786  endure continuous upstream development for the foreseeable future.
787
788* The target's code must have been completely adapted to this policy
789  as well as the :doc:`coding standards<CodingStandards>`. Any exceptions that
790  were made to move into experimental mode must have been fixed **before**
791  becoming official.
792
793* The test coverage needs to be broad and well written (small tests,
794  well documented). The build target ``check-all`` must pass with the
795  new target built, and where applicable, the ``test-suite`` must also
796  pass without errors, in at least one configuration (publicly
797  demonstrated, for example, via buildbots).
798
799* Public buildbots need to be created and actively maintained, unless
800  the target requires no additional buildbots (ex. ``check-all`` covers
801  all tests). The more relevant and public the new target's CI infrastructure
802  is, the more the LLVM community will embrace it.
803
804To **continue** as a supported and official target:
805
806* The maintainer(s) must continue following these rules throughout the lifetime
807  of the target. Continuous violations of aforementioned rules and policies
808  could lead to complete removal of the target from the code base.
809
810* Degradation in support, documentation or test coverage will make the target as
811  nuisance to other targets and be considered a candidate for deprecation and
812  ultimately removed.
813
814In essence, these rules are necessary for targets to gain and retain their
815status, but also markers to define bit-rot, and will be used to clean up the
816tree from unmaintained targets.
817
818Those wishing to add a new target to LLVM must follow the procedure below:
819
8201. Read this section and make sure your target follows all requirements. For
821   minor issues, your community will be responsible for making all necessary
822   adjustments soon after the initial merge.
8232. Send a request for comment (RFC) to the `LLVM Discourse forums`_ describing
824   your target and how it follows all the requirements and what work has been
825   done and will need to be done to accommodate the official target requirements.
826   Make sure to expose any and all controversial issues, changes needed in the
827   base code, table gen, etc.
8283. Once the response is positive, the LLVM community can start reviewing the
829   actual patches (but they can be prepared before, to support the RFC). Create
830   a sequence of N patches, numbered '1/N' to 'N/N' (make sure N is an actual
831   number, not the letter 'N'), that completes the basic structure of the target.
8324. The initial patch should add documentation, code owners and triple support in
833   clang and LLVM. The following patches add TableGen infrastructure to describe
834   the target and lower instructions to assembly. The final patch must show that
835   the target can lower correctly with extensive LIT tests (IR to MIR, MIR to
836   ASM, etc).
8375. Some patches may be approved before others, but only after *all* patches are
838   approved that the whole set can be merged in one go. This is to guarantee
839   that all changes are good as a single block.
8406. After the initial merge, the target community can stop numbering patches and
841   start working asynchronously on the target to complete support. They should
842   still seek review from those who helped them in the initial phase, to make
843   sure the progress is still consistent.
8447. Once all official requirements have been fulfilled (as above), the code owner
845   should request the target to be enabled by default by sending another RFC to
846   the `LLVM Discourse forums`_.
847
848Adding an Established Project To the LLVM Monorepo
849--------------------------------------------------
850
851The `LLVM monorepo <https://github.com/llvm/llvm-project>`_ is the centerpoint
852of development in the LLVM world, and has all of the primary LLVM components,
853including the LLVM optimizer and code generators, Clang, LLDB, etc.  `Monorepos
854in general <https://en.wikipedia.org/wiki/Monorepo>`_ are great because they
855allow atomic commits to the project, simplify CI, and make it easier for
856subcommunities to collaborate.
857
858Like new targets, most projects already in the monorepo are considered to be in
859the *core tier* of our :doc:`support policy<SupportPolicy>`. The burden to add
860things to the LLVM monorepo needs to be very high - code that is added to this
861repository is checked out by everyone in the community.  As such, we hold
862components to a high bar similar to "official targets", they:
863
864 * Must be generally aligned with the mission of the LLVM project to advance
865   compilers, languages, tools, runtimes, etc.
866 * Must conform to all of the policies laid out in this developer policy
867   document, including license, patent, coding standards, and code of conduct.
868 * Must have an active community that maintains the code, including established
869   code owners.
870 * Should have reasonable documentation about how it works, including a high
871   quality README file.
872 * Should have CI to catch breakage within the project itself or due to
873   underlying LLVM dependencies.
874 * Should have code free of issues the community finds contentious, or be on a
875   clear path to resolving them.
876 * Must be proposed through the LLVM RFC process, and have its addition approved
877   by the LLVM community - this ultimately mediates the resolution of the
878   "should" concerns above.
879
880If you have a project that you think would make sense to add to the LLVM
881monorepo, please start an RFC topic on the `LLVM Discourse forums`_ to kick off
882the discussion.  This process can take some time and iteration - please don’t
883be discouraged or intimidated by that!
884
885If you have an earlier stage project that you think is aligned with LLVM, please
886see the "Incubating New Projects" section.
887
888Incubating New Projects
889-----------------------
890
891The burden to add a new project to the LLVM monorepo is intentionally very high,
892but that can have a chilling effect on new and innovative projects.  To help
893foster these sorts of projects, LLVM supports an "incubator" process that is
894much easier to get started with.  It provides space for potentially valuable,
895new top-level and sub-projects to reach a critical mass before they have enough
896code to prove their utility and grow a community.  This also allows
897collaboration between teams that already have permissions to make contributions
898to projects under the LLVM umbrella.
899
900Projects which can be considered for the LLVM incubator meet the following
901criteria:
902
903 * Must be generally aligned with the mission of the LLVM project to advance
904   compilers, languages, tools, runtimes, etc.
905 * Must conform to the license, patent, and code of conduct policies laid out
906   in this developer policy document.
907 * Must have a documented charter and development plan, e.g. in the form of a
908   README file, mission statement, and/or manifesto.
909 * Should conform to coding standards, incremental development process, and
910   other expectations.
911 * Should have a sense of the community that it hopes to eventually foster, and
912   there should be interest from members with different affiliations /
913   organizations.
914 * Should have a feasible path to eventually graduate as a dedicated top-level
915   or sub-project within the `LLVM monorepo
916   <https://github.com/llvm/llvm-project>`_.
917 * Should include a notice (e.g. in the project README or web page) that the
918   project is in ‘incubation status’ and is not included in LLVM releases (see
919   suggested wording below).
920 * Must be proposed through the LLVM RFC process, and have its addition
921   approved by the LLVM community - this ultimately mediates the resolution of
922   the "should" concerns above.
923
924That said, the project need not have any code to get started, and need not have
925an established community at all!  Furthermore, incubating projects may pass
926through transient states that violate the "Should" guidelines above, or would
927otherwise make them unsuitable for direct inclusion in the monorepo (e.g.
928dependencies that have not yet been factored appropriately, leveraging
929experimental components or APIs that are not yet upstream, etc).
930
931When approved, the llvm-admin group can grant the new project:
932 * A new repository in the LLVM Github Organization - but not the LLVM monorepo.
933 * New mailing list, discourse forum, and/or discord chat hosted with other LLVM
934   forums.
935 * Other infrastructure integration can be discussed on a case-by-case basis.
936
937Graduation to the mono-repo would follow existing processes and standards for
938becoming a first-class part of the monorepo.  Similarly, an incubating project
939may be eventually retired, but no process has been established for that yet.  If
940and when this comes up, please start an RFC discussion on the `LLVM Discourse forums`_.
941
942This process is very new - please expect the details to change, it is always
943safe to ask on the `LLVM Discourse forums`_ about this.
944
945Suggested disclaimer for the project README and the main project web page:
946
947::
948
949   This project is participating in the LLVM Incubator process: as such, it is
950   not part of any official LLVM release.  While incubation status is not
951   necessarily a reflection of the completeness or stability of the code, it
952   does indicate that the project is not yet endorsed as a component of LLVM.
953
954.. _copyright-license-patents:
955
956Copyright, License, and Patents
957===============================
958
959.. note::
960
961   This section deals with legal matters but does not provide legal advice.  We
962   are not lawyers --- please seek legal counsel from a licensed attorney.
963
964This section addresses the issues of copyright, license and patents for the LLVM
965project.  The copyright for the code is held by the contributors of
966the code.  The code is licensed under permissive `open source licensing terms`_,
967namely the Apache-2.0 with LLVM-exception license, which includes a copyright
968and `patent license`_.  When you contribute code to the LLVM project, you
969license it under these terms.
970
971In certain circumstances, code licensed under other licenses can be added
972to the codebase.  However, this may only be done with approval of the LLVM
973Foundation Board of Directors, and contributors should plan for the approval
974process to take at least 4-6 weeks.  If you would like to contribute code
975under a different license, please create a Phabricator review with the code
976you want to contribute and email [email protected] requesting a review.
977
978If you have questions or comments about these topics, please ask on the
979`LLVM Discourse forums`_.  However,
980please realize that most compiler developers are not lawyers, and therefore you
981will not be getting official legal advice.
982
983Copyright
984---------
985
986The LLVM project does not collect copyright assignments, which means that the
987copyright for the code in the project is held by the respective contributors.
988Because you (or your company)
989retain ownership of the code you contribute, you know it may only be used under
990the terms of the open source license you contributed it under: the license for
991your contributions cannot be changed in the future without your approval.
992
993Because the LLVM project does not require copyright assignments, changing the
994LLVM license requires tracking down the
995contributors to LLVM and getting them to agree that a license change is
996acceptable for their contributions.  We feel that a high burden for relicensing
997is good for the project, because contributors do not have to fear that their
998code will be used in a way with which they disagree.
999
1000Relicensing
1001-----------
1002
1003The last paragraph notwithstanding, the LLVM Project is in the middle of a large
1004effort to change licenses, which aims to solve several problems:
1005
1006* The old licenses made it difficult to move code from (e.g.) the compiler to
1007  runtime libraries, because runtime libraries used a different license from the
1008  rest of the compiler.
1009* Some contributions were not submitted to LLVM due to concerns that
1010  the patent grant required by the project was overly broad.
1011* The patent grant was unique to the LLVM Project, not written by a lawyer, and
1012  was difficult to determine what protection was provided (if any).
1013
1014The scope of relicensing is all code that is considered part of the LLVM
1015project, including the main LLVM repository, runtime libraries (compiler_rt,
1016OpenMP, etc), Polly, and all other subprojects.  There are a few exceptions:
1017
1018* Code imported from other projects (e.g. Google Test, Autoconf, etc) will
1019  remain as it is.  This code isn't developed as part of the LLVM project, it
1020  is used by LLVM.
1021* Some subprojects are impractical or uninteresting to relicense (e.g. llvm-gcc
1022  and dragonegg). These will be split off from the LLVM project (e.g. to
1023  separate GitHub projects), allowing interested people to continue their
1024  development elsewhere.
1025
1026To relicense LLVM, we will be seeking approval from all of the copyright holders
1027of code in the repository, or potentially remove/rewrite code if we cannot.
1028This is a large
1029and challenging project which will take a significant amount of time to
1030complete.  In the interim, **all contributions to the project will be made under
1031the terms of both the new license and the legacy license scheme** (each of which
1032is described below).  The exception to this is the legacy patent grant, which
1033will not be required for new contributions.
1034
1035When all of the code in the project has been converted to the new license or
1036removed, we will drop the requirement to contribute under the legacy license.
1037This will achieve the goal of having
1038a single standardized license for the entire codebase.
1039
1040If you are a prior contributor to LLVM and have not done so already, please do
1041*TODO* to allow us to use your code. *Add a link to a separate page here, which
1042is probably a click through web form or something like that.  Details to be
1043determined later*.
1044
1045
1046.. _open source licensing terms:
1047
1048New LLVM Project License Framework
1049----------------------------------
1050
1051Contributions to LLVM are licensed under the `Apache License, Version 2.0
1052<https://www.apache.org/licenses/LICENSE-2.0>`_, with two limited
1053exceptions intended to ensure that LLVM is very permissively licensed.
1054Collectively, the name of this license is "Apache 2.0 License with LLVM
1055exceptions".  The exceptions read:
1056
1057::
1058
1059   ---- LLVM Exceptions to the Apache 2.0 License ----
1060
1061   As an exception, if, as a result of your compiling your source code, portions
1062   of this Software are embedded into an Object form of such source code, you
1063   may redistribute such embedded portions in such Object form without complying
1064   with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
1065
1066   In addition, if you combine or link compiled forms of this Software with
1067   software that is licensed under the GPLv2 ("Combined Software") and if a
1068   court of competent jurisdiction determines that the patent provision (Section
1069   3), the indemnity provision (Section 9) or other Section of the License
1070   conflicts with the conditions of the GPLv2, you may retroactively and
1071   prospectively choose to deem waived or otherwise exclude such Section(s) of
1072   the License, but only in their entirety and only with respect to the Combined
1073   Software.
1074
1075
1076We intend to keep LLVM perpetually open source and available under a permissive
1077license - this fosters the widest adoption of LLVM by
1078**allowing commercial products to be derived from LLVM** with few restrictions
1079and without a requirement for making any derived works also open source.  In
1080particular, LLVM's license is not a "copyleft" license like the GPL.
1081
1082The "Apache 2.0 License with LLVM exceptions" allows you to:
1083
1084* freely download and use LLVM (in whole or in part) for personal, internal, or
1085  commercial purposes.
1086* include LLVM in packages or distributions you create.
1087* combine LLVM with code licensed under every other major open source
1088  license (including BSD, MIT, GPLv2, GPLv3...).
1089* make changes to LLVM code without being required to contribute it back
1090  to the project - contributions are appreciated though!
1091
1092However, it imposes these limitations on you:
1093
1094* You must retain the copyright notice if you redistribute LLVM: You cannot
1095  strip the copyright headers off or replace them with your own.
1096* Binaries that include LLVM must reproduce the copyright notice (e.g. in an
1097  included README file or in an "About" box), unless the LLVM code was added as
1098  a by-product of compilation.  For example, if an LLVM runtime library like
1099  compiler_rt or libc++ was automatically included into your application by the
1100  compiler, you do not need to attribute it.
1101* You can't use our names to promote your products (LLVM derived or not) -
1102  though you can make truthful statements about your use of the LLVM code,
1103  without implying our sponsorship.
1104* There's no warranty on LLVM at all.
1105
1106We want LLVM code to be widely used, and believe that this provides a model that
1107is great for contributors and users of the project.  For more information about
1108the Apache 2.0 License, please see the `Apache License FAQ
1109<http://www.apache.org/foundation/license-faq.html>`_, maintained by the
1110Apache Project.
1111
1112
1113.. note::
1114
1115   The LLVM Project includes some really old subprojects (dragonegg,
1116   llvm-gcc-4.0, and llvm-gcc-4.2), which are licensed under **GPL
1117   licenses**.  This code is not actively maintained - it does not even
1118   build successfully.  This code is cleanly separated into distinct SVN
1119   repositories from the rest of LLVM, and the LICENSE.txt files specifically
1120   indicate that they contain GPL code.  When LLVM transitions from SVN to Git,
1121   we plan to drop these code bases from the new repository structure.
1122
1123
1124.. _patent license:
1125
1126Patents
1127-------
1128
1129Section 3 of the Apache 2.0 license is a patent grant under which
1130contributors of code to the project contribute the rights to use any of
1131their patents that would otherwise be infringed by that code contribution
1132(protecting uses of that code).  Further, the patent grant is revoked
1133from anyone who files a patent lawsuit about code in LLVM - this protects the
1134community by providing a "patent commons" for the code base and reducing the
1135odds of patent lawsuits in general.
1136
1137The license specifically scopes which patents are included with code
1138contributions.  To help explain this, the `Apache License FAQ
1139<http://www.apache.org/foundation/license-faq.html>`_ explains this scope using
1140some questions and answers, which we reproduce here for your convenience (for
1141reference, the "ASF" is the Apache Software Foundation, the guidance still
1142holds though)::
1143
1144   Q1: If I own a patent and contribute to a Work, and, at the time my
1145   contribution is included in that Work, none of my patent's claims are subject
1146   to Apache's Grant of Patent License, is there a way any of those claims would
1147   later become subject to the Grant of Patent License solely due to subsequent
1148   contributions by other parties who are not licensees of that patent.
1149
1150   A1: No.
1151
1152   Q2: If at any time after my contribution, I am able to license other patent
1153   claims that would have been subject to Apache's Grant of Patent License if
1154   they were licensable by me at the time of my contribution, do those other
1155   claims become subject to the Grant of Patent License?
1156
1157   A2: Yes.
1158
1159   Q3: If I own or control a licensable patent and contribute code to a specific
1160   Apache product, which of my patent claims are subject to Apache's Grant of
1161   Patent License?
1162
1163   A3:  The only patent claims that are licensed to the ASF are those you own or
1164   have the right to license that read on your contribution or on the
1165   combination of your contribution with the specific Apache product to which
1166   you contributed as it existed at the time of your contribution. No additional
1167   patent claims become licensed as a result of subsequent combinations of your
1168   contribution with any other software. Note, however, that licensable patent
1169   claims include those that you acquire in the future, as long as they read on
1170   your original contribution as made at the original time. Once a patent claim
1171   is subject to Apache's Grant of Patent License, it is licensed under the
1172   terms of that Grant to the ASF and to recipients of any software distributed
1173   by the ASF for any Apache software product whatsoever.
1174
1175.. _legacy:
1176
1177Legacy License Structure
1178------------------------
1179
1180.. note::
1181   The code base was previously licensed under the Terms described here.
1182   We are in the middle of relicensing to a new approach (described above), but
1183   until this effort is complete, the code is also still available under these
1184   terms.  Once we finish the relicensing project, new versions of the code will
1185   not be available under these terms.  However, nothing takes away your right
1186   to use old versions under the licensing terms under which they were
1187   originally released.
1188
1189We intend to keep LLVM perpetually open source and to use a permissive open
1190source license.  The code in
1191LLVM is available under the `University of Illinois/NCSA Open Source License
1192<http://www.opensource.org/licenses/UoI-NCSA.php>`_, which boils down to
1193this:
1194
1195* You can freely distribute LLVM.
1196* You must retain the copyright notice if you redistribute LLVM.
1197* Binaries derived from LLVM must reproduce the copyright notice (e.g. in an
1198  included README file).
1199* You can't use our names to promote your LLVM derived products.
1200* There's no warranty on LLVM at all.
1201
1202We believe this fosters the widest adoption of LLVM because it **allows
1203commercial products to be derived from LLVM** with few restrictions and without
1204a requirement for making any derived works also open source (i.e. LLVM's
1205license is not a "copyleft" license like the GPL). We suggest that you read the
1206`License <http://www.opensource.org/licenses/UoI-NCSA.php>`_ if further
1207clarification is needed.
1208
1209In addition to the UIUC license, the runtime library components of LLVM
1210(**compiler_rt, libc++, and libclc**) are also licensed under the `MIT License
1211<http://www.opensource.org/licenses/mit-license.php>`_, which does not contain
1212the binary redistribution clause.  As a user of these runtime libraries, it
1213means that you can choose to use the code under either license (and thus don't
1214need the binary redistribution clause), and as a contributor to the code that
1215you agree that any contributions to these libraries be licensed under both
1216licenses.  We feel that this is important for runtime libraries, because they
1217are implicitly linked into applications and therefore should not subject those
1218applications to the binary redistribution clause. This also means that it is ok
1219to move code from (e.g.)  libc++ to the LLVM core without concern, but that code
1220cannot be moved from the LLVM core to libc++ without the copyright owner's
1221permission.
1222
1223.. _LLVM Discourse forums: https://discourse.llvm.org
1224