Skip to content

Commit 6d78c38

Browse files
committed
Move Sema's key function around and add more comments
The previous comment was pretty obscure.
1 parent 23c9e8b commit 6d78c38

File tree

1 file changed

+7
-3
lines changed
  • clang/include/clang/Sema

1 file changed

+7
-3
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,6 @@ class Sema final {
353353
Sema(const Sema &) = delete;
354354
void operator=(const Sema &) = delete;
355355

356-
/// A key method to reduce duplicate debug info from Sema.
357-
virtual void anchor();
358-
359356
///Source of additional semantic information.
360357
ExternalSemaSource *ExternalSource;
361358

@@ -1527,6 +1524,13 @@ class Sema final {
15271524
/// initialized but before it parses anything.
15281525
void Initialize();
15291526

1527+
/// This virtual key function only exists to limit the emission of debug info
1528+
/// describing the Sema class. GCC and Clang only emit debug info for a class
1529+
/// with a vtable when the vtable is emitted. Sema is final and not
1530+
/// polymorphic, but the debug info size savings are so significant that it is
1531+
/// worth adding a vtable just to take advantage of this optimization.
1532+
virtual void anchor();
1533+
15301534
const LangOptions &getLangOpts() const { return LangOpts; }
15311535
OpenCLOptions &getOpenCLOptions() { return OpenCLFeatures; }
15321536
FPOptions &getCurFPFeatures() { return CurFPFeatures; }

0 commit comments

Comments
 (0)