From 79826a73b2333902347192e48a1dda1041cf8f57 Mon Sep 17 00:00:00 2001 From: Tim Keith Date: Wed, 17 Apr 2019 07:44:58 -0700 Subject: [PATCH] [flang] Dump parse tree even if semantic error occurs When -fdebug-dump-parse-tree is specified, dump the parse tree even if semantic errors have occurred. This is necessary to see the parse tree after it has been transformed. Original-commit: flang-compiler/f18@bbdb0717da953c959cb1b6c531684952c239b98b Reviewed-on: https://github.com/flang-compiler/f18/pull/417 --- flang/tools/f18/f18.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flang/tools/f18/f18.cc b/flang/tools/f18/f18.cc index 79802e65a864..2b4a45309152 100644 --- a/flang/tools/f18/f18.cc +++ b/flang/tools/f18/f18.cc @@ -232,6 +232,9 @@ std::string CompileFortran(std::string path, Fortran::parser::Options options, if (semantics.AnyFatalError()) { std::cerr << driver.prefix << "semantic errors in " << path << '\n'; exitStatus = EXIT_FAILURE; + if (driver.dumpParseTree) { + Fortran::parser::DumpTree(std::cout, parseTree); + } return {}; } if (driver.dumpUnparseWithSymbols) {