Michael137 wrote:

> This causes Clang to assert:
> 
> ```
>       llvm/lib/IR/Metadata.cpp:689:
>       void llvm::MDNode::resolve(): Assertion `isUniqued() && "Expected this 
> to be uniqued"' failed.
> ```
> 
> See https://bugs.chromium.org/p/chromium/issues/detail?id=1500262#c1 for a 
> reproducer.
> 
> I'll revert to green.

Thanks for the repro. Reduced it to:
```
struct Foo;                                                 
template <bool c> using Int = int;                          
class Bar {                                                 
  template <typename T> static const bool Constant = false; 
  Int<Constant<Foo>> Val;                                   
  Bar();                                                    
};                                                          
Bar::Bar() {}                                               
```
when compiling with `-debug-info-kind=limited`.

The issue was that `EmitGlobalVariable` can cause creation of `DINodes`, which, 
if using limited debug-info, will be temporary. But the emission of the global 
variables is done *after* we've uniqued the temporaries. So the fix is really 
to just do the `EmitGlobalVariable` at the beginning of 
`CGDebugInfo::finalize`. Will submit a new PR with that change and a new 
test-case for this

https://github.com/llvm/llvm-project/pull/70639
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to