Skip to content

Commit 3cf88b8

Browse files
committed
[squash-me] clang-tools-extra
Signed-off-by: Kefu Chai <[email protected]>
1 parent 5cbb966 commit 3cf88b8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ bool reaches(const CFGBlock *Before, const CFGBlock *After) {
8888

8989
Visited.insert(Current);
9090

91-
for (const auto &Succ : Current->succs()) {
92-
if (!Visited.count(Succ))
91+
for (const CFGBlock *Succ : Current->succs()) {
92+
if (Succ && !Visited.contains(Succ))
9393
Stack.push_back(Succ);
9494
}
9595
}
@@ -146,10 +146,10 @@ bool UseAfterMoveFinder::find(Stmt *CodeBlock, const Expr *MovingCall,
146146
MoveBlock = &TheCFG->getEntry();
147147
}
148148

149-
bool found = findInternal(MoveBlock, MovingCall, MovedVariable->getDecl(),
149+
bool Found = findInternal(MoveBlock, MovingCall, MovedVariable->getDecl(),
150150
TheUseAfterMove);
151151

152-
if (found) {
152+
if (Found) {
153153
if (const CFGBlock *UseBlock =
154154
BlockMap->blockContainingStmt(TheUseAfterMove->DeclRef))
155155
// Does the use happen in a later loop iteration than the move?
@@ -158,11 +158,10 @@ bool UseAfterMoveFinder::find(Stmt *CodeBlock, const Expr *MovingCall,
158158
// - Otherwise, we know the use happened in a later iteration if the
159159
// move is reachable from the use.
160160
TheUseAfterMove->UseHappensInLaterLoopIteration =
161-
UseBlock == MoveBlock ? Visited.count(UseBlock) != 0
161+
UseBlock == MoveBlock ? Visited.contains(UseBlock)
162162
: reaches(UseBlock, MoveBlock);
163163
}
164-
165-
return found;
164+
return Found;
166165
}
167166

168167
bool UseAfterMoveFinder::findInternal(const CFGBlock *Block,

0 commit comments

Comments
 (0)