From 0a6212e277d55fff72f3d9df53a4dcb88e3e4a71 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 20 Jun 2017 10:19:08 +0200 Subject: Force Clang not to reference source files from BMIs, add trace --- build2/cc/compile.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index c23eff2..c90cf08 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -2512,6 +2512,8 @@ namespace build2 module_imports&& imports, sha256& cs) const { + tracer trace (x, "compile::search_modules"); + // So we have a list of imports and a list of "potential" module // prerequisites. They are potential in the sense that they may or may // not be required by this translation unit. In other words, they are @@ -2690,7 +2692,7 @@ namespace build2 // if all the modules come from libraries. Which will be fairly common // (think of all the tests) so it's worth optimizing for. // - auto check = [&imports, &pts, &match, start, n] + auto check = [&trace, &imports, &pts, &match, start, n] (const target* pt, const string& name, bool fuzzy) -> bool { bool done (true); @@ -2707,6 +2709,8 @@ namespace build2 match (name, m.name) : (name == m.name ? n + 1 : 0)); + l5 ([&]{trace << name << " ~ " << m.name << ": " << s;}); + if (s > m.score) { pts[start + i] = pt; @@ -3221,6 +3225,13 @@ namespace build2 args.push_back (relm.string ().c_str ()); args.push_back ("--precompile"); + // Without this option Clang's .pcm will reference source files. + // In our case this file may be transient (.ii). Plus, it won't + // play nice with distributed compilation. + // + args.push_back ("-Xclang"); + args.push_back ("-fmodules-embed-all-files"); + // These should become the default at some point. // args.push_back ("-Xclang"); args.push_back ("-fmodules-codegen"); -- cgit v1.1