[clang] [clang] implement __builtin_mangled_name (PR #236294)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 28 01:26:41 PDT 2026


================
@@ -1430,6 +1442,21 @@ static bool EvaluateBooleanTypeTrait(Sema &S, TypeTrait Kind,
   return false;
 }
 
+static std::string
+EvaluateStringLiteralTypeTrait(Sema &S, TypeTrait Kind,
+                               ArrayRef<TypeSourceInfo *> Args,
+                               bool IsDependent) {
+  if (IsDependent)
+    return {};
+
+  switch (Kind) {
+  case UTT_MangledName:
+    return ComputeMangledName(S, Args[0]->getType());
+  default:
+    llvm_unreachable("not a string literal type trait");
+  }
----------------
zyn0217 wrote:

Let's `assert(Kind == UTT_MangledName)`

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


More information about the cfe-commits mailing list