<html>
    <head>
      <base href="http://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Macro information is missing for module"
   href="http://bugs.llvm.org/show_bug.cgi?id=32693">32693</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Macro information is missing for module
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Modules
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bruno.cardoso@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18299" name="attach_18299" title="Testcase">attachment 18299</a> <a href="attachment.cgi?id=18299&action=edit" title="Testcase">[details]</a></span>
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?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>