[PATCH] D93654: [TableGen] Change getAllDerivedDefinitions() to return const vector &
Chris Lattner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 22 09:14:47 PST 2020
lattner added a comment.
Yeah C++ syntax isn't great. If you take the path of returning arrayref, it is a bad idea to allow it to convert the a 'const&'. My understanding is that operator you found on arrayref will make a copy of the data (defeating the whole purpose of this patch :-), and that the lifetime will be bound to the statement. This means the reference will actually dangle. :-(
You can either keep it as a const& return or return an array ref and change the callers to use 'auto' or an explicit ArrayRef declaration. In either case, please appease the clang-format gods. Thanks Paul!
-Chris
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