Skip to content

Commit dff6aee

Browse files
authored
[clang][NFC] Call Stmt::getBeginLoc() once in DiagnoseForRangeVariable (#141472)
...Copies. Instead of three times.
1 parent f17b9a7 commit dff6aee

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

clang/lib/Sema/SemaStmt.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3172,13 +3172,11 @@ static void DiagnoseForRangeVariableCopies(Sema &SemaRef,
31723172
if (SemaRef.inTemplateInstantiation())
31733173
return;
31743174

3175+
SourceLocation Loc = ForStmt->getBeginLoc();
31753176
if (SemaRef.Diags.isIgnored(
3176-
diag::warn_for_range_const_ref_binds_temp_built_from_ref,
3177-
ForStmt->getBeginLoc()) &&
3178-
SemaRef.Diags.isIgnored(diag::warn_for_range_ref_binds_ret_temp,
3179-
ForStmt->getBeginLoc()) &&
3180-
SemaRef.Diags.isIgnored(diag::warn_for_range_copy,
3181-
ForStmt->getBeginLoc())) {
3177+
diag::warn_for_range_const_ref_binds_temp_built_from_ref, Loc) &&
3178+
SemaRef.Diags.isIgnored(diag::warn_for_range_ref_binds_ret_temp, Loc) &&
3179+
SemaRef.Diags.isIgnored(diag::warn_for_range_copy, Loc)) {
31823180
return;
31833181
}
31843182

0 commit comments

Comments
 (0)