This attribute applies to a using declaration, and permits importing a declaration without knowing if that declaration exists. This is useful for libc++ c wrapper headers that re-export declarations in std::.
As far as implementation goes, when some declarations are found, this attribute has no effect. When no declaration is found, Sema creates a single UsingShadowDecl that targets an UnresolvedUsingIfExistsDecl. If the UnresolvedUsingIfExistsDecl is referred to later, then an error is emitted. If the using-declaration is dependent, then Sema creates an UnresolvedUsingValueDecl/UnresolvedUsingTypenameDecl (as usual), but on instantiation they generate a UsingDecl that refers to an UnresolvedUsingIfExistsDecl.
This was proposed by Louis Dionne here: http://lists.llvm.org/pipermail/cfe-dev/2020-June/066038.html
rdar://69313357
Thanks for taking a look!
Why is this inheriting from a NamedDecl rather than a UsingDecl? Given that this is a type of using declaration, I guess I would have expected it to appear as such in the AST hierarchy. For instance, should people using AST matchers be able to match one of these as a using declaration or are they so different semantically that they need to be sibling AST nodes?