[PATCH] D19201: [clang-tidy] misc-throw-with-noexcept

Stanisław Barzowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 7 11:17:21 PST 2017


sbarzowski added inline comments.


================
Comment at: clang-tidy/misc/ThrowWithNoexceptCheck.cpp:54
+    // FIXME use DiagnosticIDs::Level::Note
+    diag(NoExceptRange.getBegin(), "in a function declared no-throw here:", DiagnosticIDs::Note)
+        << FixItHint::CreateRemoval(NoExceptRange);
----------------
alexfh wrote:
> nit: `nothrow` (without a dash), no colon needed (it will look weird, since the location is mentioned _before_ the message, not after it)
No, it's after the message now. When I changed the level to note the order of messages changed as well.

It looks like that:
```
/Users/uland/clang-new/build/tools/clang/tools/extra/test/clang-tidy/Output/misc-throw-with-noexcept.cpp.tmp.cpp:5:5: warning: 'throw' expression in a function declared with a non-throwing exception specification [misc-throw-with-noexcept]
    throw 5;
    ^
/Users/uland/clang-new/build/tools/clang/tools/extra/test/clang-tidy/Output/misc-throw-with-noexcept.cpp.tmp.cpp:3:24: note: FIX-IT applied suggested code changes
void f_throw_with_ne() noexcept(true) {
                       ^
/Users/uland/clang-new/build/tools/clang/tools/extra/test/clang-tidy/Output/misc-throw-with-noexcept.cpp.tmp.cpp:3:24: note: in a function declared nothrow here:
void f_throw_with_ne() noexcept(true) {
                       ^

```

So, should I leave the colon or remove it anyway?


https://reviews.llvm.org/D19201





More information about the cfe-commits mailing list