]> granicus.if.org Git - clang/commit
Implement function template specialization at class scope extension in Microsoft...
authorFrancois Pichet <pichet2000@gmail.com>
Sun, 14 Aug 2011 03:52:19 +0000 (03:52 +0000)
committerFrancois Pichet <pichet2000@gmail.com>
Sun, 14 Aug 2011 03:52:19 +0000 (03:52 +0000)
commitaf0f4d0b2e38c810effc8b024ad2fb6604eec5d3
treee02768586a43f2fde43a836af675d9a94a86ad93
parent57c43a29f5455ba5876f61e726ad622807412785
Implement function template specialization at class scope extension in Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization.

Example:
template <class T>
class A {
public:
  template <class U> void f(U p) {  }
  template <> void f(int p) {  } // <== class scope specialization
};

This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code.
BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137573 91177308-0d34-0410-b5e6-96231b3b80d8
21 files changed:
include/clang/AST/ASTContext.h
include/clang/AST/Decl.h
include/clang/AST/DeclTemplate.h
include/clang/AST/RecursiveASTVisitor.h
include/clang/Basic/DeclNodes.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
include/clang/Sema/Template.h
include/clang/Serialization/ASTBitCodes.h
lib/AST/ASTContext.cpp
lib/AST/Decl.cpp
lib/AST/DeclBase.cpp
lib/CodeGen/CGDecl.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaTemplate.cpp
lib/Sema/SemaTemplateInstantiate.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp
lib/Serialization/ASTReaderDecl.cpp
test/SemaTemplate/ms-function-specialization-class-scope.cpp [new file with mode: 0644]
tools/libclang/CIndex.cpp