================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to