summaryrefslogtreecommitdiff
path: root/src/passes/Print.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2021-10-18 16:57:12 -0700
committerGitHub <noreply@github.com>2021-10-18 23:57:12 +0000
commitbe02d3f0f2689475f31c4523010eed58f39d27cb (patch)
treee62d8f8d15547a54c6c3c40a5752c7f08e4379cd /src/passes/Print.cpp
parentf0a8de302b85441deb8864c9e20c561c934e27b8 (diff)
downloadbinaryen-be02d3f0f2689475f31c4523010eed58f39d27cb.tar.gz
binaryen-be02d3f0f2689475f31c4523010eed58f39d27cb.tar.bz2
binaryen-be02d3f0f2689475f31c4523010eed58f39d27cb.zip
Update to C++17 and use std::optional for getSuperType (#4203)
This sets the C++ standard variable in the build to C++17, and makes use of std::optional (a C++17 library feature) in one place, to test that it's working.
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r--src/passes/Print.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 96a1abe73..34fe92ff6 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -2515,9 +2515,8 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {
}
// Module-level visitors
void printSupertypeOr(HeapType curr, std::string noSuper) {
- HeapType super;
- if (curr.getSuperType(super)) {
- TypeNamePrinter(o, currModule).print(super);
+ if (auto super = curr.getSuperType()) {
+ TypeNamePrinter(o, currModule).print(*super);
} else {
o << noSuper;
}