aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-05-26 13:46:12 +0200
committerGitHub <noreply@github.com>2025-05-26 13:46:12 +0200
commitdff6aee94597fda742c41390b1890a5434215dec (patch)
tree0124fedc7a2b73dd63e7abd1f6f82bf2a8f92193 /clang/lib/Sema/SemaStmt.cpp
parentf17b9a77aa902082e1851c9bed9c7749d450d9df (diff)
downloadllvm-dff6aee94597fda742c41390b1890a5434215dec.zip
llvm-dff6aee94597fda742c41390b1890a5434215dec.tar.gz
llvm-dff6aee94597fda742c41390b1890a5434215dec.tar.bz2
[clang][NFC] Call Stmt::getBeginLoc() once in DiagnoseForRangeVariable (#141472)
...Copies. Instead of three times.
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index ed07064..c943645 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -3172,13 +3172,11 @@ static void DiagnoseForRangeVariableCopies(Sema &SemaRef,
if (SemaRef.inTemplateInstantiation())
return;
+ SourceLocation Loc = ForStmt->getBeginLoc();
if (SemaRef.Diags.isIgnored(
- diag::warn_for_range_const_ref_binds_temp_built_from_ref,
- ForStmt->getBeginLoc()) &&
- SemaRef.Diags.isIgnored(diag::warn_for_range_ref_binds_ret_temp,
- ForStmt->getBeginLoc()) &&
- SemaRef.Diags.isIgnored(diag::warn_for_range_copy,
- ForStmt->getBeginLoc())) {
+ diag::warn_for_range_const_ref_binds_temp_built_from_ref, Loc) &&
+ SemaRef.Diags.isIgnored(diag::warn_for_range_ref_binds_ret_temp, Loc) &&
+ SemaRef.Diags.isIgnored(diag::warn_for_range_copy, Loc)) {
return;
}