aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/Consumed.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-07-18[NFC] Header cleanupMehdi Amini1-4/+1
Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
2016-06-24Use more ArrayRefsDavid Majnemer1-1/+1
No functional change is intended, just a small refactoring. llvm-svn: 273647
2016-06-21Re-commit "[Temporary] Add an ExprWithCleanups for each C++ ↵Tim Shen1-0/+6
MaterializeTemporaryExpr." Since D21243 fixes relative clang-tidy tests. This reverts commit a71d9fbd41e99def9159af2b01ef6509394eaeed. llvm-svn: 273312
2016-06-09Revert "[Temporary] Add an ExprWithCleanups for each C++ ↵Tim Shen1-6/+0
MaterializeTemporaryExpr." This reverts r272296, since there are clang-tidy failures that appear to be caused by this change. llvm-svn: 272310
2016-06-09[Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr.Tim Shen1-0/+6
These ExprWithCleanups are added for holding a RunCleanupsScope not for destructor calls; rather, they are for lifetime marks. This requires ExprWithCleanups to keep a bit to indicate whether it have cleanups with side effects (e.g. dtor calls). Differential Revision: http://reviews.llvm.org/D20498 llvm-svn: 272296
2015-10-20Roll-back r250822.Angel Garcia Gomez1-1/+1
Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
2015-10-20Apply modernize-use-default to clang.Angel Garcia Gomez1-1/+1
Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
2015-08-14unique_ptrify ConsumedBlockInfo analysis to make it move assignableDavid Blaikie1-72/+55
ConsumedBlockInfo objects were move assigned, but only in a state where the dtor was a no-op anyway. Subtle and easily could've happened in ways that wouldn't've been safe - so this change makes it safe no matter what state the ConsumedBlockInfo object is in. llvm-svn: 244998
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-4/+2
llvm-svn: 240353
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-2/+4
The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
2015-04-15Fix for PR20402 in -Wconsumed.DeLesley Hutchins1-1/+1
https://llvm.org/bugs/show_bug.cgi?id=20402 Patch by Chris Wailes. llvm-svn: 235051
2015-03-09Make helper functions staticBenjamin Kramer1-7/+6
NFC. llvm-svn: 231657
2014-09-23Reverting r214064 and r215650 while investigating a pesky performance regressionArtyom Skrobov1-1/+1
llvm-svn: 218296
2014-08-14Use the proper post-order traversal in LiveVariables analysis,Artyom Skrobov1-1/+1
to recover the performance after r214064. Also sorts out the naming for PostOrderCFGView, ReversePostOrderCFGView, BackwardDataflowWorklist and ForwardDataflowWorklist, to match the accepted terminology. Also unifies BackwardDataflowWorklist and ForwardDataflowWorklist to share the "worklist for prioritization, post-order traversal for fallback" logic, and to avoid repetitive sorting. Also cleans up comments in the affected area. llvm-svn: 215650
2014-05-28Move the logic for testing for namespace std into one location. This check canRichard Trieu1-13/+2
be performed by using Decl::isInStdNamespace or DeclContext::isStdNamespace llvm-svn: 209708
2014-05-20[C++11] Use 'nullptr'. Analysis edition.Craig Topper1-22/+22
llvm-svn: 209191
2014-05-08Explicitly keep track of temporaries during the consumed analysis.Manuel Klimek1-4/+3
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
2014-05-02Updated the attribute tablegen emitter for variadic arguments to emit a ↵Aaron Ballman1-7/+3
range accessor in addition to the iterators. Updated code using iterators to use range-based for loops. llvm-svn: 207837
2014-05-02Renaming the CallableState variadic attribute argument to be CallableStates. ↵Aaron Ballman1-2/+2
No functional changes intended. llvm-svn: 207836
2014-04-28Renaming range-based for loop variables so they don't appear iterator-like.Aaron Ballman1-23/+23
llvm-svn: 207422
2014-04-28[C++11] Converting to range-based for loops. No functional changes intended.Aaron Ballman1-46/+27
llvm-svn: 207416
2014-03-20Consumed Analysis: IgnoreParens bugfix.DeLesley Hutchins1-29/+38
llvm-svn: 204395
2014-03-14[C++11] Replacing DeclStmt iterators decl_begin() and decl_end() with ↵Aaron Ballman1-5/+3
iterator_range decls(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203947
2014-03-09[C++11] Replace OwningPtr include with <memory>.Ahmed Charles1-1/+1
llvm-svn: 203389
2014-03-07Replace OwningPtr with std::unique_ptr.Ahmed Charles1-2/+3
This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
2014-03-07Change OwningPtr::take() to OwningPtr::release().Ahmed Charles1-2/+2
This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
2014-03-07[C++11] Replacing FunctionDecl iterators param_begin() and param_end() with ↵Aaron Ballman1-3/+2
iterator_range params(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203248
2014-01-16Consumed analysis: bugfix for operator calls. Also fixes some formattingDeLesley Hutchins1-16/+12
issues, a few testcases, and kills fish. llvm-svn: 199436
2014-01-14Consumed analysis: add two new attributes which fine-tune the behavior ofDeLesley Hutchins1-221/+222
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
2014-01-07Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth1-2/+2
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. llvm-svn: 198686
2013-12-19Switched code from using hasAttr followed by getAttr to simply call getAttr ↵Aaron Ballman1-74/+43
directly and check the resulting value. Also fixes some minor formatting issues surrounding the getAttr code. No functional changes intended. llvm-svn: 197649
2013-12-17For -Wconsumed, walk the namespaces to find if the top most namespace is "std"Richard Trieu1-2/+13
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
2013-12-16Fix PR18260 - Make std::move handling in -Wconsumed only trigger on std::moveRichard Trieu1-1/+2
llvm-svn: 197428
2013-11-16Consumed analysis: track state of temporary objects.DeLesley Hutchins1-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
2013-10-31Fixed bug with checking the kind of types.Chris Wailes1-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
2013-10-29Changed tests_typestate to test_typestate for consistency.Chris Wailes1-4/+4
llvm-svn: 193648
2013-10-25Used OwningPtr to clean up some memory management in Consumed.cpp.Chris Wailes1-12/+7
llvm-svn: 193414
2013-10-24Replaced duplicate code with calls to forwardInfo.Chris Wailes1-27/+17
Also made move constructor handling safer. llvm-svn: 193347
2013-10-18Consumed analysis: fix assert failure.DeLesley Hutchins1-8/+20
llvm-svn: 193010
2013-10-18Consumed analysis: assume that non-const reference parameters are initiallyDeLesley Hutchins1-13/+21
in the "uknown" state. Patch by chris.wailes@gmail.com. Reviewed by delesley. llvm-svn: 192995
2013-10-18Consumed analysis: All the return_typestate parameter to be attached to theDeLesley Hutchins1-26/+34
default constructor. Patch by chris.wailes@gmail.com, reviewed by delesley. llvm-svn: 192991
2013-10-17Consumed analysis: Add param_typestate attribute, which specifies thatDeLesley Hutchins1-14/+55
function parameters must be in a particular state. Patch by chris.wailes@gmail.com. Reviewed by delesley@google.com. llvm-svn: 192934
2013-10-17Consumed Analysis: Allow parameters that are passed by non-const referenceDeLesley Hutchins1-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
2013-10-17Consumed analysis: fix ICE in handling of loop source locations.DeLesley Hutchins1-7/+30
llvm-svn: 192911
2013-10-11Consumed analysis: replace the consumes attribute with a set_typestateDeLesley Hutchins1-4/+18
attribute. Patch by chris.wailes@gmail.com; reviewed and edited by delesley. llvm-svn: 192515
2013-10-11Consumed analysis: switch from tests_consumed/unconsumed to a generalDeLesley Hutchins1-20/+16
tests_typestate attribute. Patch by chris.wailes@gmail.com. llvm-svn: 192513
2013-10-11Consumed analysis: check destructor calls.DeLesley Hutchins1-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
2013-10-09Consumed analysis: improve loop handling. The prior version of the analysisDeLesley Hutchins1-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
2013-10-04Consumed Analysis: Change callable_when so that it can take a list of statesDeLesley Hutchins1-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
2013-09-10Fix ICE in consumed analysis when CFG is null.DeLesley Hutchins1-2/+6
llvm-svn: 190447