[clang] Moves destructor type-trait deduction to a public function (PR #238456)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 06:58:18 PST 2026


cor3ntin wrote:

I've been thinking about this more.
It's likely this won't be the last time Carbon wants to evaluate some C++ unary type trait.

How do you feel about adding a `EvaluateUnaryTypeTrait(QualType T, TypeTrait Trait, SourceLocation Loc)` public function to Sema?

You can use `ASTContext::getTrivialTypeSourceInfo(T, Loc)` to get a typesource info and call the private, existing `EvaluateUnaryTypeTrait`.  

It's a smaller change and that would let you use any type trait in the future.

I don't think `EvaluateUnaryTypeTrait` produces diagnostics but if it does it would be easy to weave in a `bool Diagnose` as parameter of the existing function.



https://github.com/llvm/llvm-project/pull/238456


More information about the cfe-commits mailing list