[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
Sat Nov 28 23:39:52 PST 2026


================
@@ -2007,14 +2007,26 @@ ExprResult Sema::BuildExpressionTrait(ExpressionTrait ET, SourceLocation KWLoc,
 }
 
 static std::optional<TypeTrait> StdNameToTypeTrait(StringRef Name) {
+  // std::is_trivially_copy_constructible<T> is implemented in terms of
+  // __is_trivially_constructible(T, const T &).
+  if (Name == "is_trivially_copy_constructible")
+    return TT_IsTriviallyConstructible;
   return llvm::StringSwitch<std::optional<TypeTrait>>(Name)
 #define EMIT_STD_NAME_CASES
 #include "clang/Basic/BuiltinTraits.inc"
       .Default(std::nullopt);
 }
 
-using ExtractedTypeTraitInfo =
-    std::optional<std::pair<TypeTrait, llvm::SmallVector<QualType, 1>>>;
+namespace {
+struct TypeTraitInfo {
+  TypeTrait Trait;
+  llvm::SmallVector<QualType, 1> Args;
+  // The std:: name (without "_v") if the trait was spelled as a library trait,
+  // empty if it was spelled as a builtin.
+  StringRef StdName;
+};
+using ExtractedTypeTraitInfo = std::optional<TypeTraitInfo>;
+} // namespace
----------------
pesdarshan wrote:

I removed that code. The new trait only has a `StdName`, so `StdNameToTypeTrait` already maps it and nothing needs the reverse mapping. I didn't add `TypeTraitToStdName`.

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


More information about the cfe-commits mailing list