[PATCH] D37060: [clang-tidy] Improve hicpp-exception-baseclass to handle generic code better

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 30 05:17:04 PDT 2017


JonasToth added inline comments.


================
Comment at: test/clang-tidy/hicpp-exception-baseclass.cpp:54-62
+// CHECK-MESSAGES: [[@LINE-1]]:31: warning: throwing an exception whose type 'bad_generic_exception<int>' is not derived from 'std::exception'
+// CHECK-MESSAGES: 71:1: note: type defined here
+// CHECK-MESSAGES: [[@LINE-3]]:31: warning: throwing an exception whose type 'bad_generic_exception<std::exception>' is not derived from 'std::exception'
+// CHECK-MESSAGES: 71:1: note: type defined here
+// CHECK-MESSAGES: [[@LINE-5]]:31: warning: throwing an exception whose type 'exotic_exception<non_derived_exception>' is not derived from 'std::exception'
+// CHECK-MESSAGES: 74:1: note: type defined here
+// CHECK-MESSAGES: [[@LINE-7]]:31: warning: throwing an exception whose type 'int' is not derived from 'std::exception'
----------------
lebedev.ri wrote:
> JonasToth wrote:
> > lebedev.ri wrote:
> > > JonasToth wrote:
> > > > these diagnostic come from the many instantiations of this function. 
> > > > do you think, they should exist or rather not?
> > > They definitively should exist.
> > > But they also should ideally point to the origin of the `T`.
> > they kinda do. when templates are used, the template class is pointed to, but not the instantiation. At least they shouldn't point to the `<typename T>` anymore.
> > but not the instantiation 
> It would be best if they would, but looking at the AST, i'm not sure how to do that...
> https://godbolt.org/g/ejScyZ
> 
> Maybe someone else knows.
it is probably too much magic anyway. I thinnk you would need to trace the callgraph for that, which is probably not worth it (any i am not able to program it either :D )


https://reviews.llvm.org/D37060





More information about the cfe-commits mailing list