Skip to content

Commit b47d9d0

Browse files
authored
[clang][DebugInfo] Don't emit VTable debug symbols for -gline-tables-only. (#151025)
The -gline-tables-only option emits minimal debug info for functions, files and line numbers while omitting variables, parameters and most type information. VTable debug symbols are emitted to facilitate a debugger's ability to perform automatic type promotion on variables and parameters. With variables and parameters being omitted, the VTable symbols are unnecessary.
1 parent 3d4f1fe commit b47d9d0

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,6 +2641,8 @@ void CGDebugInfo::emitVTableSymbol(llvm::GlobalVariable *VTable,
26412641
const CXXRecordDecl *RD) {
26422642
if (!CGM.getTarget().getCXXABI().isItaniumFamily())
26432643
return;
2644+
if (DebugKind <= llvm::codegenoptions::DebugLineTablesOnly)
2645+
return;
26442646

26452647
ASTContext &Context = CGM.getContext();
26462648
StringRef SymbolName = "_vtable$";

clang/test/CodeGenCXX/debug-info-gline-tables-only.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ class E : public C {
1414
// CHECK-NOT: DW_TAG_reference type
1515
void x(const D& d);
1616
};
17+
// CHECK-NOT: DW_TAG_structure_type
1718
struct F {
1819
enum X { };
1920
void func(X);
21+
// CHECK-NOT: DW_TAG_member
2022
virtual ~F();
2123
};
2224
F::~F() {

0 commit comments

Comments
 (0)