[llvm-bugs] [Bug 32693] New: Macro information is missing for module

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 17 22:59:36 PDT 2017


http://bugs.llvm.org/show_bug.cgi?id=32693

            Bug ID: 32693
           Summary: Macro information is missing for module
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Modules
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bruno.cardoso at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Created attachment 18299
  --> http://bugs.llvm.org/attachment.cgi?id=18299&action=edit
Testcase

Take this example:

$ 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”

----

This has the interesting behavior of (a) failing on the 1st run and (b) working
when re-using the cache on a 2nd run:

$ 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
...no_errors...

----

This regressed after Richard's r259901, which probably exposed a bug? Some
notes:
- After r259901 the compiler writes out identifier "__P" without the macro
information for module Y, which seems to be incorrect.
- 2nd run works because Global Index only considers interesting identifiers, so
it skips module Y when calling ModuleManager::visit

Any suggestion on how to fix the issue?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170418/99b840ba/attachment.html>


More information about the llvm-bugs mailing list