[clang-tools-extra] [clang-move] Teach getDeclarationList to return ArrayRef (NFC) (PR #143278)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 7 11:11:58 PDT 2025


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 <kazu at 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;



More information about the cfe-commits mailing list