diff options
author | Adrian McCarthy <amccarth@google.com> | 2016-08-16 22:11:18 +0000 |
---|---|---|
committer | Adrian McCarthy <amccarth@google.com> | 2016-08-16 22:11:18 +0000 |
commit | 992429843b768381484abfc0bf7b2c3dc1984ae5 (patch) | |
tree | d43fb0547979412997533209fa8b760821a2924f /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | 744a8753dbe25ae314b7bfef758212f11d8839b1 (diff) | |
download | bcm5719-llvm-992429843b768381484abfc0bf7b2c3dc1984ae5.tar.gz bcm5719-llvm-992429843b768381484abfc0bf7b2c3dc1984ae5.zip |
Emit debug info for dynamic classes if they are imported from a DLL.
With -debug-info-kind=limited, we omit debug info for dynamic classes that live in other TUs. This reduces duplicate type information. When statically linked, the type information comes together. But if your binary has a class derived from a base in a DLL, the base class info is not available to the debugger.
The decision is made in shouldOmitDefinition (CGDebugInfo.cpp). Per a suggestion from rnk, I've tweaked the decision so that we do include definitions for classes marked as DLL imports. This should be a relatively small number of classes, so we don't pay a large price for duplication of the type info, yet it should cover most cases on Windows.
Essentially this makes debug info for DLLs independent, but we still assume that all TUs within the same DLL will be consistently built with (or without) debug info and the debugger will be able to search across the debug info within that scope to resolve any declarations into definitions, etc.
llvm-svn: 278861
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 8722e5ae260..ee2e21bdd48 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1685,7 +1685,12 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, if (!CXXDecl) return false; - if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass()) + // Only emit complete debug info for a dynamic class when its vtable is + // emitted. However, Microsoft debuggers don't resolve type information + // across DLL boundaries, so skip this optimization if the class is marked + // dllimport. + if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass() && + !CXXDecl->hasAttr<DLLImportAttr>()) return true; TemplateSpecializationKind Spec = TSK_Undeclared; |