[cfe-dev] help with modules

Richard Smith metafoo at gmail.com
Wed Jan 8 13:02:09 PST 2014


This is a known bug.

The problem is that when we go to build the module in
"Inputs/UndefinedFixIt1", we build some synthetic #includes for the
contents of the module (relative to the current directory), then change
into the "Inputs/UndefinedFixIt1" directory to perform the build of the
module, where the includes we synthesized obviously don't work. The
workaround is to use absolute -I paths for any directory containing a
module.

Patches to fix this would be welcome! =)

On Wed Jan 08 2014 at 10:01:00 AM, Nico Weber <thakis at chromium.org> wrote:

> It seems to work for me if I pass an absolute path to -I – does that help?
>
>
> On Wed, Jan 8, 2014 at 8:18 AM, Thompson, John <
> John_Thompson at playstation.sony.com> wrote:
>
>  Hi,
>
>
>
> Could someone help me understand what is wrong with the enclosed build
> module example?  (It’s kind of in the form of a test, but ignore the
> comment for running the test, as it’s just a source file here.)
>
>
>
> I’m trying to gear up to add a fixit message for undefined types which can
> be found in a module, but I can’t get this simple scenario to work.  The
> idea is that if I later remove the #include, I’ll get an error on the
> undefined type, which nonetheless could be found in a module, allowing me
> to add a fixit.
>
>
>
> In looking at other modules tests, it seems that if I put the module.map
> file in a subdirectory and use a -I option, clang can find the module map
> there and load it, right?
>
>
>
> In looking at this in a debugger, in the HandleIncludeDirective function,
> the lookupFile call at line 1452 loads the module map.  But then at line
> 1655 a loadModule call loads the module map again, but fails.
>
>
>
> To reproduce, just run the makefile, which produces:
>
>
>
> ***
>
> d:\Clang\bugs\modules>make
>
> clang -cc1 -fmodules-cache-path=TestOutput -fmodules
> -IInputs\UndefinedFixIt1 UndefinedFixIt1.cpp
>
> <module-includes>:1:10: fatal error: 'Inputs\UndefinedFixIt1\public1.h'
> file not found
>
> #include "Inputs\UndefinedFixIt1\public1.h"
>
>          ^
>
> UndefinedFixIt1.cpp:4:10: fatal error: could not build module 'public1'
>
> #include "public1.h"
>
> ~~~~~~~~^~~~~~~~~~~
>
> 2 errors generated.
>
> make: *** [all] Error 1
>
> ***
>
>
>
> It’s probably something simple, but I can’t see it.
>
>
>
> Thanks.
>
>
>
> -John
>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140108/88c2e56e/attachment.html>


More information about the cfe-dev mailing list