summaryrefslogtreecommitdiff
path: root/lib/Analysis/Consumed.cpp
Commit message (Collapse)AuthorAge
* Move the logic for testing for namespace std into one location. This check canRichard Trieu2014-05-28
| | | | | | | be performed by using Decl::isInStdNamespace or DeclContext::isStdNamespace git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209708 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. Analysis edition.Craig Topper2014-05-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209191 91177308-0d34-0410-b5e6-96231b3b80d8
* Explicitly keep track of temporaries during the consumed analysis.Manuel Klimek2014-05-08
| | | | | | | This makes the consumed analysis less dependent on the CFG layout and fixes a bug where we wouldn't warn on an unconsumed value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208300 91177308-0d34-0410-b5e6-96231b3b80d8
* Updated the attribute tablegen emitter for variadic arguments to emit a ↵Aaron Ballman2014-05-02
| | | | | | range accessor in addition to the iterators. Updated code using iterators to use range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207837 91177308-0d34-0410-b5e6-96231b3b80d8
* Renaming the CallableState variadic attribute argument to be CallableStates. ↵Aaron Ballman2014-05-02
| | | | | | No functional changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207836 91177308-0d34-0410-b5e6-96231b3b80d8
* Renaming range-based for loop variables so they don't appear iterator-like.Aaron Ballman2014-04-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207422 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Converting to range-based for loops. No functional changes intended.Aaron Ballman2014-04-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207416 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed Analysis: IgnoreParens bugfix.DeLesley Hutchins2014-03-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204395 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing DeclStmt iterators decl_begin() and decl_end() with ↵Aaron Ballman2014-03-14
| | | | | | iterator_range decls(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203947 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace OwningPtr include with <memory>.Ahmed Charles2014-03-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203389 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-07
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203279 91177308-0d34-0410-b5e6-96231b3b80d8
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-07
| | | | | | This is a precursor to moving to std::unique_ptr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203275 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing FunctionDecl iterators param_begin() and param_end() with ↵Aaron Ballman2014-03-07
| | | | | | iterator_range params(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203248 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: bugfix for operator calls. Also fixes some formattingDeLesley Hutchins2014-01-16
| | | | | | issues, a few testcases, and kills fish. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199436 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: add two new attributes which fine-tune the behavior ofDeLesley Hutchins2014-01-14
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199169 91177308-0d34-0410-b5e6-96231b3b80d8
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-07
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198686 91177308-0d34-0410-b5e6-96231b3b80d8
* Switched code from using hasAttr followed by getAttr to simply call getAttr ↵Aaron Ballman2013-12-19
| | | | | | | | directly and check the resulting value. Also fixes some minor formatting issues surrounding the getAttr code. No functional changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197649 91177308-0d34-0410-b5e6-96231b3b80d8
* For -Wconsumed, walk the namespaces to find if the top most namespace is "std"Richard Trieu2013-12-17
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197445 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR18260 - Make std::move handling in -Wconsumed only trigger on std::moveRichard Trieu2013-12-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197428 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: track state of temporary objects.DeLesley Hutchins2013-11-16
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194900 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed bug with checking the kind of types.Chris Wailes2013-10-31
| | | | | | | | | | | | | | The isLValueReferenceType function checks to see if the QualType's canonical type is an LValue reference, and not if the QualType itself is an LValue reference. This caused a segfault when trying to cast the QualType's Type to a LValueReference. This is now fixed by casting the result of getCanonicalType(). In addition, a test was added to isConsumableType to prevent segfaults when a type being tested by the analysis is a reference to a pointer or a pointer to a reference. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193751 91177308-0d34-0410-b5e6-96231b3b80d8
* Changed tests_typestate to test_typestate for consistency.Chris Wailes2013-10-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193648 91177308-0d34-0410-b5e6-96231b3b80d8
* Used OwningPtr to clean up some memory management in Consumed.cpp.Chris Wailes2013-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193414 91177308-0d34-0410-b5e6-96231b3b80d8
* Replaced duplicate code with calls to forwardInfo.Chris Wailes2013-10-24
| | | | | | Also made move constructor handling safer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193347 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: fix assert failure.DeLesley Hutchins2013-10-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193010 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: assume that non-const reference parameters are initiallyDeLesley Hutchins2013-10-18
| | | | | | in the "uknown" state. Patch by chris.wailes@gmail.com. Reviewed by delesley. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192995 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: All the return_typestate parameter to be attached to theDeLesley Hutchins2013-10-18
| | | | | | default constructor. Patch by chris.wailes@gmail.com, reviewed by delesley. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192991 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: Add param_typestate attribute, which specifies thatDeLesley Hutchins2013-10-17
| | | | | | | function parameters must be in a particular state. Patch by chris.wailes@gmail.com. Reviewed by delesley@google.com. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192934 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed Analysis: Allow parameters that are passed by non-const referenceDeLesley Hutchins2013-10-17
| | | | | | | to be treated as return values, and marked with the "returned_typestate" attribute. Patch by chris.wailes@gmail.com; reviewed by delesley@google.com. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192932 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: fix ICE in handling of loop source locations.DeLesley Hutchins2013-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192911 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: replace the consumes attribute with a set_typestateDeLesley Hutchins2013-10-11
| | | | | | attribute. Patch by chris.wailes@gmail.com; reviewed and edited by delesley. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192515 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: switch from tests_consumed/unconsumed to a generalDeLesley Hutchins2013-10-11
| | | | | | tests_typestate attribute. Patch by chris.wailes@gmail.com. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192513 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: check destructor calls.DeLesley Hutchins2013-10-11
| | | | | | | This allows the callable_when attribute to be attached to destructors. Original patch by chris.wailes@gmail.com, reviewed and edited by delesley. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192508 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: improve loop handling. The prior version of the analysisDeLesley Hutchins2013-10-09
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192314 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed Analysis: Change callable_when so that it can take a list of statesDeLesley Hutchins2013-10-04
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191983 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix ICE in consumed analysis when CFG is null.DeLesley Hutchins2013-09-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190447 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed Analysis: The 'consumable' attribute now takes a identifier ↵David Blaikie2013-09-06
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190116 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix non-void return warning, and format.Eric Christopher2013-09-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189845 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: add return_typestate attribute.DeLesley Hutchins2013-09-03
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189843 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: add 'consumable' class attribute.DeLesley Hutchins2013-08-30
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189702 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: track function parameters.DeLesley Hutchins2013-08-29
| | | | | | Patch by chris.wailes@gmail.com. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189616 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: non-const methods no longer transfer an object into anDeLesley Hutchins2013-08-29
| | | | | | unknown state. Patch by chris.wailes@gmail.com. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189612 91177308-0d34-0410-b5e6-96231b3b80d8
* Silencing the warning from r189605 in a more conformant manner.Aaron Ballman2013-08-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189606 91177308-0d34-0410-b5e6-96231b3b80d8
* Silencing a rather spurious warning from MSVC 11 about not all control paths ↵Aaron Ballman2013-08-29
| | | | | | returning a value (hint: they do). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189605 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix warning about anonymous structs in anonymous unions.Eric Christopher2013-08-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189596 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analysis: improve handling of conditionals.DeLesley Hutchins2013-08-29
| | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189594 91177308-0d34-0410-b5e6-96231b3b80d8
* Consumed analyis: Renamed *PStatus to *PInfo.DeLesley Hutchins2013-08-26
| | | | | | | | | The change was made for readability, as the PropagationInfo objects don't always contain a status. This is submitted as a separate patch because it touches a lot of lines and I don't want it cluttering up the next patch. Patch by chris.wailes@gmail.com. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189278 91177308-0d34-0410-b5e6-96231b3b80d8
* Update to consumed analysis.DeLesley Hutchins2013-08-22
| | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189059 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence a warning from MSVC about not returning a valueReid Kleckner2013-08-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188237 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove Sema includes from Analysis code to fix layeringReid Kleckner2013-08-12
| | | | | | | | | This moves a header-only class from Sema to Analysis and puts the option check in Sema. Patch by Chris Wailes! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188230 91177308-0d34-0410-b5e6-96231b3b80d8