[clang] 5da3937 - [clang-installapi] Remove unnecessary copy (#86808)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 27 14:44:45 PDT 2024


Author: smanna12
Date: 2024-03-27T16:44:41-05:00
New Revision: 5da39372e39f3aebf63e07faf774b6ed37cad3fb

URL: https://github.com/llvm/llvm-project/commit/5da39372e39f3aebf63e07faf774b6ed37cad3fb
DIFF: https://github.com/llvm/llvm-project/commit/5da39372e39f3aebf63e07faf774b6ed37cad3fb.diff

LOG: [clang-installapi] Remove unnecessary copy (#86808)

Reported by Static Analyzer Tool:

In clang::installapi::InstallAPIVisitor::VisitFunctionDecl(clang::FunctionDecl
const *): Using the auto keyword without an & causes the copy of an
object of type DynTypedNode.

Added: 
    

Modified: 
    clang/lib/InstallAPI/Visitor.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/InstallAPI/Visitor.cpp b/clang/lib/InstallAPI/Visitor.cpp
index f8f5d8d53d5691..6476c5107cb5cc 100644
--- a/clang/lib/InstallAPI/Visitor.cpp
+++ b/clang/lib/InstallAPI/Visitor.cpp
@@ -255,7 +255,7 @@ bool InstallAPIVisitor::VisitFunctionDecl(const FunctionDecl *D) {
       return true;
 
     // Skip methods in CXX RecordDecls.
-    for (auto P : D->getASTContext().getParents(*M)) {
+    for (const DynTypedNode &P : D->getASTContext().getParents(*M)) {
       if (P.get<CXXRecordDecl>())
         return true;
     }


        


More information about the cfe-commits mailing list