[PATCH] D70340: Add a key method to Sema to optimize debug info size

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 23 13:38:56 PDT 2021


erichkeane added a comment.

I guess my point is: a better comment would have saved me some time.  Basically point out that the 'debug' info for the whole type is emitted with a virtual method, and that non-virtual types have it emitted in every TU.  Also that this causes it to be emitted in only 1 place, since now there is only a single virtual method definition in a single TU.



================
Comment at: clang/include/clang/Sema/Sema.h:335
 
+  /// A key method to reduce duplicate type info from Sema.
+  virtual void anchor();
----------------
rnk wrote:
> hans wrote:
> > I worry that this is going to look obscure to most readers passing through. Maybe it could be expanded to more explicitly spell out that it reduces the size of the debug info?
> I want to keep it concise, most readers shouldn't need to know what this is, and they can look up technical terms like "key method". I'll say "debug info" instead of "type info", though, that should be more obvious.
FWIW, I just ran into this and did a double/triple take, as it didn't make sense for me to see a 'virtual' function in a 'final' type that didn't inherit to anything looked like nonsense.

The only way I found out what this meant (googling "key method" did very little for me here) was to do a 'git-blame' then found this review.  The ONLY place that explained what is happening here is the comment you made here: https://reviews.llvm.org/D70340#1752192


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70340



More information about the cfe-commits mailing list