[PATCH] D93654: [TableGen] Change getAllDerivedDefinitions() to return const vector &

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 18:15:11 PST 2020


craig.topper added a comment.

In D93654#2467199 <https://reviews.llvm.org/D93654#2467199>, @Paul-C-Anagnostopoulos wrote:

> I suddenly thought that the change to ArrayRef would require me to change every call to getAllDerivedDefinitions in one revision. So I changed the function and tried compiling. I got no complaints. What mechanism is it that allows an ArrayRef to be returned to a variable declared [const] std::vector<Record *> [&] without complaint?

I'm guessing this from ArrayRef.h

  /// @}                                                                                                                                                                                                                              
  /// @name Conversion operators                                                                                                                                                                                                      
  /// @{                                                                                                                                                                                                                              
  operator std::vector<T>() const {                                                                                                                                                                                                   
    return std::vector<T>(Data, Data+Length);                                                                                                                                                                                         
  }  


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93654/new/

https://reviews.llvm.org/D93654



More information about the llvm-commits mailing list