From fa869547eb1cab12d7e0c0dfa8ba594e336b9b32 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 5 Aug 2010 02:54:05 +0000 Subject: [PATCH] Preserve calling convention etc. across template instantiations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110304 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/Sema.h | 3 ++- lib/Sema/SemaTemplateDeduction.cpp | 3 ++- lib/Sema/SemaType.cpp | 6 +++--- lib/Sema/TreeTransform.h | 15 ++++++++++----- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 134596096d..59a628aad2 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -769,7 +769,8 @@ public: QualType BuildFunctionType(QualType T, QualType *ParamTypes, unsigned NumParamTypes, bool Variadic, unsigned Quals, - SourceLocation Loc, DeclarationName Entity); + SourceLocation Loc, DeclarationName Entity, + const FunctionType::ExtInfo &Info); QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity); diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index 403d5543a6..885cb06dca 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -1245,7 +1245,8 @@ Sema::SubstituteExplicitTemplateArguments( Proto->isVariadic(), Proto->getTypeQuals(), Function->getLocation(), - Function->getDeclName()); + Function->getDeclName(), + Proto->getExtInfo()); if (FunctionType->isNull() || Trap.hasErrorOccurred()) return TDK_SubstitutionFailure; } diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index feff524143..b3df9eb436 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -811,7 +811,8 @@ QualType Sema::BuildFunctionType(QualType T, QualType *ParamTypes, unsigned NumParamTypes, bool Variadic, unsigned Quals, - SourceLocation Loc, DeclarationName Entity) { + SourceLocation Loc, DeclarationName Entity, + const FunctionType::ExtInfo &Info) { if (T->isArrayType() || T->isFunctionType()) { Diag(Loc, diag::err_func_returning_array_function) << T->isFunctionType() << T; @@ -833,8 +834,7 @@ QualType Sema::BuildFunctionType(QualType T, return QualType(); return Context.getFunctionType(T, ParamTypes, NumParamTypes, Variadic, - Quals, false, false, 0, 0, - FunctionType::ExtInfo()); + Quals, false, false, 0, 0, Info); } /// \brief Build a member pointer type \c T Class::*. diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 9920e4e9ea..d13219dbcf 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -468,7 +468,8 @@ public: QualType RebuildFunctionProtoType(QualType T, QualType *ParamTypes, unsigned NumParamTypes, - bool Variadic, unsigned Quals); + bool Variadic, unsigned Quals, + const FunctionType::ExtInfo &Info); /// \brief Build a new unprototyped function type. QualType RebuildFunctionNoProtoType(QualType ResultType); @@ -2932,7 +2933,8 @@ TreeTransform::TransformFunctionProtoType(TypeLocBuilder &TLB, ParamTypes.data(), ParamTypes.size(), T->isVariadic(), - T->getTypeQuals()); + T->getTypeQuals(), + T->getExtInfo()); if (Result.isNull()) return QualType(); } @@ -6252,7 +6254,8 @@ TreeTransform::TransformBlockExpr(BlockExpr *E) { ParamTypes.data(), ParamTypes.size(), BD->isVariadic(), - 0); + 0, + BExprFunctionType->getExtInfo()); CurBlock->FunctionType = FunctionType; return SemaRef.ActOnBlockStmtExpr(CaretLoc, move(Body), /*Scope=*/0); @@ -6429,11 +6432,13 @@ QualType TreeTransform::RebuildFunctionProtoType(QualType T, QualType *ParamTypes, unsigned NumParamTypes, bool Variadic, - unsigned Quals) { + unsigned Quals, + const FunctionType::ExtInfo &Info) { return SemaRef.BuildFunctionType(T, ParamTypes, NumParamTypes, Variadic, Quals, getDerived().getBaseLocation(), - getDerived().getBaseEntity()); + getDerived().getBaseEntity(), + Info); } template -- 2.40.0