Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ir/effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ class EffectAnalyzer {
template<typename CallType>
void
addCallEffects(const CallType* curr,
const EffectAnalyzer* bodyEffects) {
NullablePtr<const EffectAnalyzer*> bodyEffects) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious to hear more opinions here, but I generally feel that we can use default values of =nullptr in such cases where null is possible. I mean

Suggested change
NullablePtr<const EffectAnalyzer*> bodyEffects) {
const EffectAnalyzer* bodyEffects=nullptr) {

This generally what we've done so far.

And, on the other hand, we do have many places with a pointer that is non-nullable, but I wonder if the best thing is not to convert those to references. Though it would be a large change.

if (curr->isReturn) {
parent.branchesOut = true;
}
Expand Down
5 changes: 5 additions & 0 deletions src/support/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ template<class... Ts> struct overloaded : Ts... {
using Ts::operator()...;
};

// Used to annotate (for human readers) that a pointer may be null.
// e.g. NullablePtr<int*>
template<typename T>
using NullablePtr = T;

} // namespace wasm

#endif // wasm_support_utilities_h