[clang] cppcheck: pass NodeKinds by const reference (PR #87273)

Amila Senadheera via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 1 21:18:42 PDT 2024


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

>From 4f8349936403d29ac14179fb7d9e1429a09914ff Mon Sep 17 00:00:00 2001
From: amila <amila.15 at cse.mrt.ac.lk>
Date: Tue, 2 Apr 2024 00:15:59 +0530
Subject: [PATCH] use move semantics for NodeKinds and update possible callers
 to use it

Signed-off-by: amila <amila.15 at cse.mrt.ac.lk>
---
 clang/lib/ASTMatchers/Dynamic/Marshallers.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/ASTMatchers/Dynamic/Marshallers.h b/clang/lib/ASTMatchers/Dynamic/Marshallers.h
index c76ddf17b719d4..0e640cbada7268 100644
--- a/clang/lib/ASTMatchers/Dynamic/Marshallers.h
+++ b/clang/lib/ASTMatchers/Dynamic/Marshallers.h
@@ -937,7 +937,7 @@ class MapAnyOfMatcherDescriptor : public MatcherDescriptor {
 public:
   MapAnyOfMatcherDescriptor(ASTNodeKind CladeNodeKind,
                             std::vector<ASTNodeKind> NodeKinds)
-      : CladeNodeKind(CladeNodeKind), NodeKinds(NodeKinds) {}
+      : CladeNodeKind(CladeNodeKind), NodeKinds(std::move(NodeKinds)) {}
 
   VariantMatcher create(SourceRange NameRange, ArrayRef<ParserValue> Args,
                         Diagnostics *Error) const override {
@@ -1026,7 +1026,7 @@ class MapAnyOfBuilderDescriptor : public MatcherDescriptor {
     }
 
     return std::make_unique<MapAnyOfMatcherDescriptor>(CladeNodeKind,
-                                                       NodeKinds);
+                                                       std::move(NodeKinds));
   }
 
   bool isVariadic() const override { return true; }



More information about the cfe-commits mailing list