This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Improve Debugging experience with SmallVector
AbandonedPublic

Authored by Tyker on Apr 21 2020, 6:28 AM.

Details

Summary

When debugging it is usefull to be able to look at the content of containers.
But many containers are templated so there member functions are not emitted if they are not used.
this patch adds the used attribute to some member functions of SmallVector, DenseMap and PointerIntPair
when asserts are enabled and the host complier supports it. this way interacting with thoses type
from the debugger is easier.

in this patch, I only updated the containers I most frequently have this issue with.
but many other could get the same treatment.

Diff Detail

Event Timeline

Tyker created this revision.Apr 21 2020, 6:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2020, 6:28 AM
Tyker updated this revision to Diff 259017.Apr 21 2020, 8:47 AM
Tyker edited the summary of this revision. (Show Details)
Tyker retitled this revision from [NFC] Improve Debugging experience with some LLVM Types to [NFC] Improve Debugging experience with SmallVector.

Interesting idea - but could you start an llvm-dev thread to discuss this idea, since it may become more pervasive & it'd be good to get buy-in to the general approach.

aprantl added inline comments.
llvm/include/llvm/Support/Compiler.h
501

We'd want to use LLVM_USED_FOR_DEBUG instead of LLVM_ATTRIBUTE_USED here too?

Tyker abandoned this revision.Aug 21 2022, 10:38 AM

for the case of SmallVector it is as easy as adding a few used
But for many containers adding used attribute may cause previously new failure because the function annotated cannot be instantiated.

Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2022, 10:38 AM