summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/auto-obj-dtors-cfg-output.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [CFG] Make representation of destructor calls more accurate.Artem Dergachev2019-08-281-2/+2
| | | | | | | | | | | | | | | | | Respect C++17 copy elision; previously it would generate destructor calls for elided temporaries, including in initialization and return statements. Don't generate duplicate destructor calls for statement expressions. Fix destructors in initialization lists and comma operators. Improve printing of implicit destructors. Patch by Nicholas Allegra! Differential Revision: https://reviews.llvm.org/D66404 llvm-svn: 370247
* [CFG] [analyzer] Simplify lifetime-extended temporary construction contexts.Artem Dergachev2018-06-281-6/+6
| | | | | | | | | | | | | | When a temporary object is materialized and through that obtain lifetime that is longer than the duration of the full-expression, it does not require a temporary object destructor; it will be destroyed in a different manner. Therefore it's not necessary to include CXXBindTemporaryExpr into the construction context for such temporary in the CFG only to make clients throw it away. Differential Revision: https://reviews.llvm.org/D47667 llvm-svn: 335798
* [CFG] Fix automatic destructors when a member is bound to a reference.Artem Dergachev2018-06-041-4/+291
| | | | | | | | | | | | | | | | | | | In code like const int &x = A().x; automatic destructor for the object A() lifetime-extended by reference 'x' was not present in the clang CFG due to ad-hoc pattern-matching in getReferenceInitTemporaryType(). Re-use skipRValueSubobjectAdjustments() again to find the lifetime-extended object in the AST and emit the correct destructor. Lifetime extension through aggregates with references still needs to be covered. Differential Revision: https://reviews.llvm.org/D44238 llvm-svn: 333941
* [CFG] [analyzer] Add construction contexts for loop condition variables.Artem Dergachev2018-04-191-4/+8
| | | | | | | | | | | | | | | | | Loop condition variables, eg. while (shared_ptr<int> P = getIntPtr()) { ... }) weren't handled in r324794 because they don't go through the common CFGBuilder::VisitDeclStmt method. Which means that they regressed after r324800. Fix the regression by duplicating the necessary construction context scan in the loop visiting code. Differential Revision: https://reviews.llvm.org/D45706 llvm-svn: 330382
* [CFG] Provide construction contexts for temporaries bound to const references.Artem Dergachev2018-02-241-1/+1
| | | | | | | | | | In order to bind a temporary to a const lvalue reference, a no-op cast is added to make the temporary itself const, and only then the reference is taken (materialized). Skip the no-op cast when looking for the construction context. Differential Revision: https://reviews.llvm.org/D43481 llvm-svn: 326016
* [CFG] Provide construction contexts for temproary objects.Artem Dergachev2018-02-151-1/+2
| | | | | | | | | | | | | | | Constructors of C++ temporary objects that have destructors now can be queried to discover that they're indeed constructing temporary objects. The respective CXXBindTemporaryExpr, which is also repsonsible for destroying the temporary at the end of full-expression, is now available at the construction site in the CFG. This is all the context we need to provide for temporary objects that are not lifetime extended. For lifetime-extended temporaries, more context is necessary. Differential Revision: https://reviews.llvm.org/D43056 llvm-svn: 325210
* [CFG] Add construction context for simple variable declarations.Artem Dergachev2018-02-101-52/+113
| | | | | | | | | Constructors of simple variables now can be queried to discover that they're constructing into simple variables. Differential Revision: https://reviews.llvm.org/D42699 llvm-svn: 324794
* Reland 4: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen2017-03-031-1/+1
| | | | | | | | | | | | | | constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296895
* Revert "Reland 3: [analyzer] NFC: Update test infrastructure to support ↵Dominic Chen2017-03-021-1/+1
| | | | | | | | multiple constraint managers" This reverts commit ea36f1406e1f36bf456c3f3929839b024128e468. llvm-svn: 296841
* Reland 3: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen2017-03-021-1/+1
| | | | | | | | | | | | | | constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296837
* Revert "Reland 2: [analyzer] NFC: Update test infrastructure to support ↵Dominic Chen2017-03-021-1/+1
| | | | | | | | multiple constraint managers" This reverts commit f93343c099fff646a2314cc7f4925833708298b1. llvm-svn: 296836
* Reland 2: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen2017-03-021-1/+1
| | | | | | | | | | | | | | constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296835
* Revert "Reland: [analyzer] NFC: Update test infrastructure to support ↵Dominic Chen2017-02-281-1/+1
| | | | | | | | multiple constraint managers" This reverts commit 1b28d0b10e1c8feccb971abb6ef7a18bee589830. llvm-svn: 296422
* Reland: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen2017-02-281-1/+1
| | | | | | | | | | | | | | constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296414
* Revert "[analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen2017-02-271-1/+1
| | | | | | | | constraint managers" This reverts commit 8e7780b9e59ddaad1800baf533058d2c064d4787. llvm-svn: 296317
* [analyzer] NFC: Update test infrastructure to support multiple constraint ↵Dominic Chen2017-02-271-1/+1
| | | | | | | | | | | | | | managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296312
* Reapply "Pretty Printer: Fix printing of conversion operator decls and calls."Benjamin Kramer2014-02-251-8/+8
| | | | | | There were many additional tests that had the bad behavior baked in. llvm-svn: 202174
* [analyzer] Restructure a test filePavel Labath2013-09-051-708/+707
| | | | | | | | | | | | | | | | Summary: I've had a test failure here while experimenting and I've found that it's impossible to find what is wrong with the previous structure of the file. So I have grouped the expected output with the function that produces it, to make searching for discrepancies more obvious. Reviewers: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1595 llvm-svn: 190037
* Remove useless 'XPASS: *' from testsDmitri Gribenko2013-01-251-1/+0
| | | | llvm-svn: 173511
* [analyzer] Always include destructors in the analysis CFG.Jordan Rose2012-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | While destructors will continue to not be inlined (unless the analyzer config option 'c++-inlining' is set to 'destructors'), leaving them out of the CFG is an incomplete model of the behavior of an object, and can cause false positive warnings (like PR13751, now working). Destructors for temporaries are still not on by default, since (a) we haven't actually checked this code to be sure it's fully correct (in particular, we probably need to be very careful with regard to lifetime-extension when a temporary is bound to a reference, C++11 [class.temporary]p5), and (b) ExprEngine doesn't actually do anything when it sees a temporary destructor in the CFG -- not even invalidate the object region. To enable temporary destructors, set the 'cfg-temporary-dtors' analyzer config option to '1'. The old -cfg-add-implicit-dtors cc1 option, which controlled all implicit destructors, has been removed. llvm-svn: 163264
* Refine CFG so that '&&' and '||' don't lead to extra confluence points when ↵Ted Kremenek2012-07-141-147/+148
| | | | | | | | | | | | | | | | | | used in a branch, but instead push the terminator for the branch down into the basic blocks of the subexpressions of '&&' and '||' respectively. This eliminates some artifical control-flow from the CFG and results in a more compact CFG. Note that this patch only alters the branches 'while', 'if' and 'for'. This was complex enough for one patch. The remaining branches (e.g., do...while) can be handled in a separate patch, but they weren't immediately tackled because they were less important. It is possible that this patch introduces some subtle bugs, particularly w.r.t. to destructor placement. I've tried to audit these changes, but it is also known that the destructor logic needs some refinement in the area of '||' and '&&' regardless (i.e., their are known bugs). llvm-svn: 160218
* [analyzer] Use recursive AST visitor to drive simple visitation order inAnna Zaks2012-03-131-9/+17
| | | | | | | | | | | | | AnalysisConsumer. As a result: - We now analyze the C++ methods which are defined within the class body. These were completely skipped before. - Ensure that AST checkers are called on functions in the order they are defined in the Translation unit. llvm-svn: 152650
* [analyzer] fix regression in analyzer of NOT actually aborting on Stmts it ↵Ted Kremenek2012-03-101-4/+16
| | | | | | | | | | | doesn't understand. We registered as aborted, but didn't treat such cases as sinks in the ExplodedGraph. Along the way, add basic support for CXXCatchStmt, expanding the set of code we actually analyze (hopefully correctly). Fixes: <rdar://problem/10892489> llvm-svn: 152468
* Colorize and condense CFG pretty-printing.Ted Kremenek2011-12-221-721/+685
| | | | llvm-svn: 147203
* Added missing ImplicitCastExpr around conversion operator call.Abramo Bagnara2011-11-161-8/+16
| | | | llvm-svn: 144850
* [analyzer] Overhaul how the static analyzer expects CFGs by forcing CFGs to ↵Ted Kremenek2011-07-281-651/+714
| | | | | | | | | | | | be linearized only when used by the static analyzer. This required a rewrite of LiveVariables, and exposed a ton of subtle bugs. The motivation of this large change is to drastically simplify the logic in ExprEngine going forward. Some fallout is that the output of some BugReporterVisitors is not as accurate as before; those will need to be fixed over time. There is also some possible performance regression as RemoveDeadBindings will be called frequently; this can also be improved over time. llvm-svn: 136419
* Fix PR 9626 (duplicated self-init warnings under -Wuninitialized) with ↵Ted Kremenek2011-04-041-87/+61
| | | | | | | | | | | | | | numerous CFG and UninitializedValues analysis changes: 1) Change the CFG to include the DeclStmt for conditional variables, instead of using the condition itself as a faux DeclStmt. 2) Update ExprEngine (the static analyzer) to understand (1), so not to regress. 3) Update UninitializedValues.cpp to initialize all tracked variables to Uninitialized at the start of the function/method. 4) Only use the SelfReferenceChecker (SemaDecl.cpp) on global variables, leaving the dataflow analysis to handle other cases. The combination of (1) and (3) allows the dataflow-based -Wuninitialized to find self-init problems when the initializer contained control-flow. llvm-svn: 128858
* Add -fcxx-exceptions to all tests that use C++ exceptions.Anders Carlsson2011-02-281-1/+1
| | | | llvm-svn: 126599
* Pass -fexceptions to all tests that use try/catch/throw.Anders Carlsson2011-02-191-1/+1
| | | | llvm-svn: 126037
* [analyzer] Use the new registration mechanism for the debugging info "checks".Argyrios Kyrtzidis2011-02-171-1/+1
| | | | | | | | | | The relative checker package is 'debug': '-dump-live-variables' is replaced by '-analyzer-checker=debug.DumpLiveVars' '-cfg-view' is replaced by '-analyzer-checker=debug.ViewCFG' '-cfg-dump' is replaced by '-analyzer-checker=debug.DumpCFG' llvm-svn: 125780
* Make all CXXConstructExpr's block-level expressions. This is required by Zhongxing Xu2010-11-011-623/+672
| | | | | | method inlining. Temporarily fail a test case. llvm-svn: 117907
* Added generation of destructors for constant size arrays.Marcin Swiderski2010-10-251-0/+17
| | | | | | There's only one destructor call generated for each not empty array (at least for now this should be enough). llvm-svn: 117251
* Added generating CFGAutomaticObjDtors for exception variable in catch statement.Marcin Swiderski2010-10-011-0/+41
| | | | llvm-svn: 115266
* Added generating CFGAutomaticObjDtors for init statement, condition variable ↵Marcin Swiderski2010-10-011-0/+126
| | | | | | and implicit scope in for statement. llvm-svn: 115265
* dded generating CFGAutomaticObjDtors for condition variable and implicit ↵Marcin Swiderski2010-10-011-0/+111
| | | | | | scopes in switch statement. llvm-svn: 115264
* Added generating CFGAutomaticObjDtors for condition variable and implicit ↵Marcin Swiderski2010-10-011-0/+224
| | | | | | scopes in while and do statements. llvm-svn: 115262
* Added generating CFGAutomaticObjDtors for condition variable and implicit ↵Marcin Swiderski2010-10-011-0/+116
| | | | | | scopes in if statement. llvm-svn: 115256
* Added:Marcin Swiderski2010-10-011-0/+151
- Adding LocalScope for CompoundStmt, - Adding CFGAutomaticObjDtors for end of scope, return, goto, break, continue, - Regression tests for above cases. llvm-svn: 115252
OpenPOWER on IntegriCloud