Author: erichkeane
Date: 2025-03-06T07:04:34-08:00
New Revision: 9189d84abbfc643db0053200c1c2e16b1e78e8f9

URL: 
https://github.com/llvm/llvm-project/commit/9189d84abbfc643db0053200c1c2e16b1e78e8f9
DIFF: 
https://github.com/llvm/llvm-project/commit/9189d84abbfc643db0053200c1c2e16b1e78e8f9.diff

LOG: [NFC] Change the return type of `getTraversalScope` to `ArrayRef`

This is only used in 2 places, both just to search through the list, so
returning a copy was wasteful.  This patch changes it to return an
`ArrayRef` so that a copy isn't made.

Added: 
    

Modified: 
    clang/include/clang/AST/ASTContext.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 4c6966c922cc7..f9a12260a6590 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -723,7 +723,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
   // (However they are still accessible via TranslationUnitDecl->decls())
   //
   // Changing the scope clears the parent cache, which is expensive to rebuild.
-  std::vector<Decl *> getTraversalScope() const { return TraversalScope; }
+  ArrayRef<Decl *> getTraversalScope() const { return TraversalScope; }
   void setTraversalScope(const std::vector<Decl *> &);
 
   /// Forwards to get node parents from the ParentMapContext. New callers 
should


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

Reply via email to