summaryrefslogtreecommitdiffstats
path: root/llvm/docs/ProgrammersManual.rst
Commit message (Collapse)AuthorAgeFilesLines
* ADT: Document advantages of SmallVector<T,0> over std::vectorDuncan P. N. Exon Smith2018-07-261-7/+20
| | | | | | | | | | | | In light of the recent changes to SmallVector in r335421, r337514, and r337820, document its advantages over std::vector (see r175906 and r266909). Also add a release note. https://reviews.llvm.org/D49748 llvm-svn: 338071
* [NFC] fix trivial typos in documentsHiroshi Inoue2018-06-151-1/+1
| | | | llvm-svn: 334799
* [docs] Clarify usage of "vector" in Programmer's Manual.Eli Friedman2018-05-221-1/+1
| | | | | | | The explanation is specifically referring to std::vector; this might not be clear from the context. llvm-svn: 333036
* Docs: Fix the title underline too short.Nicola Zaghen2018-05-141-1/+1
| | | | llvm-svn: 332245
* Rename DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-141-9/+9
| | | | | | | | | | | | | | | | The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM - Manual change to APInt - Manually chage DOCS as regex doesn't match it. In the transition period the DEBUG() macro is still present and aliased to the LLVM_DEBUG() one. Differential Revision: https://reviews.llvm.org/D43624 llvm-svn: 332240
* [NFC] fix trivial typos in documents and commentsHiroshi Inoue2018-04-121-1/+1
| | | | | | "is is" -> "is", "if if" -> "if", "or or" -> "or" llvm-svn: 329878
* [docs] Use dbgs() instead of errs() for DEBUG()Jonas Devlieghere2017-12-251-5/+5
| | | | | | | | | | | | The examples in llvm/Support/Debug.h use `DEBUG(dbgs() << ...)` instead of `errs()`, so the examples in the Programmer's Manual should match that. Patch by: Moritz Sichert <moritz.sichert@googlemail.com> Differential revision: https://reviews.llvm.org/D41170 llvm-svn: 321444
* [docs] Code example fixJan Korous2017-10-241-1/+1
| | | | llvm-svn: 316425
* Refine report_fatal_error guidance after post-commit reviewAlex Bradbury2017-08-181-5/+6
| | | | | | | | | Use text suggested by Justin Bogner in post-commit review of r311146 <http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170814/479898.html>, which makes it clear that report_fatal_error shouldn't be used when there is a practicable alternative. Also make this clearer in CodingStandards. llvm-svn: 311147
* Give guidance on report_fatal_error in CodingStandards.rst and ↵Alex Bradbury2017-08-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | ProgrammersManual.rst The current ProgrammersManual.rst document has a lot of well-written documentation on error handling thanks to @lhames. It suggests errors can be split cleanly into "programmatic" and "recoverable" errors. However, the reality in current LLVM seems to be there are a number of cases where a non-programmatic error is not easily recoverable. Therefore, add a note to indicate the existence of report_fatal_error for these cases. I've also added a reminder to CodingStandards.rst in the section on assertions, to indicate that llvm_unreachable and assertions should not be relied upon to report errors triggered by user input. The ProgrammersManual is also silent on the use of LLVMContext::diagnose, which is used in BPF+WebAssembly+AMDGPU to report some errors during instruction selection. I don't address that in this patch, as it's not quite clear how to fit in to the current error handling story Differential Revision: https://reviews.llvm.org/D36826 llvm-svn: 311146
* [DebugCounter] Move the semicolon out of the DEBUG_COUNTER macro and require ↵Craig Topper2017-08-101-1/+1
| | | | | | | | | | it to be placed at the end of each use. This make it consistent with STATISTIC which it will often appears near. While there move one DEBUG_COUNTER instance out of an anonymous namespace. It's already declaring a static variable so the namespace is unnecessary. llvm-svn: 310637
* [Docs] Remove a stray period from a code example in the Programmer's Manual.Craig Topper2017-08-091-1/+1
| | | | llvm-svn: 310520
* [docs] Fix a typo: iteratation -> iterationStephen Hines2017-07-251-1/+1
| | | | | | | | | | | | Reviewers: dgross Reviewed By: dgross Subscribers: dgross, llvm-commits Differential Revision: https://reviews.llvm.org/D35822 llvm-svn: 308994
* [docs] Simplify some language for Error/cantFail in the programmer's manual.Lang Hames2017-04-301-10/+9
| | | | llvm-svn: 301773
* Reverts commit r301424, r301425 and r301426Sanjoy Das2017-04-261-3/+3
| | | | | | | | | | | | Commits were: "Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts" "Add a new WeakVH value handle; NFC" "Rename WeakVH to WeakTrackingVH; NFC" The changes assumed pointers are 8 byte aligned on all architectures. llvm-svn: 301429
* Rename WeakVH to WeakTrackingVH; NFCSanjoy Das2017-04-261-3/+3
| | | | | | | | | | | | | | | | Summary: I plan to use WeakVH to mean "nulls itself out on deletion, but does not track RAUW" in a subsequent commit. Reviewers: dblaikie, davide Reviewed By: davide Subscribers: arsenm, mehdi_amini, mcrosier, mzolotukhin, jfb, llvm-commits, nhaehnle Differential Revision: https://reviews.llvm.org/D32266 llvm-svn: 301424
* Update stale doxygen links in ProgrammersManual.rstTim Northover2017-04-031-17/+17
| | | | | | Patch by Wei-Ren Chen. llvm-svn: 299395
* Fix some indenting and line-wrapping issues identified in ProgrammersManual. ↵Daniel Berlin2017-03-131-26/+28
| | | | | | Make description of debugCounters a little clearer llvm-svn: 297656
* Add documentation on debug counters to Programmers Manual.Daniel Berlin2017-03-121-0/+63
| | | | | | | | | | Reviewers: mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30842 llvm-svn: 297575
* Revert commit r296967, no typoSylvestre Ledru2017-03-051-1/+1
| | | | llvm-svn: 296984
* Fix a typo. Thanks to huangml. Reported here: ↵Sylvestre Ledru2017-03-041-1/+1
| | | | | | https://github.com/llvm-mirror/llvm/pull/6 llvm-svn: 296967
* [docs] Fix a think-o in the Programmer's Manual.Lang Hames2017-02-281-1/+1
| | | | llvm-svn: 296421
* [Support][Error] Add a 'cantFail' utility function for known-safe calls toLang Hames2017-02-271-4/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fallible functions. Some fallible functions (those returning Error or Expected<T>) may only fail for a subset of their inputs. For example, a "safe" square root function will succeed for all finite positive inputs: Expected<double> safeSqrt(double d) { if (d < 0 && !isnan(d) && !isinf(d)) return make_error<...>("Cannot sqrt -ve values, nans or infs"); return sqrt(d); } At a safe callsite for such a function, checking the error return value is redundant: if (auto ValOrErr = safeSqrt(42.0)) { // use *ValOrErr. } else llvm_unreachable("safeSqrt should always succeed for +ve values"); The cantFail function wraps this check and extracts the contained value, simplifying control flow: double Result = cantFail(safeSqrt(42.0)); This function should be used with care: it is a programmatic error to wrap a call with cantFail if it can in fact fail. For debug builds this will result in llvm_unreachable being called. For release builds the behavior is undefined. Use of this function is likely to be rare in library code, but more common for tool and unit-test code where inputs and mock functions may be known to be safe. llvm-svn: 296384
* [Doc] Modernize programmers manualPiotr Padlewski2017-02-251-28/+21
| | | | | | | | | | | | | | Summary: Fixed bunch of for loops to range based for loop and bunch of rendundat types with auto. Reviewers: echristo, silvas, chandlerc Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D30338 llvm-svn: 296251
* Update Bugzilla URLs in docsIsmail Donmez2017-02-171-1/+1
| | | | llvm-svn: 295432
* fix some typos in the docSylvestre Ledru2017-01-141-1/+1
| | | | llvm-svn: 292014
* Fix missing '>' in docs (hopefully fixes bot error... )David Blaikie2016-12-201-1/+1
| | | | llvm-svn: 290187
* Add some brief documentation about GDB pretty printersDavid Blaikie2016-12-201-0/+16
| | | | llvm-svn: 290186
* Simplify format member detection in FormatVariadicPavel Labath2016-12-151-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This replaces the format member search, which was quite complicated, with a more direct approach to detecting whether a class should be formatted using the format-member method. Instead we use a special type llvm::format_adapter, which every adapter must inherit from. Then the search can be simply implemented with the is_base_of type trait. Aside from the simplification, I like this way more because it makes it more explicit that you are supposed to use this type only for adapter-like formattings, and the other approach (format_provider overloads) should be used as a default (a mistake I made when first trying to use this library). The only slight change in behaviour here is that now choose the format-adapter branch even if the format member invocation will fail to compile (e.g. because it is a non-const member function and we are passing a const adapter), whereas previously we would have gone on to search for format_providers for the type. However, I think that is actually a good thing, as it probably means the programmer did something wrong. Reviewers: zturner, inglorion Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27679 llvm-svn: 289795
* IR: Move NumElements field from {Array,Vector}Type to SequentialType.Peter Collingbourne2016-12-021-3/+3
| | | | | | | | | | Now that PointerType is no longer a SequentialType, all SequentialTypes have an associated number of elements, so we can move that information to the base class, allowing for a number of simplifications. Differential Revision: https://reviews.llvm.org/D27122 llvm-svn: 288464
* IR: Change PointerType to derive from Type rather than SequentialType.Peter Collingbourne2016-12-021-2/+2
| | | | | | | | | | | | | | | | | | | As proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106640.html This is for a couple of reasons: - Values of type PointerType are unlike the other SequentialTypes (arrays and vectors) in that they do not hold values of the element type. By moving PointerType we can unify certain aspects of how the other SequentialTypes are handled. - PointerType will have no place in the SequentialType hierarchy once pointee types are removed, so this is a necessary step towards removing pointee types. Differential Revision: https://reviews.llvm.org/D26595 llvm-svn: 288462
* [Support] Introduce llvm::formatv() function.Zachary Turner2016-11-111-0/+130
| | | | | | | | | | | | | | | | | | This introduces a new type-safe general purpose formatting library. It provides compile-time type safety, does not require a format specifier (since the type is deduced), and provides mechanisms for extending the format capability to user defined types, and overriding the formatting behavior for existing types. This patch additionally adds documentation for the API to the LLVM programmer's manual. Mailing List Thread: http://lists.llvm.org/pipermail/llvm-dev/2016-October/105836.html Differential Revision: https://reviews.llvm.org/D25587 llvm-svn: 286682
* NFC ProgrammersManual fixPiotr Padlewski2016-11-111-1/+1
| | | | llvm-svn: 286645
* [docs] Add a pointer to ExitOnError to the discussion of handleErrors in theLang Hames2016-11-071-2/+9
| | | | | | | | | | | | programmer's manual. ExitOnError is often a better alternative to handleErrors for tool code. This patch makes it easier to find the ExitOnError discussion when reading the handleErrors section. Thanks to Peter Collingbourne for the suggestion. llvm-svn: 286167
* [docs] remove more non-ascii stuff in the hopes to fix the bot Kostya Serebryany2016-11-011-10/+10
| | | | llvm-svn: 285668
* docs: trying to fix the docs bot by removing non-ASCII characters. The docs ↵Kostya Serebryany2016-10-311-2/+2
| | | | | | build fine on my machine, bot fail on the bot (http://lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/25/steps/docs-llvm-html/logs/stdio) llvm-svn: 285639
* [libFuzzer] remove large examples from the libFuzzer docs and link to the ↵Kostya Serebryany2016-10-271-0/+1
| | | | | | libFuzzer tutorial instead; also fix a build error in another file llvm-svn: 285337
* [docs] Avoid repetition of 'considerable' in Error docs.Lang Hames2016-10-251-10/+10
| | | | llvm-svn: 285141
* [docs] Use consistent style for "do more stuff" in Error docs examples.Lang Hames2016-10-251-5/+8
| | | | llvm-svn: 285138
* [docs] Fix yet another Error docs formatting issue...Lang Hames2016-10-251-1/+2
| | | | llvm-svn: 285137
* [docs] Fix a few more Error docs formatting issues.Lang Hames2016-10-251-5/+6
| | | | | | Thanks to Pete Cooper for the review. llvm-svn: 285136
* [docs] Fix a missing code-block in the new Error docs.Lang Hames2016-10-251-8/+10
| | | | llvm-svn: 285134
* [docs] Fix a couple of typos in the new Error docs.Lang Hames2016-10-251-2/+2
| | | | llvm-svn: 285133
* [docs] Add more Error documentation to the Programmer's Manual.Lang Hames2016-10-251-48/+356
| | | | | | | | This patch updates some of the existing Error examples, expands on the documentation for handleErrors, and includes new sections that cover a number of helpful utilities and common error usage idioms. llvm-svn: 285122
* Fixed a typo (LLVM/Support/CFG.h -> LLVM/IR/CFG.h)Andrey Bokhanko2016-09-021-1/+1
| | | | llvm-svn: 280481
* [Docs] Fix another typo in the Error/Expected docs.Lang Hames2016-09-021-2/+2
| | | | llvm-svn: 280461
* [Docs] Fix a couple of typos in the Error/Expected docs.Lang Hames2016-09-021-4/+4
| | | | llvm-svn: 280460
* fix incorrect xref in sphinx docEtienne Bergeron2016-07-131-1/+1
| | | | llvm-svn: 275255
* [docs] Fix up a broken link.Sean Silva2016-07-091-1/+1
| | | | llvm-svn: 275002
* Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini2016-04-141-5/+0
| | | | | | | | | | | At the same time, fixes InstructionsTest::CastInst unittest: yes you can leave the IR in an invalid state and exit when you don't destroy the context (like the global one), no longer now. This is the first part of http://reviews.llvm.org/D19094 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266379
OpenPOWER on IntegriCloud