diff options
author | Heejin Ahn <aheejin@gmail.com> | 2020-01-02 16:19:19 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-02 16:19:19 -0800 |
commit | 3fbec348f6de9c213d0091984305f9bb4906af47 (patch) | |
tree | 7ee30c9d695efa6dafc4790e54c836bf939c64fe /src/tools | |
parent | bcc76146fed433cbc8ba01a9f568d979c145110b (diff) | |
download | binaryen-3fbec348f6de9c213d0091984305f9bb4906af47.tar.gz binaryen-3fbec348f6de9c213d0091984305f9bb4906af47.tar.bz2 binaryen-3fbec348f6de9c213d0091984305f9bb4906af47.zip |
Use FeatureSet instead of FeatureSet::Feature(NFC) (#2562)
This uses `FeatureSet` in place of `FeatureSet::Feature` when possible,
making it possible for functions take a set of multiple features as one
argument.
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/fuzzing.h | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index ff0888f1d..7e46a8eea 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -2673,21 +2673,21 @@ private: // special getters std::vector<Type> getReachableTypes() { - return items(FeatureOptions<Type>() - .add(FeatureSet::MVP, - Type::i32, - Type::i64, - Type::f32, - Type::f64, - Type::none) - .add(FeatureSet::SIMD, Type::v128) - .add(FeatureSet::ReferenceTypes, - Type::funcref, - Type::anyref, - Type::nullref) - .add((FeatureSet::Feature)(FeatureSet::ReferenceTypes | - FeatureSet::ExceptionHandling), - Type::exnref)); + return items( + FeatureOptions<Type>() + .add(FeatureSet::MVP, + Type::i32, + Type::i64, + Type::f32, + Type::f64, + Type::none) + .add(FeatureSet::SIMD, Type::v128) + .add(FeatureSet::ReferenceTypes, + Type::funcref, + Type::anyref, + Type::nullref) + .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling, + Type::exnref)); } Type getReachableType() { return pick(getReachableTypes()); } @@ -2700,8 +2700,7 @@ private: Type::funcref, Type::anyref, Type::nullref) - .add((FeatureSet::Feature)(FeatureSet::ReferenceTypes | - FeatureSet::ExceptionHandling), + .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling, Type::exnref)); } Type getConcreteType() { return pick(getConcreteTypes()); } @@ -2724,8 +2723,7 @@ private: .add(FeatureSet::MVP, Type::i32, Type::i64, Type::f32, Type::f64) .add(FeatureSet::SIMD, Type::v128) .add(FeatureSet::ReferenceTypes, Type::nullref) - .add((FeatureSet::Feature)(FeatureSet::ReferenceTypes | - FeatureSet::ExceptionHandling), + .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling, Type::exnref)); } Type getLoggableType() { return pick(getLoggableTypes()); } @@ -2812,14 +2810,14 @@ private: template<typename T> struct FeatureOptions { template<typename... Ts> - FeatureOptions<T>& add(FeatureSet::Feature feature, T option, Ts... rest) { + FeatureOptions<T>& add(FeatureSet feature, T option, Ts... rest) { options[feature].push_back(option); return add(feature, rest...); } - FeatureOptions<T>& add(FeatureSet::Feature feature) { return *this; } + FeatureOptions<T>& add(FeatureSet feature) { return *this; } - std::map<FeatureSet::Feature, std::vector<T>> options; + std::map<FeatureSet, std::vector<T>> options; }; template<typename T> std::vector<T> items(FeatureOptions<T>& picker) { |