[PATCH] D38205: [Sema] Warn on attribute nothrow conflicting with language specifiers

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 28 10:55:56 PDT 2017

aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D38205#882737, @erichkeane wrote:

> changes that were suggested by @aaron.ballman
> It DOES warn on the template correctly, however I'm not thrilled that it misses the 'warning' info.  Any idea how I can get that information to give that 'note'?  I'd like an "in instantiation of template ..." type note.

That's usually automatic. You might want to look at `Sema::EmitCurrentDiagnostic()` to see what's up, it's `PrintContextStack()` that does the magic.

The diagnostics LGTM as-is, but further improvement isn't discouraged.

Comment at: include/clang/Basic/DiagnosticSemaKinds.td:1411
+def warn_nothrow_attr_disagrees_with_exception_specification
+    : ExtWarn<"Attribute nothrow ignored, it disagrees with language specified "
+              "exception specification">,
aaron.ballman wrote:
> How about: `"attribute 'nothrow' ignored due to conflicting exception specification"`
Close, but not quite. The warning should not be capitalized and it's missing single quotes around `nothrow`.


More information about the cfe-commits mailing list