[PATCH] D40787: [clang-tidy] Replace the usage of std::uncaught_exception with std::uncaught_exceptions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 24 11:17:23 PST 2018


aaron.ballman added inline comments.


================
Comment at: test/clang-tidy/modernize-use-uncaught-exceptions.cpp:64
+  // CHECK-MESSAGES: [[@LINE-1]]:10: warning: 'std::uncaught_exception' is deprecated, use 'std::uncaught_exceptions' instead
+  // CHECK-FIXES: foo = &uncaught_exceptions;
+
----------------
koldaniel wrote:
> aaron.ballman wrote:
> > Applying this fix will break the code so that it no longer compiles.
> True, declaration of foo should be changed from type bool to int too. Since as I can see this could cause a lot of problems, shouldn't be there only a warning without fixits?
I think the right approach here is to warn and not suggest a fix-it.


================
Comment at: test/clang-tidy/modernize-use-uncaught-exceptions.cpp:68
+  // CHECK-MESSAGES: [[@LINE-1]]:22: warning: 'std::uncaught_exception' is deprecated, use 'std::uncaught_exceptions' instead
+  // CHECK-FIXES: res = doSomething2<uncaught_exceptions>();
+
----------------
koldaniel wrote:
> aaron.ballman wrote:
> > This fix seems bad. If the user accepts the fix, then the code will diagnose because there's no longer a matching call to `doSomething2()`.
> Same type error as earlier, should a fix be applied (changing the type of the parameter in template definition would be unlucky too, maybe a wrapper function which could be passed to doSomething2() and does the conversion) or only a warning?
Similarly, I would only warn here as well, and not suggest a fix-it.


https://reviews.llvm.org/D40787





More information about the cfe-commits mailing list