Modules: Suggestion on how to fix a regression caused by r259901

Manman via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 20 16:41:31 PDT 2016


Hi Richard,

Any suggestion on this?

Thanks,
Manman

> On Sep 7, 2016, at 12:40 PM, Manman <mren at apple.com> wrote:
> 
> Hi Richard,
> 
> We noticed a regression for this simple testing case:
> rm -rf tmp3
> clang -cc1 -fimplicit-module-maps -x objective-c -fmodules -fmodules-cache-path=tmp3 -emit-obj standalone.c -I Inputs/
> —>
> standalone.c:4:6: error: variable has incomplete type 'void'
> void foo __P(());
>     ^
> standalone.c:4:9: error: expected ';' after top level declarator
> void foo __P(());
>        ^
>        ;
> 2 errors generated.
> clang -cc1 -fimplicit-module-maps -x objective-c -fmodules -fmodules-cache-path=tmp3 -emit-obj standalone.c -I Inputs/
> —> This runs fine.
> 
> cat standalone.c
> #import "C.h"
> #import "A.h"
> 
> void foo __P(());
> 
> cat Inputs/module.map 
> module X {
>  header "A.h"
>  export *
> }
> // Y imports X, it also uses “__P” as a parameter name
> module Y {
>  header "B.h"
>  export *
> }
> // Z imports X and Y
> module Z {
>  header "C.h”
> }
> 
> cat Inputs/A.h 
> #define __P(protos)     ()
> 
> cat Inputs/B.h
> #import "A.h"
> #import "B2.h”
> 
> cat Inputs/B2.h 
> void test(int __P) {
> }
> 
> cat Inputs/C.h 
> #import "A.h"
> #import “B.h”
> 
> r259901 causes the compiler to write out identifier “__P” without the macro information for module Y, which seems to be incorrect. Any suggestion on how to fix this?
> Why the 2nd run works is related to global index. Global Index only considers interesting identifiers, so it skips module Y when calling ModuleManager::visit.
> 
> Cheers,
> Manman
> 



More information about the cfe-commits mailing list