diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
commit | bca07a4524feb4edec581062d631a13116320a24 (patch) | |
tree | a9243275843fbeaa590afc07ee888e006b8d54ea /lib/CodeGen/ModuleBuilder.cpp | |
parent | 998bc5802ecdd65ce3b270f6c69a8ae8557f0a10 (diff) |
Notes
Diffstat (limited to 'lib/CodeGen/ModuleBuilder.cpp')
-rw-r--r-- | lib/CodeGen/ModuleBuilder.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp index 6d9d2770c7c84..894502864464c 100644 --- a/lib/CodeGen/ModuleBuilder.cpp +++ b/lib/CodeGen/ModuleBuilder.cpp @@ -71,6 +71,19 @@ namespace { /// (because these can be defined in declspecs). virtual void HandleTagDeclDefinition(TagDecl *D) { Builder->UpdateCompletedType(D); + + // In C++, we may have member functions that need to be emitted at this + // point. + if (Ctx->getLangOptions().CPlusPlus && !D->isDependentContext()) { + for (DeclContext::decl_iterator M = D->decls_begin(), + MEnd = D->decls_end(); + M != MEnd; ++M) + if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(*M)) + if (Method->isThisDeclarationADefinition() && + (Method->hasAttr<UsedAttr>() || + Method->hasAttr<ConstructorAttr>())) + Builder->EmitTopLevelDecl(Method); + } } virtual void HandleTranslationUnit(ASTContext &Ctx) { |