[flang] Prep for review

Original-commit: flang-compiler/f18@e86eae005e
Reviewed-on: https://github.com/flang-compiler/f18/pull/200
This commit is contained in:
peter klausler 2018-10-03 10:31:37 -07:00
parent 7e87d5a297
commit b64a39e1ea
3 changed files with 6 additions and 3 deletions

View File

@ -75,6 +75,9 @@ template<typename T, typename M> void Walk(std::optional<T> &x, M &mutator) {
Walk(*x, mutator);
}
}
// For most lists, just traverse the elements; but when a list constitutes
// a Block (i.e., std::list<ExecutionPartConstruct>), also invoke the
// visitor/mutator on the list itself.
template<typename T, typename V> void Walk(const std::list<T> &x, V &visitor) {
for (const auto &elem : x) {
Walk(elem, visitor);
@ -85,7 +88,6 @@ template<typename T, typename M> void Walk(std::list<T> &x, M &mutator) {
Walk(elem, mutator);
}
}
// When a list constitutes a Block, invoke the visitor or mutator.
template<typename V> void Walk(const Block &x, V &visitor) {
if (visitor.Pre(x)) {
for (const auto &elem : x) {

View File

@ -14,8 +14,6 @@
#include "canonicalize-do.h"
#include "../parser/parse-tree-visitor.h"
#include <variant>
#include <vector>
namespace Fortran::parser {
@ -118,4 +116,5 @@ void CanonicalizeDo(Program &program) {
CanonicalizationOfDoLoops canonicalizationOfDoLoops{labelInfos};
Walk(program, canonicalizationOfDoLoops);
}
} // namespace Fortran::parser

View File

@ -207,6 +207,7 @@ std::string CompileFortran(std::string path, Fortran::parser::Options options,
if (driver.measureTree) {
MeasureParseTree(parseTree);
}
// TODO: Change this predicate to just "if (!driver.debugNoSemantics)"
if (driver.debugSemantics || driver.debugResolveNames || driver.dumpSymbols ||
driver.dumpUnparseWithSymbols || driver.debugExpressions) {
semantics.Perform(parseTree);
@ -410,6 +411,7 @@ int main(int argc, char *const argv[]) {
} else if (arg == "-fdebug-instrumented-parse") {
options.instrumentedParse = true;
} else if (arg == "-fdebug-semantics") {
// TODO: Enable by default once basic tests pass
driver.debugSemantics = true;
} else if (arg == "-funparse") {
driver.dumpUnparse = true;