summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-03-03 23:48:23 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-03-03 23:48:23 +0000
commit0e716b42f4aa17f906dab99557d16e19e8255524 (patch)
tree3b63ce37a63b9252d0d4828ed54829178ee17cc7 /clang/lib/CodeGen/CodeGenModule.cpp
parentfe45290566f5cf207b1b0be049dab2950537a426 (diff)
downloadbcm5719-llvm-0e716b42f4aa17f906dab99557d16e19e8255524.tar.gz
bcm5719-llvm-0e716b42f4aa17f906dab99557d16e19e8255524.zip
DebugInfo: Emit only the declaration of a class template that has an explicit instantiation declaration (& always emit such a type when there's an explicit instantiation definition)
We should only have this optimization fire when the explicit instantiation definition would cause at least one member function to be emitted, thus ensuring that even a compiler not performing this optimization would still emit the full type information elsewhere. But we should also pessimize output still by always emitting the definition when the explicit instantiation definition appears so that at some point in the future we can depend on that information even when no code had to be emitted in that TU. (this shouldn't happen very often, since people mostly use explicit spec decl/defs to reduce code size - but perhaps one day they could use it to explicitly reduce debug info size too) This was worth about 2% for Clang and LLVM - so not a huge win, but a win. It looks really great for simple STL programs (include <string> and just declare a string - 14k -> 1.4k of .dwo) llvm-svn: 202769
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index f7b518abc57..61734899930 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3000,7 +3000,15 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
ImportedModules.insert(Import->getImportedModule());
break;
- }
+ }
+
+ case Decl::ClassTemplateSpecialization: {
+ const ClassTemplateSpecializationDecl *Spec =
+ cast<ClassTemplateSpecializationDecl>(D);
+ if (DebugInfo &&
+ Spec->getSpecializationKind() == TSK_ExplicitInstantiationDefinition)
+ DebugInfo->completeTemplateDefinition(*Spec);
+ }
default:
// Make sure we handled everything we should, every other kind is a
OpenPOWER on IntegriCloud