diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-11-09 08:20:20 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-11-09 08:20:20 +0200 |
commit | 2fc58b7bda7f8da672c7bd165f441eef6b260dcf (patch) | |
tree | fdf34b6de790045d20de90167c51a5c99a480862 /libbuild2/cc/compile-rule.cxx | |
parent | 82621c2eff0fadf5adc72fc7a249ad1c43aa2f3d (diff) |
Fix more issues with C++20 named modules support in Clang
Diffstat (limited to 'libbuild2/cc/compile-rule.cxx')
-rw-r--r-- | libbuild2/cc/compile-rule.cxx | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index ee97b39..aefcc30 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -3606,16 +3606,6 @@ namespace build2 // Some compile options (e.g., -std, -m) affect the preprocessor. // - // Currently Clang supports importing "header modules" even when in - // the TS mode. And "header modules" support macros which means - // imports have to be resolved during preprocessing. Which poses a - // bit of a chicken and egg problem for us. For now, the workaround - // is to remove the -fmodules-ts option when preprocessing. Hopefully - // there will be a "pure modules" mode at some point. - // - // @@ MODHDR Clang: should be solved with the dynamic module mapper - // if/when Clang supports it? - // // Don't treat warnings as errors. // @@ -3708,8 +3698,7 @@ namespace build2 } case compiler_class::gcc: { - append_options (args, cmode, - cmode.size () - (modules && clang ? 1 : 0)); + append_options (args, cmode, cmode.size ()); append_sys_hdr_options (args); // Extra system header dirs (last). // If not gen, then stderr is discarded. @@ -6885,11 +6874,7 @@ namespace build2 if (ms.start == 0) return; - // Clang embeds module file references so we only need to specify - // our direct imports. - // - // If/when we get the ability to specify the mapping in a file, we - // will pass the whole list. + // If/when we get the ability to specify the mapping in a file. // #if 0 // In Clang the module implementation's unit .pcm is special and @@ -6910,9 +6895,16 @@ namespace build2 s.insert (0, "-fmodule-file-map=@="); stor.push_back (move (s)); #else + // Clang embeds module file references so we only need to specify + // our direct imports. @@ TMP: note anymore, clean up. + // auto& pts (t.prerequisite_targets[a]); for (size_t i (ms.start), +#if 0 n (ms.copied != 0 ? ms.copied : pts.size ()); +#else + n (pts.size ()); +#endif i != n; ++i) { @@ -6942,9 +6934,7 @@ namespace build2 return; auto& pts (t.prerequisite_targets[a]); - for (size_t i (ms.start), n (pts.size ()); - i != n; - ++i) + for (size_t i (ms.start), n (pts.size ()); i != n; ++i) { const target* pt (pts[i]); |