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