summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-05-12 17:26:39 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-05-12 17:26:39 +0800
commitba97fac504233fb85bd033b3dbfba3ebfa675b15 (patch)
treefb4ec7f50f45f369cd5fa6f491a3ff756550225c /src
parent65fa34c0f38bc1511ff2fee7efc4744d66b15a46 (diff)
downloadmrust-ba97fac504233fb85bd033b3dbfba3ebfa675b15.tar.gz
main - Slight tweak to dependency file output
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp
index c0f2df9b..1fea95ff 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -399,17 +399,15 @@ int main(int argc, char *argv[])
}
});
+ /// Emit the dependency files
if( params.emit_depfile != "" )
{
- ::std::ofstream of { params.emit_depfile };
- of << params.outfile << ":";
// - Iterate all loaded files for modules
- struct H {
- ::std::ofstream& of;
- H(::std::ofstream& of): of(of) {}
+ struct PathEnumerator {
+ ::std::vector<::std::string> out;
void visit_module(::AST::Module& mod) {
if( mod.m_file_info.path != "!" && mod.m_file_info.path.back() != '/' ) {
- of << " " << mod.m_file_info.path;
+ out.push_back( mod.m_file_info.path );
}
// TODO: Should we check anon modules?
//for(auto& amod : mod.anon_mods()) {
@@ -422,7 +420,19 @@ int main(int argc, char *argv[])
}
}
};
- H(of).visit_module(crate.m_root_module);
+ PathEnumerator pe;
+ pe.visit_module(crate.m_root_module);
+
+ ::std::ofstream of { params.emit_depfile };
+ // TODO: Escape spaces and colons in these paths
+ of << params.outfile << ":";
+ for(const auto& mod_path : pe.out)
+ {
+ of << " " << mod_path;
+ }
+ of << ::std::endl;
+
+ of << params.outfile << ":";
// - Iterate all loaded crates files
for(const auto& ec : crate.m_extern_crates)
{
@@ -464,6 +474,13 @@ int main(int argc, char *argv[])
});
// Deallocate the original crate
crate = ::AST::Crate();
+ if( params.debug.dump_hir )
+ {
+ CompilePhaseV("Dump HIR", [&]() {
+ ::std::ofstream os (FMT(params.outfile << "_2_hir.rs"));
+ HIR_Dump( os, *hir_crate );
+ });
+ }
// Replace type aliases (`type`) into the actual type
// - Also inserts defaults in trait impls