diff options
| author | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2020-01-18 22:10:46 +0100 |
|---|---|---|
| committer | Hans Wennborg <hans@chromium.org> | 2020-03-06 14:36:11 +0100 |
| commit | edcd83a669b68a2d371a54dc46e647a2efe97a4f (patch) | |
| tree | 1da16db9c64752dd35d196b1ad0d5b7a6654bb2f /mlir/include | |
| parent | 50eedc134a219ef6d2345e4efc5471a2e3824223 (diff) | |
| download | bcm5719-llvm-edcd83a669b68a2d371a54dc46e647a2efe97a4f.tar.gz bcm5719-llvm-edcd83a669b68a2d371a54dc46e647a2efe97a4f.zip | |
[mlir] NFC: Rename index_t to index_type
mlir currently fails to build on Solaris:
/vol/llvm/src/llvm-project/dist/mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp:78:20: error: reference to 'index_t' is ambiguous
IndexHandle zero(index_t(0)), one(index_t(1));
^
/usr/include/sys/types.h:103:16: note: candidate found by name lookup is 'index_t'
typedef short index_t;
^
/vol/llvm/src/llvm-project/dist/mlir/include/mlir/EDSC/Builders.h:27:8: note: candidate found by name lookup is 'mlir::edsc::index_t'
struct index_t {
^
and many more.
Given that POSIX reserves all identifiers ending in `_t` 2.2.2 The Name Space <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html>, it seems
quite unwise to use such identifiers in user code, even more so without a distinguished
prefix.
The following patch fixes this by renaming `index_t` to `index_type`.
cases.
Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D72619
(cherry picked from commit 002ec79f979b9da9dedafe7ea036e00c90a9fbb7)
Diffstat (limited to 'mlir/include')
| -rw-r--r-- | mlir/include/mlir/EDSC/Builders.h | 6 | ||||
| -rw-r--r-- | mlir/include/mlir/EDSC/Intrinsics.h | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/mlir/include/mlir/EDSC/Builders.h b/mlir/include/mlir/EDSC/Builders.h index 14a4e5a4c9a..86870944619 100644 --- a/mlir/include/mlir/EDSC/Builders.h +++ b/mlir/include/mlir/EDSC/Builders.h @@ -24,8 +24,8 @@ namespace mlir { namespace edsc { -struct index_t { - explicit index_t(int64_t v) : v(v) {} +struct index_type { + explicit index_type(int64_t v) : v(v) {} explicit operator int64_t() { return v; } int64_t v; }; @@ -310,7 +310,7 @@ public: /// This implicit constructor is provided to each build an eager Value for a /// constant at the current insertion point in the IR. An implicit constructor /// allows idiomatic expressions mixing ValueHandle and literals. - ValueHandle(index_t cst); + ValueHandle(index_type cst); /// ValueHandle is a value type, use the default copy constructor. ValueHandle(const ValueHandle &other) = default; diff --git a/mlir/include/mlir/EDSC/Intrinsics.h b/mlir/include/mlir/EDSC/Intrinsics.h index 4e0cda41620..66fb90a643b 100644 --- a/mlir/include/mlir/EDSC/Intrinsics.h +++ b/mlir/include/mlir/EDSC/Intrinsics.h @@ -34,7 +34,7 @@ namespace edsc { struct IndexHandle : public ValueHandle { explicit IndexHandle() : ValueHandle(ScopedContext::getBuilder().getIndexType()) {} - explicit IndexHandle(index_t v) : ValueHandle(v) {} + explicit IndexHandle(index_type v) : ValueHandle(v) {} explicit IndexHandle(Value v) : ValueHandle(v) { assert(v.getType() == ScopedContext::getBuilder().getIndexType() && "Expected index type"); @@ -96,7 +96,7 @@ public: ValueHandleArray(ArrayRef<IndexHandle> vals) { values.append(vals.begin(), vals.end()); } - ValueHandleArray(ArrayRef<index_t> vals) { + ValueHandleArray(ArrayRef<index_type> vals) { SmallVector<IndexHandle, 8> tmp(vals.begin(), vals.end()); values.append(tmp.begin(), tmp.end()); } |

