-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Clang][NFC] Remove unnecessary copy #97902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
@llvm/pr-subscribers-clang Author: None (smanna12) ChangesReported 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 Full diff: https://github.com/llvm/llvm-project/pull/97902.diff 1 Files Affected:
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();
|
Thank you, @cor3ntin for reviews! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this issue! I left a minor comment. Other than that, LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a NFC tag to the subject? (patch subject; commit message are completely ignored since we use "Squash and merge")
Thank you everyone for reviews! |
Summary: 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 Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251598
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