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