[clang-tools-extra] [clang-tidy] let UseAfterMoveFinder::find() return an optional<UseAfterMove> (PR #98100)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 8 17:12:03 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 46a2abb91cb6cfac9b807ae2055cc5f1743405e4 3537fe828bac5678970e106ac89306e465446163 -- clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
index a740b602af..8f4b5e8092 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
@@ -58,7 +58,8 @@ public:
const DeclRefExpr *MovedVariable);
private:
- std::optional<UseAfterMove> findInternal(const CFGBlock *Block, const Expr *MovingCall,
+ std::optional<UseAfterMove> findInternal(const CFGBlock *Block,
+ const Expr *MovingCall,
const ValueDecl *MovedVariable);
void getUsesAndReinits(const CFGBlock *Block, const ValueDecl *MovedVariable,
llvm::SmallVectorImpl<const DeclRefExpr *> *Uses,
@@ -94,8 +95,9 @@ static StatementMatcher inDecltypeOrTemplateArg() {
UseAfterMoveFinder::UseAfterMoveFinder(ASTContext *TheContext)
: Context(TheContext) {}
-std::optional<UseAfterMove> UseAfterMoveFinder::find(Stmt *CodeBlock, const Expr *MovingCall,
- const DeclRefExpr *MovedVariable) {
+std::optional<UseAfterMove>
+UseAfterMoveFinder::find(Stmt *CodeBlock, const Expr *MovingCall,
+ const DeclRefExpr *MovedVariable) {
// Generate the CFG manually instead of through an AnalysisDeclContext because
// it seems the latter can't be used to generate a CFG for the body of a
// lambda.
@@ -123,7 +125,8 @@ std::optional<UseAfterMove> UseAfterMoveFinder::find(Stmt *CodeBlock, const Expr
MoveBlock = &TheCFG->getEntry();
}
- auto TheUseAfterMove = findInternal(MoveBlock, MovingCall, MovedVariable->getDecl());
+ auto TheUseAfterMove =
+ findInternal(MoveBlock, MovingCall, MovedVariable->getDecl());
if (TheUseAfterMove) {
if (const CFGBlock *UseBlock =
@@ -142,9 +145,9 @@ std::optional<UseAfterMove> UseAfterMoveFinder::find(Stmt *CodeBlock, const Expr
return TheUseAfterMove;
}
-std::optional<UseAfterMove> UseAfterMoveFinder::findInternal(const CFGBlock *Block,
- const Expr *MovingCall,
- const ValueDecl *MovedVariable) {
+std::optional<UseAfterMove>
+UseAfterMoveFinder::findInternal(const CFGBlock *Block, const Expr *MovingCall,
+ const ValueDecl *MovedVariable) {
if (Visited.count(Block))
return std::nullopt;
``````````
</details>
https://github.com/llvm/llvm-project/pull/98100
More information about the cfe-commits
mailing list