https://github.com/Amila-Rukshan created 
https://github.com/llvm/llvm-project/pull/87273

Fix the cppcheck identified performance issue: 
https://github.com/llvm/llvm-project/issues/87248

I ran the following to check the possible perf issue in 
`clang/lib/ASTMatchers/Dynamic` directory:
```
cppcheck --enable=performance --language=c++ .
```

>From addf9911ffb22eb96f6b26e6a7eabcb8cc325123 Mon Sep 17 00:00:00 2001
From: amila <amila...@cse.mrt.ac.lk>
Date: Tue, 2 Apr 2024 00:15:59 +0530
Subject: [PATCH] cppcheck: pass NodeKinds by const reference

Signed-off-by: amila <amila...@cse.mrt.ac.lk>
---
 clang/lib/ASTMatchers/Dynamic/Marshallers.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/ASTMatchers/Dynamic/Marshallers.h 
b/clang/lib/ASTMatchers/Dynamic/Marshallers.h
index c76ddf17b719d4..fc0771d7496df2 100644
--- a/clang/lib/ASTMatchers/Dynamic/Marshallers.h
+++ b/clang/lib/ASTMatchers/Dynamic/Marshallers.h
@@ -936,7 +936,7 @@ class MapAnyOfMatcherDescriptor : public MatcherDescriptor {
 
 public:
   MapAnyOfMatcherDescriptor(ASTNodeKind CladeNodeKind,
-                            std::vector<ASTNodeKind> NodeKinds)
+                            const std::vector<ASTNodeKind>& NodeKinds)
       : CladeNodeKind(CladeNodeKind), NodeKinds(NodeKinds) {}
 
   VariantMatcher create(SourceRange NameRange, ArrayRef<ParserValue> Args,

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

Reply via email to