[libcxx-commits] [libcxx] [libc++] Disable _LIBCPP_NODEBUG temporarily (PR #122393)

Michael Buch via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 14 08:36:56 PST 2025


Michael137 wrote:

Perhaps a naive patch such as this suffices (it fixed this particular crash for me locally):
```
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
index 5447b98d7105..02635ce235a1 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
@@ -81,6 +81,9 @@ class PCHContainerGenerator : public ASTConsumer {
         if (!TD->isCompleteDefinition())
           return true;
 
+      if (D->hasAttr<NoDebugAttr>())
+        return true;
+
       QualType QualTy = Ctx.getTypeDeclType(D);
       if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))
         DI.getOrCreateStandaloneType(QualTy, D->getLocation());
```

The PCH generator is asking to emit full standalone debug-info for a type marked `NoDebug`, which makes no sense. There's other places in `CGDebugInfo` where we guard against similar asks.

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


More information about the libcxx-commits mailing list