[clang] [clang][codegen] Mention the invariant that LLVM demangler should be … (PR #117346)
James Y Knight via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 22 09:32:59 PST 2024
================
@@ -2047,6 +2047,14 @@ 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) &&
----------------
jyknight wrote:
isMangledName doesn't seem to exist?
But, also, we'd only want to validate output actually produced by Clang `mangleCXXName`, and not e.g. a user-written `void f() asm("_ZGARBAGE"); void f() {}`
Maybe we want:`if ((MangledName.startswith("_Z") || MangledName.startswith("?")) & !GD->hasAttr<AsmLabelAttr>())`?
https://github.com/llvm/llvm-project/pull/117346
More information about the cfe-commits
mailing list