[all-commits] [llvm/llvm-project] 0bd992: [clang AST] move mangling API to namespace clang t...

Peter Rong via All-commits all-commits at lists.llvm.org
Wed Apr 30 09:38:18 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0bd992a8d7193e15191f14a4bd39fd4dd181dbdb
      https://github.com/llvm/llvm-project/commit/0bd992a8d7193e15191f14a4bd39fd4dd181dbdb
  Author: Peter Rong <peterrong96 at gmail.com>
  Date:   2025-04-30 (Wed, 30 Apr 2025)

  Changed paths:
    M clang/include/clang/AST/Mangle.h
    M clang/lib/AST/Mangle.cpp

  Log Message:
  -----------
  [clang AST] move mangling API to namespace clang to allow calls from swift-frontend (#137884)

When implementing `@objcDirect` in Swift, Swift needs to mangle a native
`Decl` that is not a clang Node, which in turn don't have access to
`clang::MangleContext`. Reimplementing mangling logic in Swift is
redundant.

This patch moves mangling logic from `clang::MangleContext` to `clang`
using only basic types (`StringRef`, `std::optional`, etc.), such that
Swift can we can just call Clang API: Swift depends on Clang already.

We are separating this from #126639 so we can draft the proposal on the
Swift side. #126639 will be worked to depend on this PR.

Tests: No new tests, old ones should pass with no problem.

---------

Signed-off-by: Peter Rong <PeterRong at meta.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list