[clang] [Clang] Reapply CWG2369 "Ordering between constraints and substitution" (PR #122423)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue May 27 07:34:07 PDT 2025
================
@@ -522,6 +522,12 @@ enum class TemplateSubstitutionKind : char {
llvm::PointerUnion<Decl *, DeclArgumentPack *> *
findInstantiationOf(const Decl *D);
+ /// Similar to \p findInstantiationOf(), but it wouldn't assert if the
+ /// instantiation was not found within the current instantiation scope. This
+ /// is helpful for on-demand declaration instantiation.
+ llvm::PointerUnion<Decl *, DeclArgumentPack *> *
+ findInstantiationUnsafe(const Decl *D);
----------------
erichkeane wrote:
Instead of `unsafe`, I'd suggest something like `getInstantiationOfIfExists` and `getInstantiationOf` (or similar) rather than `unsafe`. `unsafe` means, to me, that there is a precondition that if you don't setup correctly, it fails. Not that it migth just return null.
Finally, as interface, is there a reason these are returning a pointer to a pointer union? Seems oen should return by value, the other in an `optional`.
https://github.com/llvm/llvm-project/pull/122423
More information about the cfe-commits
mailing list