forked from OSchip/llvm-project
[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:
parent
7e87d5a297
commit
b64a39e1ea
|
@ -75,6 +75,9 @@ template<typename T, typename M> void Walk(std::optional<T> &x, M &mutator) {
|
||||||
Walk(*x, 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) {
|
template<typename T, typename V> void Walk(const std::list<T> &x, V &visitor) {
|
||||||
for (const auto &elem : x) {
|
for (const auto &elem : x) {
|
||||||
Walk(elem, visitor);
|
Walk(elem, visitor);
|
||||||
|
@ -85,7 +88,6 @@ template<typename T, typename M> void Walk(std::list<T> &x, M &mutator) {
|
||||||
Walk(elem, 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) {
|
template<typename V> void Walk(const Block &x, V &visitor) {
|
||||||
if (visitor.Pre(x)) {
|
if (visitor.Pre(x)) {
|
||||||
for (const auto &elem : x) {
|
for (const auto &elem : x) {
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
#include "canonicalize-do.h"
|
#include "canonicalize-do.h"
|
||||||
#include "../parser/parse-tree-visitor.h"
|
#include "../parser/parse-tree-visitor.h"
|
||||||
#include <variant>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace Fortran::parser {
|
namespace Fortran::parser {
|
||||||
|
|
||||||
|
@ -118,4 +116,5 @@ void CanonicalizeDo(Program &program) {
|
||||||
CanonicalizationOfDoLoops canonicalizationOfDoLoops{labelInfos};
|
CanonicalizationOfDoLoops canonicalizationOfDoLoops{labelInfos};
|
||||||
Walk(program, canonicalizationOfDoLoops);
|
Walk(program, canonicalizationOfDoLoops);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Fortran::parser
|
} // namespace Fortran::parser
|
||||||
|
|
|
@ -207,6 +207,7 @@ std::string CompileFortran(std::string path, Fortran::parser::Options options,
|
||||||
if (driver.measureTree) {
|
if (driver.measureTree) {
|
||||||
MeasureParseTree(parseTree);
|
MeasureParseTree(parseTree);
|
||||||
}
|
}
|
||||||
|
// TODO: Change this predicate to just "if (!driver.debugNoSemantics)"
|
||||||
if (driver.debugSemantics || driver.debugResolveNames || driver.dumpSymbols ||
|
if (driver.debugSemantics || driver.debugResolveNames || driver.dumpSymbols ||
|
||||||
driver.dumpUnparseWithSymbols || driver.debugExpressions) {
|
driver.dumpUnparseWithSymbols || driver.debugExpressions) {
|
||||||
semantics.Perform(parseTree);
|
semantics.Perform(parseTree);
|
||||||
|
@ -410,6 +411,7 @@ int main(int argc, char *const argv[]) {
|
||||||
} else if (arg == "-fdebug-instrumented-parse") {
|
} else if (arg == "-fdebug-instrumented-parse") {
|
||||||
options.instrumentedParse = true;
|
options.instrumentedParse = true;
|
||||||
} else if (arg == "-fdebug-semantics") {
|
} else if (arg == "-fdebug-semantics") {
|
||||||
|
// TODO: Enable by default once basic tests pass
|
||||||
driver.debugSemantics = true;
|
driver.debugSemantics = true;
|
||||||
} else if (arg == "-funparse") {
|
} else if (arg == "-funparse") {
|
||||||
driver.dumpUnparse = true;
|
driver.dumpUnparse = true;
|
||||||
|
|
Loading…
Reference in New Issue