diff options
author | Alon Zakai <azakai@google.com> | 2024-01-09 13:22:50 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 13:22:50 -0800 |
commit | 75145b78b8b9cdabd98af849821f34dee0168466 (patch) | |
tree | cde82ab00f81f50b8b1f2fca2824a571cdcf620d /src | |
parent | 185019919b1fa2efe8d02056827a31f4f50dd01e (diff) | |
download | binaryen-75145b78b8b9cdabd98af849821f34dee0168466.tar.gz binaryen-75145b78b8b9cdabd98af849821f34dee0168466.tar.bz2 binaryen-75145b78b8b9cdabd98af849821f34dee0168466.zip |
[NFC] Add more const annotations + a trivial == (#6216)
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/possible-constant.h | 6 | ||||
-rw-r--r-- | src/ir/subtypes.h | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/ir/possible-constant.h b/src/ir/possible-constant.h index 21f1cfa65..79a9973b5 100644 --- a/src/ir/possible-constant.h +++ b/src/ir/possible-constant.h @@ -48,6 +48,10 @@ private: public: PossibleConstantValues() : value(None()) {} + bool operator==(const PossibleConstantValues& other) const { + return value == other.value; + } + // Notes the contents of an expression and update our internal knowledge based // on it and all previous values noted. void note(Expression* expr, Module& wasm) { @@ -155,7 +159,7 @@ public: } // Assuming we have a single value, make an expression containing that value. - Expression* makeExpression(Module& wasm) { + Expression* makeExpression(Module& wasm) const { Builder builder(wasm); if (isConstantLiteral()) { return builder.makeConstantExpression(getConstantLiteral()); diff --git a/src/ir/subtypes.h b/src/ir/subtypes.h index 488bb8310..8645afb98 100644 --- a/src/ir/subtypes.h +++ b/src/ir/subtypes.h @@ -145,7 +145,8 @@ struct SubTypes { // Efficiently iterate on subtypes of a type, up to a particular depth (depth // 0 means not to traverse subtypes, etc.). The callback function receives // (type, depth). - template<typename F> void iterSubTypes(HeapType type, Index depth, F func) { + template<typename F> + void iterSubTypes(HeapType type, Index depth, F func) const { // Start by traversing the type itself. func(type, 0); @@ -186,7 +187,7 @@ struct SubTypes { } // As above, but iterate to the maximum depth. - template<typename F> void iterSubTypes(HeapType type, F func) { + template<typename F> void iterSubTypes(HeapType type, F func) const { return iterSubTypes(type, std::numeric_limits<Index>::max(), func); } |