[cfe-dev] Module resolution during preprocessing

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Fri Jun 9 15:19:14 PDT 2017


On 6 June 2017 at 23:21, Boris Kolpackov via cfe-dev <cfe-dev at lists.llvm.org
> wrote:

> Hi,
>
> I found this surprising behavior of Clang's Modules-TS implementation:
>
> $ clang-5.0 --version
> clang version 5.0.0-svn304373-1~exp1 (trunk)
>
> $ cat <<EOF >test.cxx
> import foo
> EOF
>
> $ clang++-5.0 -std=c++1z -fmodules-ts -E test.cxx
> test.cxx:1:8: fatal error: module 'foo' not found
>
> Seeing that modules is a language-level construct, it's not clear why
> they must be resolvable during preprocessing. Or am I missing something
> subtle here?


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170609/333c32a2/attachment.html>


More information about the cfe-dev mailing list