https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/143278

getDeclarationList is used only for read-only access to the array.  I
don't think it's actually meant to return by value.


>From d69392b80cdb2cb60aec005bcc4e18f5f9d4453a Mon Sep 17 00:00:00 2001
From: Kazu Hirata <k...@google.com>
Date: Sat, 7 Jun 2025 09:35:33 -0700
Subject: [PATCH] [clang-move] Teach getDeclarationList to return ArrayRef
 (NFC)

getDeclarationList is used only for read-only access to the array.  I
don't think it's actually meant to return by value.
---
 clang-tools-extra/clang-move/Move.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/clang-tools-extra/clang-move/Move.h 
b/clang-tools-extra/clang-move/Move.h
index ea241bbbc4f8a..ba613abc03e19 100644
--- a/clang-tools-extra/clang-move/Move.h
+++ b/clang-tools-extra/clang-move/Move.h
@@ -49,9 +49,7 @@ class DeclarationReporter {
     bool Templated = false;    // Whether the declaration is templated.
   };
 
-  const std::vector<Declaration> getDeclarationList() const {
-    return DeclarationList;
-  }
+  ArrayRef<Declaration> getDeclarationList() const { return DeclarationList; }
 
 private:
   std::vector<Declaration> DeclarationList;

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

Reply via email to