================
@@ -3871,7 +3874,8 @@ class ASTIdentifierTableTrait {
     if (isInterestingIdentifier(II, MacroOffset)) {
       DataLen += 2; // 2 bytes for builtin ID
       DataLen += 2; // 2 bytes for flags
-      if (MacroOffset)
+      if (MacroOffset || (II->hasMacroDefinition() &&
+                          II->hasFETokenInfoChangedSinceDeserialization()))
----------------
jansvoboda11 wrote:

The way this condition works makes me think of this situation:

```
//--- macro-definition.h
#define __P(protos) ()
#define __Q(protos) ()

//--- macro-transitive.h
void test(int __P) {} // not "interesting" identifier
struct __Q {};        // "interesting" identifier
#include "macro-definition.h" // NOTE: Import of the macros module
                              // comes after local declarations.

//--- module.modulemap
module MacroDefinition { header "macro-definition.h" export * }
module MacroTransitive { header "macro-transitive.h" export * }

//--- test.c
// expected-no-diagnostics
#include "macro-transitive.h"
void foo __P(());
void bar __Q(());
```

When writing the PCM for the MacroTransitive module, I'd expect 
`II->hasFETokenInfoChangedSinceDeserialization()` to be false and `ASTWriter` 
therefore skipping serializing the  fact that `__P` and `__Q` have macros 
attached to them. How is this working out in this case? This modified test 
passes, just curious why.

https://github.com/llvm/llvm-project/pull/135471
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to