Skip to content

Commit f44622f

Browse files
committed
address review comments
1 parent 6a0c7b0 commit f44622f

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ if(MSVC)
208208
endif()
209209
else()
210210

211-
option(ENABLE_WERROR "Enable -Werror" OFF)
211+
option(ENABLE_WERROR "Enable -Werror" ON)
212212

213213
set(THREADS_PREFER_PTHREAD_FLAG ON)
214214
set(CMAKE_THREAD_PREFER_PTHREAD ON)

src/ir/module-utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,8 @@ inline void collectHeapTypes(Module& wasm,
595595
counts.note(child);
596596
}
597597
}
598-
auto super = ht.getSuperType();
599-
if (super) {
598+
599+
if (auto super = ht.getSuperType()) {
600600
if (!counts.count(*super)) {
601601
newTypes.insert(*super);
602602
// We should unconditionally count supertypes, but while the type system

src/passes/ConstantFieldPropagation.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ struct SubTypes {
5959
private:
6060
// Add a type to the graph.
6161
void note(HeapType type) {
62-
auto super = type.getSuperType();
63-
if (super) {
62+
if (auto super = type.getSuperType()) {
6463
typeSubTypes[*super].insert(type);
6564
}
6665
}
@@ -463,8 +462,7 @@ struct ConstantFieldPropagation : public Pass {
463462
auto& infos = combinedInfos[type];
464463

465464
// Propagate shared fields to the supertype.
466-
auto superType = type.getSuperType();
467-
if (superType) {
465+
if (auto superType = type.getSuperType()) {
468466
auto& superInfos = combinedInfos[*superType];
469467
auto& superFields = superType->getStruct().fields;
470468
for (Index i = 0; i < superFields.size(); i++) {

src/passes/Print.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2581,8 +2581,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {
25812581
} else {
25822582
o << type;
25832583
}
2584-
auto super = type.getSuperType();
2585-
if (super) {
2584+
if (auto super = type.getSuperType()) {
25862585
o << " (extends ";
25872586
TypeNamePrinter(o, module).print(*super);
25882587
o << ')';

src/wasm/wasm-binary.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void WasmBinaryWriter::writeTypes() {
227227
auto super = type.getSuperType();
228228
if (type.isSignature()) {
229229
o << S32LEB(super ? BinaryConsts::EncodedType::FuncExtending
230-
: BinaryConsts::EncodedType::Func);
230+
: BinaryConsts::EncodedType::Func);
231231
auto sig = type.getSignature();
232232
for (auto& sigType : {sig.params, sig.results}) {
233233
o << U32LEB(sigType.size());
@@ -237,15 +237,15 @@ void WasmBinaryWriter::writeTypes() {
237237
}
238238
} else if (type.isStruct()) {
239239
o << S32LEB(super ? BinaryConsts::EncodedType::StructExtending
240-
: BinaryConsts::EncodedType::Struct);
240+
: BinaryConsts::EncodedType::Struct);
241241
auto fields = type.getStruct().fields;
242242
o << U32LEB(fields.size());
243243
for (const auto& field : fields) {
244244
writeField(field);
245245
}
246246
} else if (type.isArray()) {
247247
o << S32LEB(super ? BinaryConsts::EncodedType::ArrayExtending
248-
: BinaryConsts::EncodedType::Array);
248+
: BinaryConsts::EncodedType::Array);
249249
writeField(type.getArray().element);
250250
} else {
251251
WASM_UNREACHABLE("TODO GC type writing");

0 commit comments

Comments
 (0)