[clang] [Clang][NFC] Remove unnecessary copy (PR #100688)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 25 20:41:43 PDT 2024
https://github.com/smanna12 created https://github.com/llvm/llvm-project/pull/100688
Reported by Static Analyzer Tool:
In Sema::checkIncorrectVTablePointerAuthenticationAttribute(): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
>From a335fcf97c94a3bf20838e3953b0c68d2aed392b Mon Sep 17 00:00:00 2001
From: "Manna, Soumi" <soumi.manna at intel.com>
Date: Thu, 25 Jul 2024 20:34:48 -0700
Subject: [PATCH] [Clang][NFC] Remove unnecessary copy
Reported by Static Analyzer Tool:
In clang::Sema::checkIncorrectVTablePointerAuthenticationAttribute(clang::CXXRecordDecl &): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
---
clang/lib/Sema/SemaDeclCXX.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 1cca8ac9b9343..5782daa041f32 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -10385,7 +10385,7 @@ void Sema::checkIncorrectVTablePointerAuthenticationAttribute(
while (1) {
assert(PrimaryBase);
const CXXRecordDecl *Base = nullptr;
- for (auto BasePtr : PrimaryBase->bases()) {
+ for (const CXXBaseSpecifier &BasePtr : PrimaryBase->bases()) {
if (!BasePtr.getType()->getAsCXXRecordDecl()->isDynamicClass())
continue;
Base = BasePtr.getType()->getAsCXXRecordDecl();
More information about the cfe-commits
mailing list