================
@@ -343,7 +343,11 @@ namespace {
}
}
- llvm_unreachable("no Attr* for AttributedType*");
+ // The AttributedType can be inherited from another declarator, for
+ // example when __typeof__ reuses a type built for a different
+ // declaration, in which case there is no entry for it in this
+ // TypeProcessingState. Return null in that case.
+ return nullptr;
----------------
AaronBallman wrote:
> The returned Attr * is used to set AttributedTypeLoc, and AFAICT every place
> that reads the attribute back from an AttributedTypeLoc (e.g.,
> TypeLoc::findNullabilityLoc) already null checks it, so null is an acceptable
> value for that.
Ah, you are correct! I verified this is the case everywhere, sorry for the
noise.
> To clarify: I read your second paragraph as suggesting we register an Attr *
> before fillAttributedTypeLoc() is called, so that lookup never comes up
> empty. But the question then becomes which Attr * to register.
> __typeof__(s->f1) doesn't create any new Attr * of its own, so the only one
> available is the one on NullabilityAtomicTypeofS::f1, which has the problem I
> described above.
Yeah, I see the issue much better now, thank you for the explanation!
https://github.com/llvm/llvm-project/pull/220139
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits