|
|
@@ -4,6 +4,7 @@
|
|
|
|
|
|
#include "toolchain/driver/driver.h"
|
|
|
|
|
|
+#include "common/vlog.h"
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
|
#include "llvm/ADT/StringExtras.h"
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
@@ -148,7 +149,9 @@ auto Driver::RunDumpSubcommand(DiagnosticConsumer& consumer,
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ CARBON_VLOG() << "*** SourceBuffer::CreateFromFile ***\n";
|
|
|
auto source = SourceBuffer::CreateFromFile(input_file_name);
|
|
|
+ CARBON_VLOG() << "*** SourceBuffer::CreateFromFile done ***\n";
|
|
|
if (!source) {
|
|
|
error_stream_ << "ERROR: Unable to open input source file: ";
|
|
|
llvm::handleAllErrors(source.takeError(),
|
|
|
@@ -159,29 +162,39 @@ auto Driver::RunDumpSubcommand(DiagnosticConsumer& consumer,
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ CARBON_VLOG() << "*** TokenizedBuffer::Lex ***\n";
|
|
|
auto tokenized_source = TokenizedBuffer::Lex(*source, consumer);
|
|
|
+ CARBON_VLOG() << "*** TokenizedBuffer::Lex done ***\n";
|
|
|
if (dump_mode == DumpMode::TokenizedBuffer) {
|
|
|
+ CARBON_VLOG() << "Finishing output.";
|
|
|
consumer.Flush();
|
|
|
tokenized_source.Print(output_stream_);
|
|
|
return !tokenized_source.has_errors();
|
|
|
}
|
|
|
+ CARBON_VLOG() << tokenized_source;
|
|
|
|
|
|
+ CARBON_VLOG() << "*** ParseTree::Parse ***\n";
|
|
|
auto parse_tree = ParseTree::Parse(tokenized_source, consumer, vlog_stream_);
|
|
|
+ CARBON_VLOG() << "*** ParseTree::Parse done ***\n";
|
|
|
if (dump_mode == DumpMode::ParseTree) {
|
|
|
consumer.Flush();
|
|
|
parse_tree.Print(output_stream_, parse_tree_preorder);
|
|
|
return !tokenized_source.has_errors() && !parse_tree.has_errors();
|
|
|
}
|
|
|
+ CARBON_VLOG() << parse_tree;
|
|
|
|
|
|
const SemanticsIR builtin_ir = SemanticsIR::MakeBuiltinIR();
|
|
|
+ CARBON_VLOG() << "*** SemanticsIR::MakeFromParseTree ***\n";
|
|
|
const SemanticsIR semantics_ir = SemanticsIR::MakeFromParseTree(
|
|
|
builtin_ir, tokenized_source, parse_tree, consumer, vlog_stream_);
|
|
|
+ CARBON_VLOG() << "*** SemanticsIR::MakeFromParseTree done ***\n";
|
|
|
if (dump_mode == DumpMode::SemanticsIR) {
|
|
|
consumer.Flush();
|
|
|
semantics_ir.Print(output_stream_);
|
|
|
// TODO: Return false when SemanticsIR has errors (not supported right now).
|
|
|
return !tokenized_source.has_errors() && !parse_tree.has_errors();
|
|
|
}
|
|
|
+ CARBON_VLOG() << semantics_ir;
|
|
|
|
|
|
llvm_unreachable("should handle all dump modes");
|
|
|
}
|