[PATCH] D70340: Add a key method to Sema to optimize debug info size
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 19 11:47:44 PST 2019
rnk added a comment.
In D70340#1751148 <https://reviews.llvm.org/D70340#1751148>, @hans wrote:
> Nice!
>
> Silly questions, but for my own education: I thought the key function concept only existed in the Itanium ABI, but from your numbers it sounds like it's a concept, at least for debug info, also on Windows?
There's sort of two things going on:
- -flimit-debug-info: if a type has a vtable, debug info for the class is only emitted where the vtable is emitted, on the assumption that we believe the vtable will be in the program somewhere.
- key functions in the ABI: these optimize object file size by avoiding the need to emit the vtable in as many places.
The -flimit-debug-info behavior is cross-platform and happens regardless of whether the class has a key function. So, clang only emits a forward declaration of Foo in the debug info for this program, regardless of target:
struct Foo {
Foo();
~Foo();
virtual void f() {}
};
Foo *makeFoo() { return new Foo(); }
-flimit-debug-info would emit complete type info if the constructor (which touches the vtable) was inline.
---
I'll try to land this today, I think it's worth doing. If anyone thinks it's too much of a hack, let me know.
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