From bca07a4524feb4edec581062d631a13116320a24 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 20 Feb 2011 13:06:31 +0000 Subject: Vendor import of clang trunk r126079: http://llvm.org/svn/llvm-project/cfe/trunk@126079 --- lib/CodeGen/ModuleBuilder.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/CodeGen/ModuleBuilder.cpp') diff --git a/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp index 6d9d2770c7c8..894502864464 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(*M)) + if (Method->isThisDeclarationADefinition() && + (Method->hasAttr() || + Method->hasAttr())) + Builder->EmitTopLevelDecl(Method); + } } virtual void HandleTranslationUnit(ASTContext &Ctx) { -- cgit v1.2.3