aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-08-05 02:54:05 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-08-05 02:54:05 +0000
commitfa869547eb1cab12d7e0c0dfa8ba594e336b9b32 (patch)
treed5dec8ffe4aef725e83e3e032d063048cce4d6f0
parent1357869bc5983cdfbc986db1f3d18265bb34cb0e (diff)
Preserve calling convention etc. across template instantiations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110304 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/Sema.h3
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp3
-rw-r--r--lib/Sema/SemaType.cpp6
-rw-r--r--lib/Sema/TreeTransform.h15
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<Derived>::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<Derived>::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<Derived>::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<typename Derived>