[clang] [Clang] Added explanation why is_trivially_copy_constructible evaluated to false (PR #225487)

Darshan N via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 04:53:18 PST 2026


================
@@ -2006,15 +2006,30 @@ ExprResult Sema::BuildExpressionTrait(ExpressionTrait ET, SourceLocation KWLoc,
       ExpressionTraitExpr(KWLoc, ET, Queried, Value, RParen, Context.BoolTy);
 }
 
+// std::is_trivially_copy_constructible<T> is
+// __is_trivially_constructible(T, const T &). It is not in the generated table
+// because the std trait takes only T. Callers tell it apart from the builtin
+// by the std name recorded in ExtractedTypeTraitInfo.
+static constexpr StringRef TriviallyCopyConstructibleName =
+    "is_trivially_copy_constructible";
+
 static std::optional<TypeTrait> StdNameToTypeTrait(StringRef Name) {
+  if (Name == TriviallyCopyConstructibleName)
+    return TT_IsTriviallyConstructible;
----------------
pesdarshan wrote:

> Ugh, I think I missed the fact it wasn't a builtin trait... Can you investigate if we can change the behavior of EMIT_STD_NAME_CASES? i.e. we probably want to map it to UTT_IsTriviallyConstructible

I looked into it. `StdName` in the `.td` is a single string, so each builtin can only map to one std name. `__is_trivially_constructible` backs several std traits (copy, move, default), so it does not fit. I have not tried changing the generator. For now I kept the one-line special case in `StdNameToTypeTrait`. Is that the kind of change you had in mind?

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


More information about the cfe-commits mailing list