From 3de21477c49172081e502b47d608e729915f0914 Mon Sep 17 00:00:00 2001 From: Viktoriia Bakalova <115406782+VitaNuo@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:23:10 +0100 Subject: =?UTF-8?q?[clang][codegen]=20Mention=20the=20invariant=20that=20L?= =?UTF-8?q?LVM=20demangler=20should=20be=20=E2=80=A6=20(#117346)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …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. --- clang/lib/CodeGen/CodeGenModule.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index b854eeb..1ff95ed 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2047,6 +2047,15 @@ 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((MangledName.startswith("_Z") || MangledName.startswith("?")) && + // !GD->hasAttr() && + // 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(); } -- cgit v1.1