[clang] [clang][codegen] Mention the invariant that LLVM demangler should be … (PR #117346)

via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 22 08:33:45 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Viktoriia Bakalova (VitaNuo)

<details>
<summary>Changes</summary>

…able to handle mangled names generated by clang.

https://discourse.llvm.org/t/rfc-clang-diagnostic-for-demangling-failures/82835/8

Since we're putting the work on the above RFC on hold, let's leave a comment in the source code pointing to prior efforts and the suggestion of further steps.

---
Full diff: https://github.com/llvm/llvm-project/pull/117346.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CodeGenModule.cpp (+7) 


``````````diff
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index b854eeb62a80ce..6eef085ae336eb 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -2047,6 +2047,13 @@ StringRef CodeGenModule::getMangledName(GlobalDecl GD) {
                  GD.getWithKernelReferenceKind(KernelReferenceKind::Kernel),
                  ND));
 
+  // This invariant should hold true in the future.
+  // Prior work: https://discourse.llvm.org/t/rfc-clang-diagnostic-for-demangling-failures/82835/8
+  // https://github.com/llvm/llvm-project/issues/111345
+  // assert(llvm::isMangledName(MangledName) &&
+  //        llvm::demangle(MangledName) != MangledName &&
+  //        "LLVM demangler must demangle clang-generated names");
+
   auto Result = Manglings.insert(std::make_pair(MangledName, GD));
   return MangledDeclNames[CanonicalGD] = Result.first->first();
 }

``````````

</details>


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


More information about the cfe-commits mailing list