aboutsummaryrefslogtreecommitdiff
path: root/llvm/docs/CodingStandards.rst
AgeCommit message (Collapse)AuthorFilesLines
2014-10-14Introduce Go coding standards for LLVM.Peter Collingbourne1-0/+19
Rather than define our own standards, we adopt a set of best practices that are already in use by the Go community. Differential Revision: http://reviews.llvm.org/D5761 llvm-svn: 219646
2014-08-19CodingStandards: Document std::equal misbehaviourDuncan P. N. Exon Smith1-0/+2
I should have included this as part of r215986, which worked around this corner by changing ArrayRef::equals() not to use std::equal. Alas. llvm-svn: 215988
2014-07-02Remove the recommendation against using std::functionReid Kleckner1-4/+1
Clang-cl supports MSVC-style RTTI now, and we can even compile typeid(...) with /GR-. Just don't instantiate std::function with a polymorphic type, or bad things will happen. llvm-svn: 212148
2014-05-06Update programmers manual to cover llvm::function_ref, and add a note to theRichard Smith1-0/+2
coding standard suggesting using it instead of the (unavailable) std::function. llvm-svn: 208067
2014-05-06Revert accidentally-committed files.Richard Smith1-2/+0
llvm-svn: 208034
2014-05-06Re-commit r208025, reverted in r208030, with a fix for a conformance issueRichard Smith1-0/+2
which GCC detects and Clang does not! llvm-svn: 208033
2014-04-17C++11: Compatibility with (C++03 => MSVC)Duncan P. N. Exon Smith1-3/+3
llvm-svn: 206481
2014-04-17C++11: Document some limitations imposed by MSVCDuncan P. N. Exon Smith1-0/+6
llvm-svn: 206480
2014-04-08[docs] Fix up some links to the preferred style.Sean Silva1-5/+2
:doc:`...` and :ref:`...` links help Sphinx keep track the dependencies between documents and ensure that they are not pointing to nowhere. Raw HTML links work just fine and are easier for people less familiar with reST/Sphinx. They are easy to change over to the :doc:/:ref: style after the fact so this is not a problem. This commit doesn't fix all of them. llvm-svn: 205792
2014-03-07C++11: Remove const from in auto guidelinesDuncan P. N. Exon Smith1-7/+5
Using const is orthogonal to guidelines on using auto& and auto*. llvm-svn: 203257
2014-03-07C++11: Copy pointers with const auto *Duncan P. N. Exon Smith1-1/+5
llvm-svn: 203254
2014-03-03Avoid std::function until PR19030 is fixedReid Kleckner1-0/+4
We'd like to keep the clang-cl self-host working until we implement MSVC-compatible RTTI. Differential Revision: http://llvm-reviews.chandlerc.com/D2930 llvm-svn: 202758
2014-03-03Document that std::initializer_list is not always available.Peter Collingbourne1-0/+3
Differential Revision: http://llvm-reviews.chandlerc.com/D2923 llvm-svn: 202750
2014-03-03C++11: Beware unnecessary copies with autoDuncan P. N. Exon Smith1-0/+21
It's easy to copy unintentionally when using 'auto', particularly inside range-based for loops. Best practise is to use 'const&' unless there's a good reason not to. llvm-svn: 202729
2014-03-03Clarify struct usage guidelinesDuncan P. N. Exon Smith1-5/+31
The current coding standards restrict the use of struct to PODs, but no one has been following them. This patch updates the standards to clarify when structs are dangerous and describe common practice in LLVM. llvm-svn: 202728
2014-03-02[C++11] Suggest placing callable arguments as the last argument toChandler Carruth1-0/+4
facilitate the nice formatting of lambdas passed there. Suggested by Chris during review of my lambda additions, and something I strongly agree with. llvm-svn: 202622
2014-03-02[C++11] Update the coding standards to provide some important guidanceChandler Carruth1-4/+126
about a few constructs in C++11 that are worth starting off in a consistent manner within the codebase. This will be matched with a change to clang-format's LLVM style which will switch the options to support C++11 and use these conventions. llvm-svn: 202620
2014-03-02[docs] Fix some Sphinx warnings.Sean Silva1-1/+1
The docs now build cleanly. Yay! The following warnings were fixed: /home/sean/pg/llvm/llvm/docs/HowToReleaseLLVM.rst:364: WARNING: Enumerated list ends without a blank line; unexpected unindent. /home/sean/pg/llvm/llvm/docs/InAlloca.rst:: WARNING: document isn't included in any toctree /home/sean/pg/llvm/llvm/docs/CodingStandards.rst:85: WARNING: Title underline too short. Supported C++11 Language and Library Features ------------------------------------------- /home/sean/pg/llvm/llvm/docs/CodingStandards.rst:85: WARNING: Title underline too short. Supported C++11 Language and Library Features ------------------------------------------- /home/sean/pg/llvm/llvm/docs/GettingStarted.rst:185: WARNING: Explicit markup ends without a blank line; unexpected unindent. /home/sean/pg/llvm/llvm/docs/GettingStarted.rst:565: WARNING: Explicit markup ends without a blank line; unexpected unindent. /home/sean/pg/llvm/llvm/docs/GettingStarted.rst:567: WARNING: Block quote ends without a blank line; unexpected unindent. llvm-svn: 202603
2014-03-01[docs] Update the docs to remove my hedging about C++98 vs. C++11. =]Chandler Carruth1-17/+16
The switch has been thrown. While I'm still watching for any failures or problems with this, the documentation can go ahead and move forward. llvm-svn: 202566
2014-02-28[docs] Clarify that there isn't much to be done other than watch buildChandler Carruth1-0/+5
bots when using the standard library facilities. The missing pieces here aren't always in useful discreet chunks. Fortunately, the missing pieces are few and far between, and we can emulate most of them in our headers as needed. Based on feedback from Lang and Dave. llvm-svn: 202548
2014-02-28Add more whitespace to fix more bullets.Richard Smith1-0/+2
llvm-svn: 202538
2014-02-28Add whitespace to try to fix bulleted list.Richard Smith1-0/+1
llvm-svn: 202537
2014-02-28Fix some links to C++11 feature papers in the Coding StandardsBen Langmuir1-16/+16
llvm-svn: 202532
2014-02-28[docs] Add a section to the coding standards about languages and such.Chandler Carruth1-0/+115
A lot of this is writing down common knowledge and things often communicated on mailing lists and in discussions. It could live in the Programmer's Manual alternatively, but that felt slightly less well-fitting. It also includes (and was motivated by) the section on the relevant language standards for LLVM and the specific features that will be enabled with the switch to C++11. With this, all of the documentation for the C++11 switch is, I think, in place. I plan to flip the switch RSN. =] llvm-svn: 202497
2014-02-28[docs] A slight tweak to the intro for the golden rule in the codingChandler Carruth1-3/+3
standards. It claims the document intentionally doesn't give fixed standards for brace placement or spacing, and then the document goes on to do precisely that in several places. Instead, try to highlight that even these rules are simply *guidance* which may be trumped by some other circumstance or the local conventions of code. I'm not trying to change the thrust of this part of the document, and if folks think this does so, I'm happy to re-wordsmith it. I just don't want it to be so self-contradicting. llvm-svn: 202495
2014-01-20Revert my commit in r199620 that added sections about namespaces to theChandler Carruth1-97/+18
coding standards, and instead fix the existing section. Thanks to Daniel Jasper for pointing out we already had a section devoted to this topic. Instead of adding sections, just hack on this section some. Also fix the example in the anonymous namespace section below it to agree with the new advice. As a re-cap, this switches the LLVM preferred style to never indent namespaces. Having two approaches just led to endless (and utterly pointless) debates about what was "small enough". This wasn't helping anyone. The no-indent rule is easy to understand and doesn't really make anything harder to read. Moreover, with tools like clang-format it is considerably nicer to have simple consistent rules. llvm-svn: 199637
2014-01-20Add some wording to the coding standards to say how to indent namespacesChandler Carruth1-1/+45
(and to mention namespace ending comments). This is based on a quick discussion on the developer mailing list where there was essentially no objections to a simple and consistent rule. This should avoid future debates about whether or not a namespace is "big enough" to indent. It also matches clang-format's current behavior with LLVM source code which hasn't really seen any opposition in code reviews that I spot checked. llvm-svn: 199620
2013-12-05Correct word hyphenationsAlp Toker1-1/+1
This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities and contractions in nearby lines. llvm-svn: 196471
2013-09-01Revert r189704, which removed the guidance about not duplicating doc comments.Chris Lattner1-0/+7
This is under active discussion. llvm-svn: 189730
2013-08-30Remove the suggestion to not duplicate comments in header andChris Lattner1-7/+0
implementation files. While doc generation systems don't need this, humans do benefit from it. Not everyone reads all code through doxygen. llvm-svn: 189704
2013-08-07Add the common begin/end naming convention to the coding standard.Rafael Espindola1-1/+3
llvm-svn: 187902
2013-02-04Coding standards: don't use ``inline`` when defining a function in a classDmitri Gribenko1-0/+28
definition Current practice is not to use 'inline' in: class Foo { public: inline void bar() { // ... } }; llvm-svn: 174317
2013-01-21Fix spellingJoel Jones1-1/+1
llvm-svn: 173103
2013-01-11docs: Fix long standing linking antipattern.Sean Silva1-2/+0
Before we learned about :doc:, we used :ref: and put a dummy link at the top of each page. Don't do that anymore. This fixes PR14891 as a special case. llvm-svn: 172162
2012-12-02Simplify the coding standards for #include ordering. The ordering is nowChandler Carruth1-9/+2
trivially achievable with an editor. I'll likely check in a silly python script to help with this too. llvm-svn: 169107
2012-11-17docs: CodingStandards should follow the coding standards.Sean Silva1-20/+20
Some variables in code examples were not LikeThis. llvm-svn: 168275
2012-11-17docs: Add link to HowToSetUpLLVMStyleRTTISean Silva1-1/+2
llvm-svn: 168271
2012-10-26Suggest llvm_unreachable over assert(0).Jordan Rose1-10/+15
llvm-svn: 166821
2012-10-20Document current Doxygen use practices in Coding Standards. Mostly it isDmitri Gribenko1-9/+134
obvious stuff and most new code being committed conforms to that. Some old code does not; this might cause confusion and this is the motivation to document the correct guidelines. llvm-svn: 166378
2012-10-01[Docs] Update File Headers section to cover doxygen style file level docs.Michael J. Spencer1-8/+11
llvm-svn: 164964
2012-09-30Fix && to && in Coding Standards.Jakub Staszak1-1/+1
llvm-svn: 164920
2012-09-21Add missing 'to' and rephrase an explanation of GCC's assumptions.David Blaikie1-4/+4
Wordsmithing by Matt Beaumont-Gay in response to r164389. llvm-svn: 164395
2012-09-21Document "do not use defaults in covered switch-over-enum" coding standard.David Blaikie1-0/+18
llvm-svn: 164389
2012-09-20Fix function names in coding style examplesAndrew Trick1-4/+4
llvm-svn: 164311
2012-09-20Fix static function names in CodingStandards examples.Andrew Trick1-6/+6
Try not to violate conventions immediately before explaining them. llvm-svn: 164278
2012-09-18Coding standards: fix typo: '= deleted' -> '= delete'.Dmitri Gribenko1-2/+2
llvm-svn: 164126
2012-09-18Add LLVM_DELETED_FUNCTION to coding standards.Craig Topper1-0/+28
llvm-svn: 164101
2012-06-20Put space after "code-block::".Meador Inge1-1/+1
llvm-svn: 158880
2012-06-20Removed some left over HTML tags and a '}'.Meador Inge1-3/+2
llvm-svn: 158877
2012-06-20Sphinxify the CodingStandard documentation.Bill Wendling1-0/+1148
llvm-svn: 158786