aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2011-03-06 10:52:04 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2011-03-06 10:52:04 +0000
commit8b5b4099c61a136e9a1714c4d8a593febe942268 (patch)
treea841ec99921f03ce9577a2216960103d96dfd95c /lib/Sema
parent5453d93ab8668f2d9d0bc02182695b02d207e32d (diff)
Reinstate r127112, "Propagate new-style exception spec information to ExtProtoInfo.", this time with the missing header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127118 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp22
-rw-r--r--lib/Sema/SemaExceptionSpec.cpp8
-rw-r--r--lib/Sema/SemaExprCXX.cpp2
-rw-r--r--lib/Sema/SemaLookup.cpp3
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp5
-rw-r--r--lib/Sema/SemaType.cpp9
6 files changed, 26 insertions, 23 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 623e72f299..ba929587ae 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -4712,11 +4712,12 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(
}
FunctionProtoType::ExtProtoInfo EPI;
- EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification();
- EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification();
+ EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ?
+ (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) :
+ EST_None;
EPI.NumExceptions = ExceptSpec.size();
EPI.Exceptions = ExceptSpec.data();
-
+
// Create the actual constructor declaration.
CanQualType ClassType
= Context.getCanonicalType(Context.getTypeDeclType(ClassDecl));
@@ -4989,8 +4990,9 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(CXXRecordDecl *ClassDecl) {
// Create the actual destructor declaration.
FunctionProtoType::ExtProtoInfo EPI;
- EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification();
- EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification();
+ EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ?
+ (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) :
+ EST_None;
EPI.NumExceptions = ExceptSpec.size();
EPI.Exceptions = ExceptSpec.data();
QualType Ty = Context.getFunctionType(Context.VoidTy, 0, 0, EPI);
@@ -5387,8 +5389,9 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) {
// An implicitly-declared copy assignment operator is an inline public
// member of its class.
FunctionProtoType::ExtProtoInfo EPI;
- EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification();
- EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification();
+ EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ?
+ (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) :
+ EST_None;
EPI.NumExceptions = ExceptSpec.size();
EPI.Exceptions = ExceptSpec.data();
DeclarationName Name = Context.DeclarationNames.getCXXOperatorName(OO_Equal);
@@ -5849,8 +5852,9 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor(
// An implicitly-declared copy constructor is an inline public
// member of its class.
FunctionProtoType::ExtProtoInfo EPI;
- EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification();
- EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification();
+ EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ?
+ (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) :
+ EST_None;
EPI.NumExceptions = ExceptSpec.size();
EPI.Exceptions = ExceptSpec.data();
DeclarationName Name
diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp
index 123e185cab..75ae8c215a 100644
--- a/lib/Sema/SemaExceptionSpec.cpp
+++ b/lib/Sema/SemaExceptionSpec.cpp
@@ -129,8 +129,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
Context.getSourceManager().isInSystemHeader(Old->getLocation())) &&
Old->isExternC()) {
FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo();
- EPI.HasExceptionSpec = true;
- EPI.HasAnyExceptionSpec = false;
+ EPI.ExceptionSpecType = EST_Dynamic;
EPI.NumExceptions = 0;
QualType NewType = Context.getFunctionType(NewProto->getResultType(),
NewProto->arg_type_begin(),
@@ -145,8 +144,9 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
= Old->getType()->getAs<FunctionProtoType>();
FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo();
- EPI.HasExceptionSpec = OldProto->hasExceptionSpec();
- EPI.HasAnyExceptionSpec = OldProto->hasAnyExceptionSpec();
+ EPI.ExceptionSpecType = OldProto->hasExceptionSpec() ?
+ (OldProto->hasAnyExceptionSpec() ? EST_DynamicAny : EST_Dynamic) :
+ EST_None;
EPI.NumExceptions = OldProto->getNumExceptions();
EPI.Exceptions = OldProto->exception_begin();
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index eee02096ac..e4ac3ed6bb 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -1501,7 +1501,7 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
}
FunctionProtoType::ExtProtoInfo EPI;
- EPI.HasExceptionSpec = true;
+ EPI.ExceptionSpecType = EST_Dynamic;
if (HasBadAllocExceptionSpec) {
EPI.NumExceptions = 1;
EPI.Exceptions = &BadAllocType;
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index d1b6ef104d..3315ab6e53 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -686,8 +686,7 @@ static bool LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC) {
// FIXME: Calling convention!
FunctionProtoType::ExtProtoInfo EPI = ConvProto->getExtProtoInfo();
EPI.ExtInfo = EPI.ExtInfo.withCallingConv(CC_Default);
- EPI.HasExceptionSpec = false;
- EPI.HasAnyExceptionSpec = false;
+ EPI.ExceptionSpecType = EST_None;
EPI.NumExceptions = 0;
QualType ExpectedType
= R.getSema().Context.getFunctionType(R.getLookupName().getCXXNameType(),
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 3473c87709..b668e17386 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -2158,8 +2158,9 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
// Rebuild the function type
FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo();
- EPI.HasExceptionSpec = Proto->hasExceptionSpec();
- EPI.HasAnyExceptionSpec = Proto->hasAnyExceptionSpec();
+ EPI.ExceptionSpecType = Proto->hasExceptionSpec() ?
+ (Proto->hasAnyExceptionSpec() ? EST_DynamicAny : EST_Dynamic) :
+ EST_None;
EPI.NumExceptions = Exceptions.size();
EPI.Exceptions = Exceptions.data();
EPI.ExtInfo = Proto->getExtInfo();
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 33df7a0529..efb44df474 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1855,11 +1855,8 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
}
llvm::SmallVector<QualType, 4> Exceptions;
- if (FTI.getExceptionSpecType() == EST_Dynamic ||
- FTI.getExceptionSpecType() == EST_DynamicAny) {
- EPI.HasExceptionSpec = true;
- EPI.HasAnyExceptionSpec =
- FTI.getExceptionSpecType() == EST_DynamicAny;
+ EPI.ExceptionSpecType = FTI.getExceptionSpecType();
+ if (FTI.getExceptionSpecType() == EST_Dynamic) {
Exceptions.reserve(FTI.NumExceptions);
for (unsigned ei = 0, ee = FTI.NumExceptions; ei != ee; ++ei) {
// FIXME: Preserve type source info.
@@ -1871,6 +1868,8 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
}
EPI.NumExceptions = Exceptions.size();
EPI.Exceptions = Exceptions.data();
+ } else if (FTI.getExceptionSpecType() == EST_ComputedNoexcept) {
+ EPI.NoexceptExpr = FTI.NoexceptExpr;
}
T = Context.getFunctionType(T, ArgTys.data(), ArgTys.size(), EPI);