JustinStitt wrote: Hi Ilya,
I did some testing and found an inconsistency in the behaviors between exporting entire namespaces or exporting declarations within a namespace piecemeal. See this test ```cpp export module some_lib; namespace piecemeal { // line 3 export int add_one(int n) { return n + 1; } export int add_two(int n) { return n + 2; } // unused } export namespace whole { // line 8 int add_one(int n) { return n + 1; } int add_two(int n) { return n + 2; } // unused } ``` ```cpp import some_lib; int main() { (void)piecemeal::add_one(4); // only use add_one from each namespace (void)whole::add_one(4); } ``` which produces the following minimized hints <details> <summary>min_hints.json</summary> <code> { "required_ranges": [ { "file": "<snip>/tests/some_lib.cppm", "range": [ { "from": { "line": 3, "column": 1 }, "to": { "line": 3, "column": 22 } }, { "from": { "line": 4, "column": 3 }, "to": { "line": 4, "column": 46 } }, { "from": { "line": 6, "column": 1 }, "to": { "line": 6, "column": 2 } }, { "from": { "line": 8, "column": 1 }, "to": { "line": 11, "column": 2 } } ] } ] } </code> ``` </details> Notice how lines 3, 4, 6 correspond to the namespace that had its declarations exported one-by-one. The namespace that is exported all at once is entirely marked as required (lines 8 to 11) even though just one of its declarations is used. https://github.com/llvm/llvm-project/pull/151534 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits