[llvm-commits] [PATCH] Remove Mutating Init Members

Nick Lewycky nicholas at mxc.ca
Wed Jul 13 21:37:32 PDT 2011


David Greene wrote:
> Here's a patch to remove members from Inits that update their state.
> This is in preparation for making Inits const and ultimately making
> them FoldingSetNodes.
>
> Please review.  Thanks!

Hi David,

I'm not a regular contributor to TableGen, but this patch looks fine to 
me as it seems pretty easy to verify that it's not changing behaviour.

--- a/utils/TableGen/Record.h
+++ b/utils/TableGen/Record.h
@@ -594,6 +594,8 @@ class BitsInit : public Init {
    std::vector<Init*> Bits;
  public:
    explicit BitsInit(unsigned Size) : Bits(Size) {}
+  template<typename InputIterator>
+  BitsInit(InputIterator start, InputIterator end) : Bits(start, end) {}

Any reason to take an InputIterator pair and not an ArrayRef? I realize 
that you may have a refactoring after this one for which an ArrayRef 
wouldn't work, but I don't know. If possible, please use an ArrayRef!

Nick



More information about the llvm-commits mailing list