diff options
author | Reid Kleckner <rnk@google.com> | 2016-09-13 00:01:23 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-09-13 00:01:23 +0000 |
commit | 6c7b1c62126cea0146777b878a4516aa23073ae2 (patch) | |
tree | 8ed58cedc055ae45c7d17ec8db8c4711e3dd234b /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | f8f632498307d22e10fab0704548b270b15f1e1e (diff) | |
download | bcm5719-llvm-6c7b1c62126cea0146777b878a4516aa23073ae2.tar.gz bcm5719-llvm-6c7b1c62126cea0146777b878a4516aa23073ae2.zip |
[DebugInfo] Deduplicate debug info limiting logic
We should be doing the same checks when a type is completed as we do
when a complete type is used during emission. Previously, we duplicated
the logic, and it got out of sync. This could be observed with
dllimported classes.
Also reduce a test case for this slightly.
Implementing review feedback from David Blaikie on r281057.
llvm-svn: 281278
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index c2878c38f6e..c0af91fd62d 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1644,27 +1644,6 @@ void CGDebugInfo::completeType(const RecordDecl *RD) { completeRequiredType(RD); } -void CGDebugInfo::completeRequiredType(const RecordDecl *RD) { - if (DebugKind <= codegenoptions::DebugLineTablesOnly) - return; - - // If this is a dynamic class and we're emitting limited debug info, wait - // until the vtable is emitted to complete the class debug info. - if (DebugKind <= codegenoptions::LimitedDebugInfo) { - if (const auto *CXXDecl = dyn_cast<CXXRecordDecl>(RD)) - if (CXXDecl->isDynamicClass()) - return; - } - - if (DebugTypeExtRefs && RD->isFromASTFile()) - return; - - QualType Ty = CGM.getContext().getRecordType(RD); - llvm::DIType *T = getTypeOrNull(Ty); - if (T && T->isForwardDecl()) - completeClassData(RD); -} - void CGDebugInfo::completeClassData(const RecordDecl *RD) { if (DebugKind <= codegenoptions::DebugLineTablesOnly) return; @@ -1763,6 +1742,16 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, return false; } +void CGDebugInfo::completeRequiredType(const RecordDecl *RD) { + if (shouldOmitDefinition(DebugKind, DebugTypeExtRefs, RD, CGM.getLangOpts())) + return; + + QualType Ty = CGM.getContext().getRecordType(RD); + llvm::DIType *T = getTypeOrNull(Ty); + if (T && T->isForwardDecl()) + completeClassData(RD); +} + llvm::DIType *CGDebugInfo::CreateType(const RecordType *Ty) { RecordDecl *RD = Ty->getDecl(); llvm::DIType *T = cast_or_null<llvm::DIType>(getTypeOrNull(QualType(Ty, 0))); |