aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/Consumed.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-05-31[Analysis] Remove unused includes (NFC) (#142255)Kazu Hirata1-3/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2024-11-27[Clang] skip consumed analysis for consteval conditions in control-flow ↵Oleksandr T.1-0/+3
terminators (#117403) Fixes #117385 --- These changes extend the work done in #116513. The changes add additional handling to ensure correct behavior by skipping further checks when a **CFG** contains a `consteval` condition, where no _explicit expression_ is present, which is required to proceed with consumed analyses.
2024-07-31[clang][NFC] Add Type::isPointerOrReferenceType() (#101206)Timm Baeder1-7/+3
Seems to be a common pattern.
2023-10-02[C++] Implement "Deducing this" (P0847R7)Corentin Jabot1-2/+2
This patch implements P0847R7 (partially), CWG2561 and CWG2653. Reviewed By: aaron.ballman, #clang-language-wg Differential Revision: https://reviews.llvm.org/D140828
2023-09-05[HLSL] Cleanup support for `this` as an l-valueChris Bieneman1-2/+2
The goal of this change is to clean up some of the code surrounding HLSL using CXXThisExpr as a non-pointer l-value. This change cleans up a bunch of assumptions and inconsistencies around how the type of `this` is handled through the AST and code generation. This change is be mostly NFC for HLSL, and completely NFC for other language modes. This change introduces a new member to query for the this object's type and seeks to clarify the normal usages of the this type. With the introudction of HLSL to clang, CXXThisExpr may now be an l-value and behave like a reference type rather than C++'s normal method of it being an r-value of pointer type. With this change there are now three ways in which a caller might need to query the type of `this`: * The type of the `CXXThisExpr` * The type of the object `this` referrs to * The type of the implicit (or explicit) `this` argument This change codifies those three ways you may need to query respectively as: * CXXMethodDecl::getThisType() * CXXMethodDecl::getThisObjectType() * CXXMethodDecl::getThisArgType() This change then revisits all uses of `getThisType()`, and in cases where the only use was to resolve the pointee type, it replaces the call with `getThisObjectType()`. In other cases it evaluates whether the desired returned type is the type of the `this` expr, or the type of the `this` function argument. The `this` expr type is used for creating additional expr AST nodes and for member lookup, while the argument type is used mostly for code generation. Additionally some cases that used `getThisType` in simple queries could be substituted for `getThisObjectType`. Since `getThisType` is implemented in terms of `getThisObjectType` calling the later should be more efficient if the former isn't needed. Reviewed By: aaron.ballman, bogner Differential Revision: https://reviews.llvm.org/D159247
2023-01-14[clang] Remove remaining uses of llvm::Optional (NFC)Kazu Hirata1-1/+0
This patch removes several "using" declarations and #include "llvm/ADT/Optional.h". This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14[clang] Use std::optional instead of llvm::Optional (NFC)Kazu Hirata1-2/+2
This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to remove #include "llvm/ADT/Optional.h". This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14[clang] Add #include <optional> (NFC)Kazu Hirata1-0/+1
This patch adds #include <optional> to those files containing llvm::Optional<...> or Optional<...>. I'll post a separate patch to actually replace llvm::Optional with std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2019-11-19[NFC] Refactor representation of materialized temporariesTyker1-1/+1
Summary: this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718 Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: thakis, sammccall, ilya-biryukov, rnkovacs, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69360
2019-11-17Revert "[NFC] Refactor representation of materialized temporaries"Nico Weber1-1/+1
This reverts commit 08ea1ee2db5f9d6460fef1d79d0d1d1a5eb78982. It broke ./ClangdTests/FindExplicitReferencesTest.All on the bots, see comments on https://reviews.llvm.org/D69360
2019-11-16[NFC] Refactor representation of materialized temporariesTyker1-1/+1
Summary: this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718 Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: rnkovacs, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69360
2019-09-27Revert r373034Nicholas Allegra1-23/+20
It breaks the build on MSVC. llvm-svn: 373039
2019-09-26[Consumed][NFC] Refactor handleCall to take function argument list.Nicholas Allegra1-20/+23
Differential Revision: https://reviews.llvm.org/D67569 llvm-svn: 373034
2019-09-19[Consumed] Treat by-value class arguments as consuming by default, like ↵Nicholas Allegra1-3/+3
rvalue refs. Differential Revision: https://reviews.llvm.org/D67743 llvm-svn: 372361
2019-08-14[Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere1-3/+3
Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368942
2019-05-24[CFG] NFC: Remove implicit conversion from CFGTerminator to Stmt *.Artem Dergachev1-1/+1
Turn it into a variant class instead. This conversion does indeed save some code but there's a plan to add support for more kinds of terminators that aren't necessarily based on statements, and with those in mind it becomes more and more confusing to have CFGTerminators implicitly convertible to a Stmt *. Differential Revision: https://reviews.llvm.org/D61814 llvm-svn: 361586
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-4/+3
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2019-01-11[AST] Remove ASTContext from getThisType (NFC)Brian Gesiak1-10/+6
Summary: https://reviews.llvm.org/D54862 removed the usages of `ASTContext&` from within the `CXXMethodDecl::getThisType` method. Remove the parameter altogether, as well as all usages of it. This does not result in any functional change because the parameter was unused since https://reviews.llvm.org/D54862. Test Plan: check-clang Reviewers: akyrtzi, mikael Reviewed By: mikael Subscribers: mehdi_amini, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D56509 llvm-svn: 350914
2018-08-09Port getLocEnd -> getEndLocStephen Kelly1-1/+1
Reviewers: teemperor! Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50351 llvm-svn: 339386
2018-08-09Port getLocStart -> getBeginLocStephen Kelly1-4/+4
Reviewers: teemperor! Subscribers: jholewinski, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50350 llvm-svn: 339385
2018-07-30Remove trailing spaceFangrui Song1-108/+108
sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
2018-03-13[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko1-103/+68
other minor fixes (NFC). llvm-svn: 327453
2017-09-28Consolidate std::move() detection code. No behavior change.Nico Weber1-2/+1
llvm-svn: 314427
2017-09-06[CSA] [NFC] Move AnalysisContext.h to AnalysisDeclContext.hGeorge Karpenkov1-1/+1
The implementation is in AnalysisDeclContext.cpp and the class is called AnalysisDeclContext. Making those match up has numerous benefits, including: - Easier jump from header to/from implementation. - Easily identify filename from class. Differential Revision: https://reviews.llvm.org/D37500 llvm-svn: 312671
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