ChuanqiXu added inline comments.
================ Comment at: clang/lib/Sema/SemaModule.cpp:282 + StringRef FirstComponentName = Path[0].first->getName(); + if (!getSourceManager().isInSystemHeader(Path[0].second) && + (FirstComponentName == "std" || ---------------- cor3ntin wrote: > ChuanqiXu wrote: > > std modules should be irreverent with system headers; The intuition of the > > wording should be that the users can't declare modules like `std` or > > `std.compat` to avoid possible conflicting. The approach I imaged may be > > add a new compilation flags (call it `-fstd-modules`) now. And if the > > compiler found a `std` module declaration without `-fstd-modules`, emit an > > error. > > > > For now, I think we can skip the check for `-fstd-modules` and add it back > > when we starts to support std modules actually. > The idea is that standard modules are built from system directories... it > seems a better heuristic than adding a flag for the purpose of 1 diagnostics > ( maybe some other system library could in theory export std with no warning, > but I'm not super worried about that being a concern in practice) > The idea is that standard modules are built from system directories... This is not true. For example, if someday libc++ supports std modules, then we need to build the std modules in our working directory, which is not system directories. And **ideally**, we would distribute and install module file in the system directories. But it is irreverent with the path of the source file. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136953/new/ https://reviews.llvm.org/D136953 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits