aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2011-03-12 11:50:43 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2011-03-12 11:50:43 +0000
commit60618fa7f88d5162bb5b40988b6b38d4d75d6fc6 (patch)
tree21a6d213d2956ce39ff900b79ff7a2275eea5b76 /lib/Sema/SemaTemplateInstantiateDecl.cpp
parent796aa443ab5ed036f42ef33fed629e1b4b34871b (diff)
Propagate the new exception information to FunctionProtoType.
Change the interface to expose the new information and deal with the enormous fallout. Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications. Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index e60882d6cb..441149f374 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -2085,8 +2085,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
const FunctionProtoType *Proto = Tmpl->getType()->getAs<FunctionProtoType>();
assert(Proto && "Function template without prototype?");
- if (Proto->hasExceptionSpec() || Proto->hasAnyExceptionSpec() ||
- Proto->getNoReturnAttr()) {
+ if (Proto->hasExceptionSpec() || Proto->getNoReturnAttr()) {
// The function has an exception specification or a "noreturn"
// attribute. Substitute into each of the exception types.
llvm::SmallVector<QualType, 4> Exceptions;
@@ -2100,7 +2099,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
Unexpanded);
assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
-
+
bool Expand = false;
bool RetainExpansion = false;
llvm::Optional<unsigned> NumExpansions
@@ -2114,7 +2113,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
RetainExpansion,
NumExpansions))
break;
-
+
if (!Expand) {
// We can't expand this pack expansion into separate arguments yet;
// just substitute into the pattern and create a new pack expansion
@@ -2130,7 +2129,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
Exceptions.push_back(T);
continue;
}
-
+
// Substitute into the pack expansion pattern for each template
bool Invalid = false;
for (unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
@@ -2143,13 +2142,13 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
Invalid = true;
break;
}
-
+
Exceptions.push_back(T);
}
-
+
if (Invalid)
break;
-
+
continue;
}
@@ -2166,9 +2165,8 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
// Rebuild the function type
FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo();
- EPI.ExceptionSpecType = Proto->hasExceptionSpec() ?
- (Proto->hasAnyExceptionSpec() ? EST_DynamicAny : EST_Dynamic) :
- EST_None;
+ // FIXME: Handle noexcept
+ EPI.ExceptionSpecType = Proto->getExceptionSpecType();
EPI.NumExceptions = Exceptions.size();
EPI.Exceptions = Exceptions.data();
EPI.ExtInfo = Proto->getExtInfo();