summaryrefslogtreecommitdiffstats
path: root/docs/ProgrammersManual.rst
Commit message (Collapse)AuthorAgeFilesLines
* [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321444 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Code example fixJan Korous2017-10-241-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316425 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311147 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311146 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310637 91177308-0d34-0410-b5e6-96231b3b80d8
* [Docs] Remove a stray period from a code example in the Programmer's Manual.Craig Topper2017-08-091-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310520 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308994 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Simplify some language for Error/cantFail in the programmer's manual.Lang Hames2017-04-301-10/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301773 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301429 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301424 91177308-0d34-0410-b5e6-96231b3b80d8
* Update stale doxygen links in ProgrammersManual.rstTim Northover2017-04-031-17/+17
| | | | | | Patch by Wei-Ren Chen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299395 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some indenting and line-wrapping issues identified in ProgrammersManual. ↵Daniel Berlin2017-03-131-26/+28
| | | | | | Make description of debugCounters a little clearer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297656 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297575 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert commit r296967, no typoSylvestre Ledru2017-03-051-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296984 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo. Thanks to huangml. Reported here: ↵Sylvestre Ledru2017-03-041-1/+1
| | | | | | https://github.com/llvm-mirror/llvm/pull/6 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296967 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Fix a think-o in the Programmer's Manual.Lang Hames2017-02-281-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296421 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296384 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296251 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Bugzilla URLs in docsIsmail Donmez2017-02-171-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295432 91177308-0d34-0410-b5e6-96231b3b80d8
* fix some typos in the docSylvestre Ledru2017-01-141-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292014 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix missing '>' in docs (hopefully fixes bot error... )David Blaikie2016-12-201-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290187 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some brief documentation about GDB pretty printersDavid Blaikie2016-12-201-0/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290186 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289795 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288464 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288462 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286682 91177308-0d34-0410-b5e6-96231b3b80d8
* NFC ProgrammersManual fixPiotr Padlewski2016-11-111-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286645 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286167 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] remove more non-ascii stuff in the hopes to fix the bot Kostya Serebryany2016-11-011-10/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285668 91177308-0d34-0410-b5e6-96231b3b80d8
* 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) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285639 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285337 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Avoid repetition of 'considerable' in Error docs.Lang Hames2016-10-251-10/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285141 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Use consistent style for "do more stuff" in Error docs examples.Lang Hames2016-10-251-5/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285138 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Fix yet another Error docs formatting issue...Lang Hames2016-10-251-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285137 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Fix a few more Error docs formatting issues.Lang Hames2016-10-251-5/+6
| | | | | | | | Thanks to Pete Cooper for the review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285136 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Fix a missing code-block in the new Error docs.Lang Hames2016-10-251-8/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285134 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Fix a couple of typos in the new Error docs.Lang Hames2016-10-251-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285133 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285122 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed a typo (LLVM/Support/CFG.h -> LLVM/IR/CFG.h)Andrey Bokhanko2016-09-021-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280481 91177308-0d34-0410-b5e6-96231b3b80d8
* [Docs] Fix another typo in the Error/Expected docs.Lang Hames2016-09-021-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280461 91177308-0d34-0410-b5e6-96231b3b80d8
* [Docs] Fix a couple of typos in the Error/Expected docs.Lang Hames2016-09-021-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280460 91177308-0d34-0410-b5e6-96231b3b80d8
* fix incorrect xref in sphinx docEtienne Bergeron2016-07-131-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275255 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Fix up a broken link.Sean Silva2016-07-091-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275002 91177308-0d34-0410-b5e6-96231b3b80d8
* 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> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266379 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to fix ODR violation of ErrorInfo::IDReid Kleckner2016-03-241-0/+3
| | | | | | This implements my suggestion to Lang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264360 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Clarify Error example in Programmer's Manual.Lang Hames2016-03-241-4/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264314 91177308-0d34-0410-b5e6-96231b3b80d8
* docs: Fix a missing language in a code-blockJustin Bogner2016-03-231-1/+1
| | | | | | | This should fix the docs build. Spotted by spstarr, thanks! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264209 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Fix typo in ProgrammersManual.rstVedant Kumar2016-03-231-1/+1
| | | | | | Patch by Miod Vallat! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264138 91177308-0d34-0410-b5e6-96231b3b80d8
* [Docs] Clarify boolean conversion for Error and Expected<T> in the Programmer'sLang Hames2016-03-231-4/+16
| | | | | | | | Manual. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264135 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Add the 'Error' class for structured error handling.Lang Hames2016-03-161-0/+168
| | | | | | | | | | | | | | | | | | | This patch introduces the Error classs for lightweight, structured, recoverable error handling. It includes utilities for creating, manipulating and handling errors. The scheme is similar to exceptions, in that errors are described with user-defined types. Unlike exceptions however, errors are represented as ordinary return types in the API (similar to the way std::error_code is used). For usage notes see the LLVM programmer's manual, and the Error.h header. Usage examples can be found in unittests/Support/ErrorTest.cpp. Many thanks to David Blaikie, Mehdi Amini, Kevin Enderby and others on the llvm-dev and llvm-commits lists for lots of discussion and review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263609 91177308-0d34-0410-b5e6-96231b3b80d8