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

via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 7 11:12:31 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

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


---
Full diff: https://github.com/llvm/llvm-project/pull/143278.diff


1 Files Affected:

- (modified) clang-tools-extra/clang-move/Move.h (+1-3) 


``````````diff
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;

``````````

</details>


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


More information about the cfe-commits mailing list