diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-10-11 09:03:14 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-10-11 09:03:14 +0000 |
commit | dced226e37f7c2c31c25d06c514f29b610fe2a54 (patch) | |
tree | 30aa2297994e532099f846cc528e47c6c5a4b829 /lib/Sema/SemaExprCXX.cpp | |
parent | 13d50177b13161b209579e1f30a5e3cc72f7e2bd (diff) |
Test exception spec compatibility on return type and parameters.
Along the way, use RequireCompleteType when testing exception spec types.
Separate all the ugly spec stuff into its own file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83764 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index eb0b6e1eff..5a40fc83c5 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1275,38 +1275,6 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, return false; } -bool Sema::CheckExceptionSpecCompatibility(Expr *From, QualType ToType) -{ - // First we check for applicability. - // Target type must be a function, function pointer or function reference. - if (const PointerType *PtrTy = ToType->getAs<PointerType>()) - ToType = PtrTy->getPointeeType(); - else if (const ReferenceType *RefTy = ToType->getAs<ReferenceType>()) - ToType = RefTy->getPointeeType(); - - const FunctionProtoType *ToFunc = ToType->getAs<FunctionProtoType>(); - if (!ToFunc) - return false; - - // SourceType must be a function or function pointer. - // References are treated as functions. - QualType FromType = From->getType(); - if (const PointerType *PtrTy = FromType->getAs<PointerType>()) - FromType = PtrTy->getPointeeType(); - - const FunctionProtoType *FromFunc = FromType->getAs<FunctionProtoType>(); - if (!FromFunc) - return false; - - // Now we've got the correct types on both sides, check their compatibility. - // This means that the source of the conversion can only throw a subset of - // the exceptions of the target, and any exception specs on arguments or - // return types must be equivalent. - return CheckExceptionSpecSubset(diag::err_incompatible_exception_specs, - 0, ToFunc, From->getSourceRange().getBegin(), - FromFunc, SourceLocation()); -} - Sema::OwningExprResult Sema::ActOnUnaryTypeTrait(UnaryTypeTrait OTT, SourceLocation KWLoc, SourceLocation LParen, |