ArrayRef<Value> can implicit convert to ValueRange,when we call TypeRange(SmallVector<Value>) is ambiguity.
TypeRange(ValueRange values)
TypeRange(ArrayRef<Value> values)
Details
Diff Detail
Event Timeline
The msvc reported error is that: When we pass a parameter MutableArrayRef<BlockArgument> to the following function:
TypeRange(ValueTypeRange<ValueRangeT> values) : TypeRange(ValueRangeT(values.begin().getCurrent(), values.end().getCurrent())) {}
then call delegating constructor:
TypeRange(ValueRange values); and TypeRange(const iterator_range<iterator> &range values) inherits from indexed_accessor_range_base
My second update trying to explicit call TypeRange(ValueRange values);
the clang reported error incomplete type 'mlir::ValueRange' and it defined in the OperationSupport.h file, and this file inclue<TypeRange.h>
I wonder if putting the ValueRange definition in a new file will work well.
mlir/include/mlir/IR/TypeRange.h | ||
---|---|---|
56 | I'm not really a fan of adding compiler-specific ifdefs |
mlir/include/mlir/IR/TypeRange.h | ||
---|---|---|
56 | Yeah, we really shouldn't be adding these types of checks in regular code. |
mlir/include/mlir/IR/TypeRange.h | ||
---|---|---|
56 | Is it reasonable to move the definition of ValueType from the operationSupport file to a new file? |
mlir/include/mlir/IR/TypeRange.h | ||
---|---|---|
56 | ValueType? You mean TypeRange? Yes, I think it's reasonable to move it to a separate file TypeRange.h. |
mlir/include/mlir/IR/TypeRange.h | ||
---|---|---|
56 | Sorry,I mean ValueRange. |
Can you move the splitting of the files into another patch? It's kind of hard to review the diff otherwise
mlir/include/mlir/IR/TypeRange.h | ||
---|---|---|
51–52 | Why does doing this require moving ValueRange out of OperationSupport? |
mlir/include/mlir/IR/TypeRange.h | ||
---|---|---|
51–52 | The prompt I get with the clang compiler is: ValueRange is imcomplete type,ValueRange is a forward declaration in the file TypeRange.h, and the file OperationSupport.h already includes the file TypeRange.h.The class TypeRange and the class ValueRange depend on each other. |
mlir/include/mlir/IR/TypeRange.h | ||
---|---|---|
51–52 | Where do you get that error though? |
mlir/include/mlir/IR/TypeRange.h | ||
---|---|---|
51–52 | When I change template <typename ValueRangeT> TypeRange(ValueTypeRange<ValueRangeT> values) : TypeRange(ValueRangeT(values.begin().getCurrent(), values.end().getCurrent())) {} to template <typename ValueRangeT> TypeRange(ValueTypeRange<ValueRangeT> values) : TypeRange(ValueRange(ValueRangeT(values.begin().getCurrent(), values.end().getCurrent()))) {} But if I don't change the MSVC compiler like this it will give an error. |
mlir/include/mlir/IR/TypeRange.h | ||
---|---|---|
51–52 | My first change was to remove the following two redundant constructors: explicit TypeRange(ArrayRef<Value> values); explicit TypeRange(ArrayRef<BlockArgument> values) : TypeRange(ArrayRef<Value>(values.data(), values.size())) {} |
The depends on comment is useful here (https://llvm.org/docs/Phabricator.html#using-patch-summaries), it shows up in the UI as "stack" too.
Why does doing this require moving ValueRange out of OperationSupport?