This is https://bugs.llvm.org/show_bug.cgi?id=34805
On Mon, Oct 2, 2017 at 10:16 AM, Reid Kleckner via cfe-commits <cfe-commits@lists.llvm.org> wrote: > Author: rnk > Date: Mon Oct 2 10:16:14 2017 > New Revision: 314689 > > URL: http://llvm.org/viewvc/llvm-project?rev=314689&view=rev > Log: > Revert "[Sema] Warn on attribute nothrow conflicting with language specifiers" > > This reverts r314461. > > It is warning on user code that uses END_COM_MAP(), which expands to > declare QueryInterface with conflicting exception specifers. I've spent > a while trying to understand why, but haven't been able to extract a > reduced test case. Let's revert and I'll keep trying. > > Removed: > cfe/trunk/test/SemaCXX/warn-conflicting-nothrow-attr-exception-spec.cpp > Modified: > cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > cfe/trunk/lib/Sema/SemaDeclAttr.cpp > > Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=314689&r1=314688&r2=314689&view=diff > ============================================================================== > --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) > +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Oct 2 10:16:14 > 2017 > @@ -1419,10 +1419,6 @@ def err_noexcept_needs_constant_expressi > "argument to noexcept specifier must be a constant expression">; > def err_exception_spec_not_parsed : Error< > "exception specification is not available until end of class definition">; > -def warn_nothrow_attr_disagrees_with_exception_specification > - : ExtWarn<"attribute 'nothrow' ignored due to conflicting exception " > - "specification">, > - InGroup<IgnoredAttributes>; > > // C++ access checking > def err_class_redeclared_with_different_access : Error< > > Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=314689&r1=314688&r2=314689&view=diff > ============================================================================== > --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original) > +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Oct 2 10:16:14 2017 > @@ -1985,25 +1985,6 @@ static void handleNoReturnAttr(Sema &S, > 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 > 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); > > Removed: > cfe/trunk/test/SemaCXX/warn-conflicting-nothrow-attr-exception-spec.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-conflicting-nothrow-attr-exception-spec.cpp?rev=314688&view=auto > ============================================================================== > --- cfe/trunk/test/SemaCXX/warn-conflicting-nothrow-attr-exception-spec.cpp > (original) > +++ cfe/trunk/test/SemaCXX/warn-conflicting-nothrow-attr-exception-spec.cpp > (removed) > @@ -1,24 +0,0 @@ > -// RUN: %clang_cc1 %s -fcxx-exceptions -fsyntax-only -Wexceptions -verify > -std=c++14 > - > -struct S { > - //expected-warning@+2 {{attribute 'nothrow' ignored due to conflicting > exception specification}} > - //expected-note@+1 {{exception specification declared here}} > - __attribute__((nothrow)) S() noexcept(true); > - //expected-warning@+2 {{attribute 'nothrow' ignored due to conflicting > exception specification}} > - //expected-note@+1 {{exception specification declared here}} > - __attribute__((nothrow)) void Func1() noexcept(false); > - __attribute__((nothrow)) void Func3() noexcept; > -}; > - > -void throwing() noexcept(false); > -void non_throwing(bool b = true) noexcept; > - > -template <typename Fn> > -struct T { > - __attribute__((nothrow)) void f(Fn) noexcept(Fn()); > -}; > - > -//expected-warning@-3 {{attribute 'nothrow' ignored due to conflicting > exception specification}} > -//expected-note@-4 {{exception specification declared here}} > -template struct T<decltype(throwing)>; > -template struct T<decltype(non_throwing)>; > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits