diff options
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 2a13c9576c7..1f4be4405b5 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -1985,25 +1985,6 @@ static void handleNoReturnAttr(Sema &S, Decl *D, const AttributeList &Attrs) { Attrs.getRange(), S.Context, Attrs.getAttributeSpellingListIndex())); } -static void handleNoThrowAttr(Sema &S, Decl *D, const AttributeList &Attrs) { - assert(isa<FunctionDecl>(D) && "attribute nothrow only valid on functions"); - - auto *FD = cast<FunctionDecl>(D); - const auto *FPT = FD->getType()->getAs<FunctionProtoType>(); - - if (FPT && FPT->hasExceptionSpec() && - FPT->getExceptionSpecType() != EST_BasicNoexcept) { - S.Diag(Attrs.getLoc(), - diag::warn_nothrow_attr_disagrees_with_exception_specification); - S.Diag(FD->getExceptionSpecSourceRange().getBegin(), - diag::note_previous_decl) - << "exception specification"; - } - - D->addAttr(::new (S.Context) NoThrowAttr( - Attrs.getRange(), S.Context, Attrs.getAttributeSpellingListIndex())); -} - static void handleNoCallerSavedRegsAttr(Sema &S, Decl *D, const AttributeList &Attr) { if (S.CheckNoCallerSavedRegsAttr(Attr)) @@ -6230,7 +6211,7 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, handleNoReturnAttr(S, D, Attr); break; case AttributeList::AT_NoThrow: - handleNoThrowAttr(S, D, Attr); + handleSimpleAttribute<NoThrowAttr>(S, D, Attr); break; case AttributeList::AT_CUDAShared: handleSharedAttr(S, D, Attr); |