summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-1/+1
| | | | llvm-svn: 196510
* Correct hyphenations in comments and assert messagesAlp Toker2013-12-051-1/+1
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities in nearby lines. llvm-svn: 196466
* Thread safety analysis: fix ICE due to missing null check on dyn_cast.DeLesley Hutchins2013-11-261-6/+9
| | | | llvm-svn: 195777
* The code using the StmtPrinterHelper object failed to account for a null ↵Aaron Ballman2013-11-181-44/+39
| | | | | | object in many cases, which could have led to crashes were it ever to be null. Now passing the object by reference instead of by pointer because it is never null in practice. No functional changes intended. llvm-svn: 195043
* Consumed analysis: track state of temporary objects.DeLesley Hutchins2013-11-161-152/+190
| | | | | | | | 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
* Thread-safety analysis: check guarded_by and pt_guarded_by on array access.DeLesley Hutchins2013-11-081-2/+31
| | | | | | Currently supported only with -Wthread-safety-beta. llvm-svn: 194275
* Thread safety analysis: minor bugfix to smart pointer handling, and expandedDeLesley Hutchins2013-11-061-4/+5
| | | | | | test case. llvm-svn: 194157
* Thread safety analysis: check pt_guarded_by attribute when calling -> and *DeLesley Hutchins2013-11-051-0/+8
| | | | | | on smart pointers. -Wthread-safety-beta only. llvm-svn: 194103
* Fixed bug with checking the kind of types.Chris Wailes2013-10-311-4/+8
| | | | | | | | | | | | | | 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. llvm-svn: 193751
* Changed tests_typestate to test_typestate for consistency.Chris Wailes2013-10-291-4/+4
| | | | llvm-svn: 193648
* Used OwningPtr to clean up some memory management in Consumed.cpp.Chris Wailes2013-10-251-12/+7
| | | | llvm-svn: 193414
* Replaced duplicate code with calls to forwardInfo.Chris Wailes2013-10-241-27/+17
| | | | | | Also made move constructor handling safer. llvm-svn: 193347
* CFG: Properly print delegating initializer CFG elements.Jordan Rose2013-10-221-0/+4
| | | | | | | | ...rather than segfaulting. Patch by Enrico P! llvm-svn: 193208
* Simplify some implementations of get*Decl.Rafael Espindola2013-10-191-4/+2
| | | | | | | | | | * NamedDecl and CXXMethodDecl were missing getMostRecentDecl. * The const version can just forward to the non const. * getMostRecentDecl can use cast instead of cast_or_null. This then removes some casts from the callers. llvm-svn: 193039
* Consumed analysis: fix assert failure.DeLesley Hutchins2013-10-181-8/+20
| | | | llvm-svn: 193010
* Consumed analysis: assume that non-const reference parameters are initiallyDeLesley Hutchins2013-10-181-13/+21
| | | | | | 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-26/+34
| | | | | | 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-14/+55
| | | | | | | 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-3/+43
| | | | | | | 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: fix ICE in handling of loop source locations.DeLesley Hutchins2013-10-171-7/+30
| | | | llvm-svn: 192911
* Consumed analysis: replace the consumes attribute with a set_typestateDeLesley Hutchins2013-10-111-4/+18
| | | | | | 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-20/+16
| | | | | | tests_typestate attribute. Patch by chris.wailes@gmail.com. llvm-svn: 192513
* Consumed analysis: check destructor calls.DeLesley Hutchins2013-10-111-20/+55
| | | | | | | 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-36/+139
| | | | | | | | | | | | 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-77/+92
| | | | | | | | 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
* Make sort predicate match the qsort convention.Benjamin Kramer2013-09-221-1/+5
| | | | llvm-svn: 191177
* Fix array_pod_sort predicates after LLVM change.Benjamin Kramer2013-09-221-4/+3
| | | | llvm-svn: 191176
* PR16054: Slight strengthening for -Wsometimes-uninitialized: if we use aRichard Smith2013-09-121-1/+17
| | | | | | | | | | | variable uninitialized every time we reach its (reachable) declaration, or every time we call the surrounding function, promote the warning from -Wmaybe-uninitialized to -Wsometimes-uninitialized. This is still slightly weaker than desired: we should, in general, warn if a use is uninitialized the first time it is evaluated. llvm-svn: 190623
* Fix ICE in consumed analysis when CFG is null.DeLesley Hutchins2013-09-101-2/+6
| | | | llvm-svn: 190447
* Fix a crash introduced in r189828.Matt Beaumont-Gay2013-09-091-1/+1
| | | | | | | The predicates in CXXRecordDecl which test various properties of special members can't be called on incomplete decls. llvm-svn: 190353
* Avoid double edges when constructing CFGsPavel Labath2013-09-061-2/+5
| | | | | | | | | | | | | | | | | | | | | Summary: If a noreturn destructor is executed while returning a value from a function, the resulting CFG has had two edges to the exit block. This crashed the analyzer, because it expects that blocks with no terminators have only one outgoing edge. I added code to avoid creating the second edge in this case. PS: The crashes did not manifest themselves always, as usually the NoReturnFunctionChecker would stop program evaluation before the analyzer hit the assertion, but in the case of lifetime extended temporaries, the checker failed to do that (which is a separate bug in itself). Reviewers: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1513 llvm-svn: 190125
* Consumed Analysis: The 'consumable' attribute now takes a identifier ↵David Blaikie2013-09-061-50/+60
| | | | | | | | | | | | | 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
* Fix non-void return warning, and format.Eric Christopher2013-09-031-3/+4
| | | | llvm-svn: 189845
* Consumed analysis: add return_typestate attribute.DeLesley Hutchins2013-09-031-4/+104
| | | | | | | | | | 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
* Add an implicit dtor CFG node just before C++ 'delete' expressions.Jordan Rose2013-09-031-0/+41
| | | | | | | | | | | | | | This paves the way for adding support for modeling the destructor of a region before it is deleted. The statement "delete <expr>" now generates this series of CFG elements: 1. <expr> 2. [B1.1]->~Foo() (Implicit destructor) 3. delete [B1.1] Patch by Karthik Bhat! llvm-svn: 189828
* [analyzer] Add very limited support for temporary destructorsPavel Labath2013-09-021-2/+3
| | | | | | | | | | | | | | | | | | | | | This is an improved version of r186498. It enables ExprEngine to reason about temporary object destructors. However, these destructor calls are never inlined, since this feature is still broken. Still, this is sufficient to properly handle noreturn temporary destructors. Now, the analyzer correctly handles expressions like "a || A()", and executes the destructor of "A" only on the paths where "a" evaluted to false. Temporary destructor processing is still off by default and one has to explicitly request it by setting cfg-temporary-dtors=true. Reviewers: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1259 llvm-svn: 189746
* Consumed analysis: add 'consumable' class attribute.DeLesley Hutchins2013-08-301-41/+10
| | | | | | | | | | | | 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-10/+27
| | | | | | Patch by chris.wailes@gmail.com. llvm-svn: 189616
* Consumed analysis: non-const methods no longer transfer an object into anDeLesley Hutchins2013-08-291-12/+2
| | | | | | unknown state. Patch by chris.wailes@gmail.com. llvm-svn: 189612
* Silencing the warning from r189605 in a more conformant manner.Aaron Ballman2013-08-291-1/+1
| | | | llvm-svn: 189606
* Silencing a rather spurious warning from MSVC 11 about not all control paths ↵Aaron Ballman2013-08-291-0/+1
| | | | | | returning a value (hint: they do). llvm-svn: 189605
* Fix warning about anonymous structs in anonymous unions.Eric Christopher2013-08-291-6/+8
| | | | llvm-svn: 189596
* Consumed analysis: improve handling of conditionals.DeLesley Hutchins2013-08-291-178/+473
| | | | | | | | | | | | | | 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 analyis: Renamed *PStatus to *PInfo.DeLesley Hutchins2013-08-261-48/+48
| | | | | | | | | 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. llvm-svn: 189278
* Use pop_back_val() instead of both back() and pop_back().Robert Wilhelm2013-08-233-13/+9
| | | | | | No functionality change intended. llvm-svn: 189112
* [analyzer] Refactor conditional expression evaluating codePavel Labath2013-08-231-0/+18
| | | | | | | | | | | | | | | | | | | Summary: Instead of digging through the ExplodedGraph, to figure out which edge brought us here, I compute the value of conditional expression by looking at the sub-expression values. To do this, I needed to change the liveness algorithm a bit -- now, the full conditional expression also depends on all atomic sub-expressions, not only the outermost ones. Reviewers: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1340 llvm-svn: 189090
* Update to consumed analysis.DeLesley Hutchins2013-08-221-76/+93
| | | | | | | | | | | 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
* Analysis: Make %I in printf more reasonable, add more testsDavid Majnemer2013-08-221-4/+5
| | | | llvm-svn: 188992
* Analysis: Add support for MS specific printf format specifiersDavid Majnemer2013-08-213-7/+81
| | | | | | | | | | | | | | Summary: Adds support for %I, %I32 and %I64. Reviewers: hans, jordan_rose, rnk, majnemer Reviewed By: majnemer CC: cfe-commits, cdavis5x Differential Revision: http://llvm-reviews.chandlerc.com/D1456 llvm-svn: 188937
* Omit arguments of __builtin_object_size from the CFG.Jordan Rose2013-08-191-1/+17
| | | | | | | | | | | | | | | | | This builtin does not actually evaluate its arguments for side effects, so we shouldn't include them in the CFG. In the analyzer, rely on the constant expression evaluator to get the proper semantics, at least for now. (In the future, we could get ambitious and try to provide path- sensitive size values.) In theory, this does pose a problem for liveness analysis: a variable can be used within the __builtin_object_size argument expression but not show up as live. However, it is very unlikely that such a value would be used to compute the object size and not used to access the object in some way. <rdar://problem/14760817> llvm-svn: 188679
OpenPOWER on IntegriCloud