================
@@ -6058,6 +6059,25 @@ ASTFileSignature ASTWriter::WriteASTCore(Sema *SemaPtr,
StringRef isysroot,
}
}
+ // Write the set of #pragma redefine_extname'd, undeclared identifiers. We
+ // always write the entire table, since later PCH files in a PCH chain are
+ // only interested in the results at the end of the chain.
+ RecordData ExtnameUndeclaredIdentifiers;
+ if (SemaPtr) {
+ ASTContext &Context = SemaPtr->Context;
+ ASTRecordWriter ExtnameUndeclaredIdentifiersWriter(
+ Context, *this, ExtnameUndeclaredIdentifiers);
+ for (const auto &ExtnameUndeclaredIdentifierList :
+ SemaPtr->ExtnameUndeclaredIdentifiers) {
+ const IdentifierInfo *const II = ExtnameUndeclaredIdentifierList.first;
+ const AsmLabelAttr *const AL = ExtnameUndeclaredIdentifierList.second;
+ ExtnameUndeclaredIdentifiersWriter.AddIdentifierRef(II);
+ ExtnameUndeclaredIdentifiersWriter.AddIdentifierRef(
+ &Context.Idents.get(AL->getLabel()));
+ ExtnameUndeclaredIdentifiersWriter.AddSourceLocation(AL->getLocation());
+ }
----------------
ilovepi wrote:
I think you can use structured decomposition here and things would be a little
more drect/readable.
I didn't check this at all, but something like the following should work,
modulo some small tweaks.
```suggestion
for (const auto &[IdentifierInfo, AsmLabelAttr] :
SemaPtr->ExtnameUndeclaredIdentifiers) {
ExtnameUndeclaredIdentifiersWriter.AddIdentifierRef(II);
ExtnameUndeclaredIdentifiersWriter.AddIdentifierRef(
&Context.Idents.get(AL->getLabel()));
ExtnameUndeclaredIdentifiersWriter.AddSourceLocation(AL->getLocation());
}
```
https://github.com/llvm/llvm-project/pull/186755
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits