summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn-consumed-analysis.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Consumed] Treat by-value class arguments as consuming by default, like ↵Nicholas Allegra2019-09-191-0/+27
| | | | | | | | rvalue refs. Differential Revision: https://reviews.llvm.org/D67743 llvm-svn: 372361
* Fix for PR20402 in -Wconsumed.DeLesley Hutchins2015-04-151-0/+12
| | | | | | | https://llvm.org/bugs/show_bug.cgi?id=20402 Patch by Chris Wailes. llvm-svn: 235051
* Explicitly keep track of temporaries during the consumed analysis.Manuel Klimek2014-05-081-0/+6
| | | | | | | This makes the consumed analysis less dependent on the CFG layout and fixes a bug where we wouldn't warn on an unconsumed value. llvm-svn: 208300
* Consumed Analysis: IgnoreParens bugfix.DeLesley Hutchins2014-03-201-0/+33
| | | | llvm-svn: 204395
* Consumed analysis: bugfix for operator calls. Also fixes some formattingDeLesley Hutchins2014-01-161-10/+40
| | | | | | issues, a few testcases, and kills fish. llvm-svn: 199436
* Consumed analysis: add two new attributes which fine-tune the behavior ofDeLesley Hutchins2014-01-141-19/+68
| | | | | | | | consumable objects. These are useful for implementing error codes that must be checked. Patch also includes some significant refactoring, which was necesary to implement the new behavior. llvm-svn: 199169
* For -Wconsumed, walk the namespaces to find if the top most namespace is "std"Richard Trieu2013-12-171-0/+8
| | | | | | | to determine if a move function is the std::move function. This allows functions like std::__1::move to also be treated a the move function. llvm-svn: 197445
* Fix PR18260 - Make std::move handling in -Wconsumed only trigger on std::moveRichard Trieu2013-12-161-0/+19
| | | | llvm-svn: 197428
* Consumed analysis: track state of temporary objects.DeLesley Hutchins2013-11-161-7/+113
| | | | | | | | Earlier versions discarded the state too soon, and did not track state changes, e.g. when passing a temporary to a move constructor. Patch by chris.wailes@gmail.com; review and minor fixes by delesley. llvm-svn: 194900
* Added a test case for the fix to bug 17632 in r193751Chris Wailes2013-11-071-0/+2
| | | | llvm-svn: 194212
* Changed tests_typestate to test_typestate for consistency.Chris Wailes2013-10-291-5/+5
| | | | llvm-svn: 193648
* Consumed analysis: fix assert failure.DeLesley Hutchins2013-10-181-0/+43
| | | | llvm-svn: 193010
* Consumed analysis: assume that non-const reference parameters are initiallyDeLesley Hutchins2013-10-181-11/+24
| | | | | | in the "uknown" state. Patch by chris.wailes@gmail.com. Reviewed by delesley. llvm-svn: 192995
* Consumed analysis: All the return_typestate parameter to be attached to theDeLesley Hutchins2013-10-181-2/+8
| | | | | | default constructor. Patch by chris.wailes@gmail.com, reviewed by delesley. llvm-svn: 192991
* Consumed analysis: Add param_typestate attribute, which specifies thatDeLesley Hutchins2013-10-171-1/+15
| | | | | | | function parameters must be in a particular state. Patch by chris.wailes@gmail.com. Reviewed by delesley@google.com. llvm-svn: 192934
* Consumed Analysis: Allow parameters that are passed by non-const referenceDeLesley Hutchins2013-10-171-0/+18
| | | | | | | to be treated as return values, and marked with the "returned_typestate" attribute. Patch by chris.wailes@gmail.com; reviewed by delesley@google.com. llvm-svn: 192932
* Consumed analysis: update to previous test case.DeLesley Hutchins2013-10-171-1/+13
| | | | llvm-svn: 192926
* Consumed analysis: fix ICE in handling of loop source locations.DeLesley Hutchins2013-10-171-3/+25
| | | | llvm-svn: 192911
* Consumed analysis: replace the consumes attribute with a set_typestateDeLesley Hutchins2013-10-111-7/+12
| | | | | | attribute. Patch by chris.wailes@gmail.com; reviewed and edited by delesley. llvm-svn: 192515
* Consumed analysis: switch from tests_consumed/unconsumed to a generalDeLesley Hutchins2013-10-111-4/+11
| | | | | | tests_typestate attribute. Patch by chris.wailes@gmail.com. llvm-svn: 192513
* Consumed analysis: check destructor calls.DeLesley Hutchins2013-10-111-1/+21
| | | | | | | This allows the callable_when attribute to be attached to destructors. Original patch by chris.wailes@gmail.com, reviewed and edited by delesley. llvm-svn: 192508
* Consumed analysis: improve loop handling. The prior version of the analysisDeLesley Hutchins2013-10-091-12/+21
| | | | | | | | | | | | marked all variables as "unknown" at the start of a loop. The new version keeps the initial state of variables unchanged, but issues a warning if the state at the end of the loop is different from the state at the beginning. This patch will eventually be replaced with a more precise analysis. Initial patch by chris.wailes@gmail.com. Reviewed and edited by delesley@google.com. llvm-svn: 192314
* Consumed Analysis: Change callable_when so that it can take a list of statesDeLesley Hutchins2013-10-041-58/+207
| | | | | | | | that a function can be called in. This reduced the total number of annotations needed and makes writing more complicated behaviour less burdensome. Patch by chriswails@gmail.com. llvm-svn: 191983
* Consumed Analysis: The 'consumable' attribute now takes a identifier ↵David Blaikie2013-09-061-7/+6
| | | | | | | | | | | | | specifying the default assumed state for objects of this class This information is used for return states and pass-by-value parameter states. Patch by Chris Wailes. Review by DeLesley Hutchins and Aaron Ballman. llvm-svn: 190116
* Consumed analysis: add return_typestate attribute.DeLesley Hutchins2013-09-031-4/+25
| | | | | | | | | | Patch by chris.wailes@gmail.com Functions can now declare what state the consumable type the are returning will be in. This is then used on the caller side and checked on the callee side. Constructors now use this attribute instead of the 'consumes' attribute. llvm-svn: 189843
* Consumed analysis: add 'consumable' class attribute.DeLesley Hutchins2013-08-301-3/+4
| | | | | | | | | | | | Patch by chris.wailes@gmail.com Adds the 'consumable' attribute that can be attached to classes. This replaces the previous method of scanning a class's methods to see if any of them have consumed analysis attributes attached to them. If consumed analysis attributes are attached to methods of a class that isn't marked 'consumable' a warning is generated. llvm-svn: 189702
* Consumed analysis: track function parameters.DeLesley Hutchins2013-08-291-0/+12
| | | | | | Patch by chris.wailes@gmail.com. llvm-svn: 189616
* Consumed analysis: non-const methods no longer transfer an object into anDeLesley Hutchins2013-08-291-1/+5
| | | | | | unknown state. Patch by chris.wailes@gmail.com. llvm-svn: 189612
* Consumed analysis: improve handling of conditionals.DeLesley Hutchins2013-08-291-28/+149
| | | | | | | | | | | | | | Patch by chris.wailes@gmail.com. * The TestedVarsVisitor was folded into the ConsumedStmtVisitor. * The VarTestResult class was updated to allow these changes. * The PropagationInfo class was updated for the same reasons. * Correctly handle short-circuiting of Boolean operations. * Blocks are now marked as unreachable when we can statically prove we will never branch to them. * Unreachable blocks are skipped by the analysis. llvm-svn: 189594
* Consumed analysis: change class name in test cases.DeLesley Hutchins2013-08-231-35/+35
| | | | | | | The name of a class used in the testing files was updated to actually be descriptive. Patch by chris.wailes@gmail.com. llvm-svn: 189132
* Update to consumed analysis.DeLesley Hutchins2013-08-221-0/+23
| | | | | | | | | | | Patch by chris.wailes@gmail.com. The following functionality was added: * The same functionality is now supported for both CXXOperatorCallExprs and CXXMemberCallExprs. * Factored out some code in StmtVisitor. * Removed variables from the state map when their destructors are encountered. * Started adding documentation for the consumed analysis attributes. llvm-svn: 189059
* Patch by Chris Wailes <chris.wailes@gmail.com>.DeLesley Hutchins2013-08-121-0/+188
Reviewed by delesley, dblaikie. Add the annotations and code needed to support a basic 'consumed' analysis. Summary: This new analysis is based on academic literature on linear types. It tracks the state of a value, either as unconsumed, consumed, or unknown. Methods are then annotated as CallableWhenUnconsumed, and when an annotated method is called while the value is in the 'consumed' state a warning is issued. A value may be tested in the conditional statement of an if-statement; when this occurs we know the state of the value in the different branches, and this information is added to our analysis. The code is still highly experimental, and the names of annotations or the algorithm may be subject to change. llvm-svn: 188206
OpenPOWER on IntegriCloud