https://github.com/smanna12 updated 
https://github.com/llvm/llvm-project/pull/97902

>From 1f80c0a172b58ad15d6b1dce02b63ac682bc7dc0 Mon Sep 17 00:00:00 2001
From: "Manna, Soumi" <soumi.ma...@intel.com>
Date: Sat, 6 Jul 2024 09:03:15 -0700
Subject: [PATCH 1/4] [Clang] Remove unnecessary copy

Reported by Static Analyzer Tool:

In clang::ASTNodeImporter::VisitCountAttributedType(clang::CountAttributedType 
const *): Using the auto keyword without an & causes the copy of an object of 
type TypeCoupledDeclRefInfo
---
 clang/lib/AST/ASTImporter.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 4e1b3a5a94de7..0c27f6f5df2da 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -1551,7 +1551,7 @@ ASTNodeImporter::VisitCountAttributedType(const 
CountAttributedType *T) {
   Expr *CountExpr = importChecked(Err, T->getCountExpr());
 
   SmallVector<TypeCoupledDeclRefInfo, 1> CoupledDecls;
-  for (auto TI : T->dependent_decls()) {
+  for (const TypeCoupledDeclRefInfo &TI : T->dependent_decls()) {
     Expected<ValueDecl *> ToDeclOrErr = import(TI.getDecl());
     if (!ToDeclOrErr)
       return ToDeclOrErr.takeError();

>From 8f7f220071c4722fe6e0e5406d317d6523cc5bd3 Mon Sep 17 00:00:00 2001
From: "Manna, Soumi" <soumi.ma...@intel.com>
Date: Tue, 16 Jul 2024 05:49:51 -0700
Subject: [PATCH 2/4] Address review comment

---
 clang/lib/AST/ASTImporter.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 0c27f6f5df2da..a771ef8500ccb 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -1551,7 +1551,7 @@ ASTNodeImporter::VisitCountAttributedType(const 
CountAttributedType *T) {
   Expr *CountExpr = importChecked(Err, T->getCountExpr());
 
   SmallVector<TypeCoupledDeclRefInfo, 1> CoupledDecls;
-  for (const TypeCoupledDeclRefInfo &TI : T->dependent_decls()) {
+  for (const auto &TI : T->dependent_decls()) {
     Expected<ValueDecl *> ToDeclOrErr = import(TI.getDecl());
     if (!ToDeclOrErr)
       return ToDeclOrErr.takeError();

>From 2f655ec94f26c9d806c00e05a0d7714398aa03ab Mon Sep 17 00:00:00 2001
From: "Manna, Soumi" <soumi.ma...@intel.com>
Date: Tue, 16 Jul 2024 05:58:09 -0700
Subject: [PATCH 3/4] fix testing error

---
 clang/lib/AST/ASTImporter.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index a771ef8500ccb..205ed435a525d 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -1551,6 +1551,7 @@ ASTNodeImporter::VisitCountAttributedType(const 
CountAttributedType *T) {
   Expr *CountExpr = importChecked(Err, T->getCountExpr());
 
   SmallVector<TypeCoupledDeclRefInfo, 1> CoupledDecls;
+
   for (const auto &TI : T->dependent_decls()) {
     Expected<ValueDecl *> ToDeclOrErr = import(TI.getDecl());
     if (!ToDeclOrErr)

>From 8fd74d08ff506c78560f95e71fe03230f46a254e Mon Sep 17 00:00:00 2001
From: "Manna, Soumi" <soumi.ma...@intel.com>
Date: Tue, 16 Jul 2024 06:00:12 -0700
Subject: [PATCH 4/4] Fix redundant space

---
 clang/lib/AST/ASTImporter.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 205ed435a525d..a771ef8500ccb 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -1551,7 +1551,6 @@ ASTNodeImporter::VisitCountAttributedType(const 
CountAttributedType *T) {
   Expr *CountExpr = importChecked(Err, T->getCountExpr());
 
   SmallVector<TypeCoupledDeclRefInfo, 1> CoupledDecls;
-
   for (const auto &TI : T->dependent_decls()) {
     Expected<ValueDecl *> ToDeclOrErr = import(TI.getDecl());
     if (!ToDeclOrErr)

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to