Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

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

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

llvmbot commented Jun 7, 2025

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

Author: Kazu Hirata (kazutakahirata)

Changes

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

@kazutakahirata kazutakahirata requested a review from hokein June 7, 2025 18:12
@kazutakahirata kazutakahirata merged commit 0613f8b into llvm:main Jun 8, 2025
9 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250607_ArrayRef_clang_tools branch June 8, 2025 08:34
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
…143278)

getDeclarationList is used only for read-only access to the array.  I
don't think it's actually meant to return by value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants