diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-09-13 22:01:49 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-09-13 22:01:49 +0000 |
commit | 1af8ad49fdd519f563b8b93e9054428cd4fdaea5 (patch) | |
tree | e680b526385411e5d1c9739ab4598ebc120e7102 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | ca24ed473b9ce172021bf145062ab7617cd5d342 (diff) | |
download | bcm5719-llvm-1af8ad49fdd519f563b8b93e9054428cd4fdaea5.tar.gz bcm5719-llvm-1af8ad49fdd519f563b8b93e9054428cd4fdaea5.zip |
Actually rebuild function types properly when adjusting the function
type of an instantiation.
llvm-svn: 163848
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 858aabf8a8b..21ddd473636 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1017,10 +1017,19 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) { static QualType adjustFunctionTypeForInstantiation(ASTContext &Context, FunctionDecl *D, TypeSourceInfo *TInfo) { - const FunctionType *OrigFunc = D->getType()->castAs<FunctionType>(); - const FunctionType *NewFunc = TInfo->getType()->castAs<FunctionType>(); - return QualType(Context.adjustFunctionType(NewFunc, OrigFunc->getExtInfo()), - 0); + const FunctionProtoType *OrigFunc + = D->getType()->castAs<FunctionProtoType>(); + const FunctionProtoType *NewFunc + = TInfo->getType()->castAs<FunctionProtoType>(); + if (OrigFunc->getExtInfo() == NewFunc->getExtInfo()) + return TInfo->getType(); + + FunctionProtoType::ExtProtoInfo NewEPI = NewFunc->getExtProtoInfo(); + NewEPI.ExtInfo = OrigFunc->getExtInfo(); + return Context.getFunctionType(NewFunc->getResultType(), + NewFunc->arg_type_begin(), + NewFunc->getNumArgs(), + NewEPI); } /// Normal class members are of more specific types and therefore |