From 1942e1869d14ae6e810c11fb4b41d6ae31887a3f Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 27 Aug 2013 05:21:11 +0000 Subject: [PATCH] PR14569: Omit debug info for thunks This was added in r166676 based on PR13942 on the basis that tools may need debug information for any executable code/function for some fairly broad/non-specific purposes. It seems to me (as noted in PR14569) that the major/only purpose is in backtraces, which should generally not apply to thunks as they won't appear in the stack themselves. By removing them we fix PR14569 and reduce the size of Clang's debug info. Strangely enough this doesn't seem to have a substantial impact on Clang's self-hosted debug info (at least looking at DWO file size) size at all. Not sure if I failed to test this correctly but I only observed a 0.004% change in DWO file size over Clang+LLVM. With thanks to Dinesh Dwivedi for work on this PR. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189320 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGVTables.cpp | 1 + test/CodeGenCXX/debug-info-thunk.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp index 26ebf913a9..6eb3e89d27 100644 --- a/lib/CodeGen/CGVTables.cpp +++ b/lib/CodeGen/CGVTables.cpp @@ -292,6 +292,7 @@ void CodeGenFunction::GenerateVarArgsThunk( void CodeGenFunction::GenerateThunk(llvm::Function *Fn, const CGFunctionInfo &FnInfo, GlobalDecl GD, const ThunkInfo &Thunk) { + DebugInfo = NULL; // debug info for thunks is not required or desired const CXXMethodDecl *MD = cast(GD.getDecl()); const FunctionProtoType *FPT = MD->getType()->getAs(); QualType ThisType = MD->getThisType(getContext()); diff --git a/test/CodeGenCXX/debug-info-thunk.cpp b/test/CodeGenCXX/debug-info-thunk.cpp index 394ebd8291..b2bb5a9e39 100644 --- a/test/CodeGenCXX/debug-info-thunk.cpp +++ b/test/CodeGenCXX/debug-info-thunk.cpp @@ -14,4 +14,4 @@ struct C : A, B { void C::f() { } -// CHECK: [ DW_TAG_subprogram ] [line 15] [def] [_ZThn{{4|8}}_N1C1fEv] +// CHECK-NOT: [ DW_TAG_subprogram ] [line 15] [def] [_ZThn{{4|8}}_N1C1fEv] -- 2.40.0