[cfe-dev] Module resolution during preprocessing

Boris Kolpackov via cfe-dev cfe-dev at lists.llvm.org
Sat Jun 10 00:20:31 PDT 2017


Richard Smith <richard at metafoo.co.uk> writes:

> Clang supports mixing Modules TS modules with header modules. Header
> modules support exporting macros. Therefore, because "import foo;" might
> import a module that exports a macro, it must be available during
> preprocessing.

This causes a bit of a chicken and egg problem for us: we analyze the
preprocessed output to discover which modules are required but need to
know the required modules before preprocessing.

I could remove the -fmodules-ts but that's not ideal since this option
could conceivably alter predefined macros (like __cpp_modules).

Is there a way to disable this "header modules" support and get a pure
Modules TS semantics? If not, do you think such a mode could be added?
We could have only enabled "header modules" if both -fmodules-ts and
-fmodules are specified, but that ship might have already sailed.

Thanks,
Boris



More information about the cfe-dev mailing list