[clang] [WIP] [Modules] Delay reading type source info of the preferred_name attribute. (PR #122250)
Viktoriia Bakalova via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 14 05:50:54 PST 2025
================
@@ -9860,6 +9860,33 @@ void ASTReader::finishPendingActions() {
}
PendingDeducedVarTypes.clear();
+ ASTContext &Context = getContext();
+ for (unsigned I = 0; I != PendingPreferredNameAttributes.size(); ++I) {
+ auto *D = PendingPreferredNameAttributes[I].D;
+ QualType InfoTy = GetType(PendingPreferredNameAttributes[I].TypeID);
+ TypeSourceInfo *TInfo = nullptr;
+ if (!InfoTy.isNull()) {
+ TInfo = getContext().CreateTypeSourceInfo(InfoTy);
+ if (auto Loc = TInfo->getTypeLoc().getAs<ElaboratedTypeLoc>()) {
+ Loc.setElaboratedKeywordLoc(
+ PendingPreferredNameAttributes[I].ElaboratedTypedefSL);
+ Loc.setQualifierLoc(PendingPreferredNameAttributes[I].NestedNameSL);
+ if (auto TypedefLoc = Loc.getNextTypeLoc().getAs<TypedefTypeLoc>())
+ TypedefLoc.setNameLoc(PendingPreferredNameAttributes[I].TypedefSL);
+ }
+ }
+
+ AttrVec &Attrs = getContext().getDeclAttrs(D);
+ PreferredNameAttr *New = new (Context) PreferredNameAttr(
+ Context, PendingPreferredNameAttributes[I].Info, TInfo);
+ cast<InheritableAttr>(New)->setInherited(
+ PendingPreferredNameAttributes[I].isInherited);
+ New->setImplicit(PendingPreferredNameAttributes[I].isImplicit);
----------------
VitaNuo wrote:
Obsolete with https://github.com/llvm/llvm-project/pull/122726.
https://github.com/llvm/llvm-project/pull/122250
More information about the cfe-commits
mailing list