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. llvm-svn: 130022
This commit is contained in:
@@ -2031,7 +2031,8 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
|
||||
case Decl::CXXMethod:
|
||||
case Decl::Function:
|
||||
// Skip function templates
|
||||
if (cast<FunctionDecl>(D)->getDescribedFunctionTemplate())
|
||||
if (cast<FunctionDecl>(D)->getDescribedFunctionTemplate() ||
|
||||
cast<FunctionDecl>(D)->isLateTemplateParsed())
|
||||
return;
|
||||
|
||||
EmitGlobal(cast<FunctionDecl>(D));
|
||||
@@ -2060,12 +2061,15 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
|
||||
break;
|
||||
case Decl::CXXConstructor:
|
||||
// Skip function templates
|
||||
if (cast<FunctionDecl>(D)->getDescribedFunctionTemplate())
|
||||
if (cast<FunctionDecl>(D)->getDescribedFunctionTemplate() ||
|
||||
cast<FunctionDecl>(D)->isLateTemplateParsed())
|
||||
return;
|
||||
|
||||
EmitCXXConstructors(cast<CXXConstructorDecl>(D));
|
||||
break;
|
||||
case Decl::CXXDestructor:
|
||||
if (cast<FunctionDecl>(D)->isLateTemplateParsed())
|
||||
return;
|
||||
EmitCXXDestructors(cast<CXXDestructorDecl>(D));
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user