diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2011-03-06 00:17:36 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2011-03-06 00:17:36 +0000 |
commit | c92335a87c55d11f1df685a9e29205cf4bf2c651 (patch) | |
tree | ece389243033b613eafac574c39a78a474ddd099 /clang/lib | |
parent | 0d8150f2790d1566b74fc4bd47cc17b7872d9387 (diff) | |
download | bcm5719-llvm-c92335a87c55d11f1df685a9e29205cf4bf2c651.tar.gz bcm5719-llvm-c92335a87c55d11f1df685a9e29205cf4bf2c651.zip |
Revert r127112, "Propagate new-style exception spec information to ExtProtoInfo."
It seems missing "clang/Basic/ExceptionSpecificationType.h".
llvm-svn: 127115
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 9 | ||||
-rw-r--r-- | clang/lib/AST/Type.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 22 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 3 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 5 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 6 |
9 files changed, 35 insertions, 37 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index f9cc06987b6..3fd58ce9fdf 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1913,7 +1913,7 @@ ASTContext::getFunctionType(QualType ResultTy, return QualType(FTP, 0); // Determine whether the type being created is already canonical or not. - bool isCanonical= EPI.ExceptionSpecType == EST_None && ResultTy.isCanonical(); + bool isCanonical = !EPI.HasExceptionSpec && ResultTy.isCanonical(); for (unsigned i = 0; i != NumArgs && isCanonical; ++i) if (!ArgArray[i].isCanonicalAsParam()) isCanonical = false; @@ -1932,8 +1932,11 @@ ASTContext::getFunctionType(QualType ResultTy, CanonicalArgs.push_back(getCanonicalParamType(ArgArray[i])); FunctionProtoType::ExtProtoInfo CanonicalEPI = EPI; - CanonicalEPI.ExceptionSpecType = EST_None; - CanonicalEPI.NumExceptions = 0; + if (CanonicalEPI.HasExceptionSpec) { + CanonicalEPI.HasExceptionSpec = false; + CanonicalEPI.HasAnyExceptionSpec = false; + CanonicalEPI.NumExceptions = 0; + } CanonicalEPI.ExtInfo = CanonicalEPI.ExtInfo.withCallingConv(getCanonicalCallConv(CallConv)); diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index eea08f6242f..cde865f5b9f 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -1173,8 +1173,8 @@ FunctionProtoType::FunctionProtoType(QualType result, const QualType *args, result->containsUnexpandedParameterPack(), epi.ExtInfo), NumArgs(numArgs), NumExceptions(epi.NumExceptions), - HasExceptionSpec(isDynamicExceptionSpec(epi.ExceptionSpecType)), - HasAnyExceptionSpec(epi.ExceptionSpecType == EST_DynamicAny) + HasExceptionSpec(epi.HasExceptionSpec), + HasAnyExceptionSpec(epi.HasAnyExceptionSpec) { // Fill in the trailing argument array. QualType *argSlot = reinterpret_cast<QualType*>(this+1); @@ -1218,8 +1218,8 @@ void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, QualType Result, ID.AddBoolean(epi.Variadic); ID.AddInteger(epi.TypeQuals); ID.AddInteger(epi.RefQualifier); - if (isDynamicExceptionSpec(epi.ExceptionSpecType)) { - ID.AddBoolean(epi.ExceptionSpecType == EST_DynamicAny); + if (epi.HasExceptionSpec) { + ID.AddBoolean(epi.HasAnyExceptionSpec); for (unsigned i = 0; i != epi.NumExceptions; ++i) ID.AddPointer(epi.Exceptions[i].getAsOpaquePtr()); } diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index ba929587aea..623e72f2998 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -4712,12 +4712,11 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor( } FunctionProtoType::ExtProtoInfo EPI; - EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ? - (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) : - EST_None; + EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification(); + EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification(); EPI.NumExceptions = ExceptSpec.size(); EPI.Exceptions = ExceptSpec.data(); - + // Create the actual constructor declaration. CanQualType ClassType = Context.getCanonicalType(Context.getTypeDeclType(ClassDecl)); @@ -4990,9 +4989,8 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(CXXRecordDecl *ClassDecl) { // Create the actual destructor declaration. FunctionProtoType::ExtProtoInfo EPI; - EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ? - (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) : - EST_None; + EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification(); + EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification(); EPI.NumExceptions = ExceptSpec.size(); EPI.Exceptions = ExceptSpec.data(); QualType Ty = Context.getFunctionType(Context.VoidTy, 0, 0, EPI); @@ -5389,9 +5387,8 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) { // An implicitly-declared copy assignment operator is an inline public // member of its class. FunctionProtoType::ExtProtoInfo EPI; - EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ? - (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) : - EST_None; + EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification(); + EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification(); EPI.NumExceptions = ExceptSpec.size(); EPI.Exceptions = ExceptSpec.data(); DeclarationName Name = Context.DeclarationNames.getCXXOperatorName(OO_Equal); @@ -5852,9 +5849,8 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor( // An implicitly-declared copy constructor is an inline public // member of its class. FunctionProtoType::ExtProtoInfo EPI; - EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ? - (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) : - EST_None; + EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification(); + EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification(); EPI.NumExceptions = ExceptSpec.size(); EPI.Exceptions = ExceptSpec.data(); DeclarationName Name diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 75ae8c215ab..123e185cab3 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -129,7 +129,8 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { Context.getSourceManager().isInSystemHeader(Old->getLocation())) && Old->isExternC()) { FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo(); - EPI.ExceptionSpecType = EST_Dynamic; + EPI.HasExceptionSpec = true; + EPI.HasAnyExceptionSpec = false; EPI.NumExceptions = 0; QualType NewType = Context.getFunctionType(NewProto->getResultType(), NewProto->arg_type_begin(), @@ -144,9 +145,8 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { = Old->getType()->getAs<FunctionProtoType>(); FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo(); - EPI.ExceptionSpecType = OldProto->hasExceptionSpec() ? - (OldProto->hasAnyExceptionSpec() ? EST_DynamicAny : EST_Dynamic) : - EST_None; + EPI.HasExceptionSpec = OldProto->hasExceptionSpec(); + EPI.HasAnyExceptionSpec = OldProto->hasAnyExceptionSpec(); EPI.NumExceptions = OldProto->getNumExceptions(); EPI.Exceptions = OldProto->exception_begin(); diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index e4ac3ed6bbb..eee02096ac7 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1501,7 +1501,7 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, } FunctionProtoType::ExtProtoInfo EPI; - EPI.ExceptionSpecType = EST_Dynamic; + EPI.HasExceptionSpec = true; if (HasBadAllocExceptionSpec) { EPI.NumExceptions = 1; EPI.Exceptions = &BadAllocType; diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 3315ab6e53a..d1b6ef104d3 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -686,7 +686,8 @@ 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.ExceptionSpecType = EST_None; + EPI.HasExceptionSpec = false; + EPI.HasAnyExceptionSpec = false; EPI.NumExceptions = 0; QualType ExpectedType = R.getSema().Context.getFunctionType(R.getLookupName().getCXXNameType(), diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index b668e173867..3473c877093 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -2158,9 +2158,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; + EPI.HasExceptionSpec = Proto->hasExceptionSpec(); + EPI.HasAnyExceptionSpec = Proto->hasAnyExceptionSpec(); EPI.NumExceptions = Exceptions.size(); EPI.Exceptions = Exceptions.data(); EPI.ExtInfo = Proto->getExtInfo(); diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index efb44df4746..33df7a0529f 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1855,8 +1855,11 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S, } llvm::SmallVector<QualType, 4> Exceptions; - EPI.ExceptionSpecType = FTI.getExceptionSpecType(); - if (FTI.getExceptionSpecType() == EST_Dynamic) { + if (FTI.getExceptionSpecType() == EST_Dynamic || + FTI.getExceptionSpecType() == EST_DynamicAny) { + EPI.HasExceptionSpec = true; + EPI.HasAnyExceptionSpec = + FTI.getExceptionSpecType() == EST_DynamicAny; Exceptions.reserve(FTI.NumExceptions); for (unsigned ei = 0, ee = FTI.NumExceptions; ei != ee; ++ei) { // FIXME: Preserve type source info. @@ -1868,8 +1871,6 @@ 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); diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 72637c1eb0b..83b1239b7f3 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3111,10 +3111,8 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) { EPI.Variadic = Record[Idx++]; EPI.TypeQuals = Record[Idx++]; EPI.RefQualifier = static_cast<RefQualifierKind>(Record[Idx++]); - bool HasExceptionSpec = Record[Idx++]; - bool HasAnyExceptionSpec = Record[Idx++]; - EPI.ExceptionSpecType = HasExceptionSpec ? - (HasAnyExceptionSpec ? EST_DynamicAny : EST_Dynamic) : EST_None; + EPI.HasExceptionSpec = Record[Idx++]; + EPI.HasAnyExceptionSpec = Record[Idx++]; EPI.NumExceptions = Record[Idx++]; llvm::SmallVector<QualType, 2> Exceptions; for (unsigned I = 0; I != EPI.NumExceptions; ++I) |