diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-04-22 22:18:13 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-04-22 22:18:13 +0000 |
commit | 1c229c0472edfd59ce61ba063a93517df609ceb4 (patch) | |
tree | 1e04ded322353a75ad11c8a4abc2062bda412992 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 91956aba03217e41b7664cdfc575907593067f39 (diff) | |
download | bcm5719-llvm-1c229c0472edfd59ce61ba063a93517df609ceb4.tar.gz bcm5719-llvm-1c229c0472edfd59ce61ba063a93517df609ceb4.zip |
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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index e73a0cffdb1..83e927fcadb 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -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; |