r212060 - Consider module depedencies when checking a preamble in libclang

Ben Langmuir blangmuir at apple.com
Mon Jul 7 09:12:21 PDT 2014


> On Jul 7, 2014, at 8:17 AM, Ulrich Weigand <Ulrich.Weigand at de.ibm.com> wrote:
> 
> 
> Ben Langmuir wrote:
> 
> +TEST_F(LibclangReparseTest, ReparseWithModule) {
> 
> This new test has been failing for me on powerpc64-linux:
> 
> [ RUN      ] LibclangReparseTest.ReparseWithModule
> /home/uweigand/llvm/llvm-head/tools/clang/unittests/libclang/LibclangTest.cpp:454:
> Failure
> Value of: clang_getNumDiagnostics(ClangTU)
>  Actual: 1
> Expected: 0U
> Which is: 0
> [  FAILED  ] LibclangReparseTest.ReparseWithModule (74 ms)
> 
> 
> When I look at the diagnostics, I get:
> "/tmp/libclang-test-6a8ede/MFile.m:2: error: variable has incomplete type
> 'struct Foo'"
> 
> 
> And indeed running clang directly against the temporary files created by
> the test case I get:
> uweigand at bns:~> ./llvm/build/llvm-head-debug/Debug+Asserts/bin/clang
> -fmodules -I /tmp/libclang-test-6a8ede /tmp/libclang-test-6a8ede/MFile.m
> /tmp/libclang-test-6a8ede/MFile.m:2:25: error: variable has incomplete type
> 'struct Foo'
> int main() { struct Foo foo; foo.bar = 7; foo.baz = 8; }
>                        ^
> /tmp/libclang-test-6a8ede/MFile.m:2:21: note: forward declaration of
> 'struct Foo'
> int main() { struct Foo foo; foo.bar = 7; foo.baz = 8; }
>                    ^
> 1 error generated.

Could you try this again with the additional flags -Wmodule-build -Wauto-import as a sanity check that the module is being found?  It looks like the module isn’t being imported properly...

> 
> Note that when I omit the -fmodules flag, I get another error, which is
> presumably the one the test actually expects:
> uweigand at bns:~> ./llvm/build/llvm-head-debug/Debug+Asserts/bin/clang
> -I /tmp/libclang-test-6a8ede /tmp/libclang-test-6a8ede/MFile.m
> /tmp/libclang-test-6a8ede/MFile.m:2:47: error: no member named 'baz' in
> 'struct Foo'; did you mean 'bar'?
> int main() { struct Foo foo; foo.bar = 7; foo.baz = 8; }
>                                              ^~~
>                                              bar
> /tmp/libclang-test-6a8ede/HeaderFile.h:3:18: note: 'bar' declared here
> struct Foo { int bar;
>                 ^
> 1 error generated.

Right, this is the expected error.

> 
> 
> I have no idea why this behavior would be in any way platform-specific ...
> any thoughts?
> 

Nope, this looks really weird to me!

Ben

> 
> 
> Mit freundlichen Gruessen / Best Regards
> 
> Ulrich Weigand
> 
> --
>  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
>  STSM, GNU/Linux compilers and toolchain
>  IBM Deutschland Research & Development GmbH
>  Vorsitzende des Aufsichtsrats: Martina Koederitz | Geschäftsführung: Dirk
> Wittkopp
>  Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
> Stuttgart, HRB 243294
> 





More information about the cfe-commits mailing list