[clang] [Serialization] No transitive identifier change (PR #92085)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 3 09:31:55 PDT 2024


================
@@ -3896,7 +3903,7 @@ void ASTWriter::WriteIdentifierTable(Preprocessor &PP,
 
       // Write out identifiers if either the ID is local or the identifier has
       // changed since it was loaded.
-      if (ID >= FirstIdentID || !Chain || !II->isFromAST() ||
+      if (isLocalIdentifierID(ID) || !Chain || !II->isFromAST() ||
----------------
jansvoboda11 wrote:

Ah, got it. I was looking at this line in `ASTWriter.h`:

```c++
  /// The first ID number we can use for our own identifiers.
  serialization::IdentID FirstIdentID = serialization::NUM_PREDEF_IDENT_IDS;
```

and didn't realize it's being re-initialized in `ASTWriter::ReaderInitialized()`.

Doesn't that make the `!II->isFromAST()` check redundant then?

https://github.com/llvm/llvm-project/pull/92085


More information about the cfe-commits mailing list