[flang] some debugging after more testing

Original-commit: flang-compiler/f18@005b841dd1
Reviewed-on: https://github.com/flang-compiler/f18/pull/373
This commit is contained in:
peter klausler 2019-04-01 16:15:47 -07:00
parent 3c5a25a1bd
commit 39b7433194
3 changed files with 21 additions and 4 deletions

View File

@ -790,6 +790,8 @@ public:
bool Pre(const parser::CharBlock &) { return true; }
void Post(const parser::CharBlock &) {}
template<typename T> bool Pre(const parser::Statement<T> &) { return true; }
template<typename T> void Post(const parser::Statement<T> &) {}
template<typename T> bool Pre(const parser::UnlabeledStatement<T> &) {
return true;
}

View File

@ -291,6 +291,23 @@ template<typename T, typename M> void Walk(DefaultChar<T> &x, M &mutator) {
}
}
template<typename T, typename V> void Walk(const Statement<T> &x, V &visitor) {
if (visitor.Pre(x)) {
// N.B. The label, if any, is not visited.
Walk(x.source, visitor);
Walk(x.statement, visitor);
visitor.Post(x);
}
}
template<typename T, typename M> void Walk(Statement<T> &x, M &mutator) {
if (mutator.Pre(x)) {
// N.B. The label, if any, is not visited.
Walk(x.source, mutator);
Walk(x.statement, mutator);
mutator.Post(x);
}
}
template<typename T, typename V>
void Walk(const UnlabeledStatement<T> &x, V &visitor) {
if (visitor.Pre(x)) {

View File

@ -51,10 +51,8 @@ template<typename PA> inline constexpr auto statement(const PA &p) {
// unlabeledStatement() is basically statement() for those few situations
// in Fortran where a statement cannot have a label.
template<typename PA> inline constexpr auto unlabeledStatement(const PA &p) {
return skipStuffBeforeStatement >>
sourced(
construct<UnlabeledStatement<typename PA::resultType>>(space >> p)) /
endOfStmt;
return space >>
sourced(construct<UnlabeledStatement<typename PA::resultType>>(p));
}
// This unambiguousStatement() variant of statement() provides better error