Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add debugging dumper to the ProgramStmt statement so that it comes ou…

…t in the

correct order.
  • Loading branch information...
commit a86fc71070c35624e13d1162e5f1c1d0ec248837 1 parent 8ba5ab6
Bill Wendling authored
View
3  include/flang/AST/StmtDumper.h
@@ -19,6 +19,9 @@
namespace flang {
+ /// dump - Dump a statement.
+ void dump(StmtResult S);
+
/// dump - Dump an array of statements.
void dump(llvm::ArrayRef<StmtResult> S);
View
8 lib/AST/StmtDumper.cpp
@@ -117,9 +117,15 @@ void StmtVisitor::visit(const PrintStmt *S) {
OS << "(print)\n";
}
+void flang::dump(StmtResult S) {
+ StmtVisitor SV(llvm::errs());
+ SV.visit(S);
+}
+
void flang::dump(ArrayRef<StmtResult> S) {
StmtVisitor SV(llvm::errs());
for (ArrayRef<StmtResult>::iterator I = S.begin(), E = S.end(); I != E; ++I)
- SV.visit(*I);
+ if (!isa<ProgramStmt>(I->get()))
+ SV.visit(*I);
}
View
2  lib/Parse/Parser.cpp
@@ -327,6 +327,8 @@ bool Parser::ParseMainProgram(std::vector<StmtResult> &Body) {
ProgramStmt *PS = ProgStmt.takeAs<ProgramStmt>();
IDInfo = PS->getProgramName();
NameLoc = PS->getNameLocation();
+ // FIXME: Debugging
+ dump(PS);
}
Actions.ActOnMainProgram(IDInfo, NameLoc);
Please sign in to comment.
Something went wrong with that request. Please try again.