[PATCH] D97411: [DebugInfo] Add an attribute to force type info to be emitted for types that are required to be complete.

Amy Huang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 26 13:22:18 PST 2021


akhuang added a comment.

In D97411#2591030 <https://reviews.llvm.org/D97411#2591030>, @aaron.ballman wrote:

> Thanks! I am still curious about the forward declare/redeclaration behavior and whether that is a situation that makes sense or not. I suspect this case may make sense (and likely already works):
>
>   // Should test redeclaration behavior.
>   struct [[clang::standalone_debug]] redecl;
>   struct redecl {};
>
> but I'm not certain if this case makes sense:
>
>   struct [[clang::standalone_debug]] S; // Does this make sense on forward declare that's never defined?

The purpose of the redecl being to test if the attribute still works when there's a redeclaration? I don't know if testing just the forward declare makes sense - I think the attribute wouldn't do anything in that case?

Oh, also, what's the difference between writing `__attribute__((attrname))` and `[[clang::attrname]]`?

In D97411#2591047 <https://reviews.llvm.org/D97411#2591047>, @ldionne wrote:

> In D97411#2588181 <https://reviews.llvm.org/D97411#2588181>, @akhuang wrote:
>
>> @ldionne Do you think it'd be reasonable to add this debug info attribute to some types in libc++? (For types that have constructors but don't call them; some previous discussion in https://reviews.llvm.org/D90719).
>
> Like I said in D90719 <https://reviews.llvm.org/D90719>, I think it would be best to fix the issue at its root and call those constructors (we must have UB if we use these types but never call any constructors, right?).

True, I am still planning to look into the libc++ fix, but not sure how large / difficult that change would be. In the meantime we could do this? (And I think it would still be nice to have the attribute, regardless of the libc++ thing).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97411/new/

https://reviews.llvm.org/D97411



More information about the cfe-commits mailing list