From 8387e2a41eef6fa17fb140a18c29b6eee9dd2b8a Mon Sep 17 00:00:00 2001 From: Francois Pichet Date: Fri, 22 Apr 2011 22:18:13 +0000 Subject: Add -fdelayed-template-parsing option. Using this option all templated function definitions are parsed at the end of the translation unit only if it is required by an actual instantiation. As such all the symbols of the TU are available during name lookup. Using this flag is necessary for compatibility with Microsoft template code. This also provides some parsing speed improvement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130022 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index e73a0cffdb..83e927fcad 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -2031,7 +2031,8 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { case Decl::CXXMethod: case Decl::Function: // Skip function templates - if (cast(D)->getDescribedFunctionTemplate()) + if (cast(D)->getDescribedFunctionTemplate() || + cast(D)->isLateTemplateParsed()) return; EmitGlobal(cast(D)); @@ -2060,12 +2061,15 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { break; case Decl::CXXConstructor: // Skip function templates - if (cast(D)->getDescribedFunctionTemplate()) + if (cast(D)->getDescribedFunctionTemplate() || + cast(D)->isLateTemplateParsed()) return; EmitCXXConstructors(cast(D)); break; case Decl::CXXDestructor: + if (cast(D)->isLateTemplateParsed()) + return; EmitCXXDestructors(cast(D)); break; -- cgit v1.2.3-70-g09d2