JonasToth updated this revision to Diff 113212.
JonasToth marked 2 inline comments as done.
JonasToth added a comment.
- removing trailing comments
https://reviews.llvm.org/D37060
Files:
test/clang-tidy/hicpp-exception-baseclass.cpp
Index: test/clang-tidy/hicpp-exception-baseclass.cpp
===================================================================
--- test/clang-tidy/hicpp-exception-baseclass.cpp
+++ test/clang-tidy/hicpp-exception-baseclass.cpp
@@ -10,39 +10,39 @@
void problematic() {
try {
- throw int(42); // Built in is not allowed
+ throw int(42);
// CHECK-MESSAGES: [[@LINE-1]]:11: warning: throwing an exception whose type 'int' is not derived from 'std::exception'
} catch (int e) {
}
- throw int(42); // Bad
+ throw int(42);
// CHECK-MESSAGES: [[@LINE-1]]:9: warning: throwing an exception whose type 'int' is not derived from 'std::exception'
try {
- throw non_derived_exception(); // Some class is not allowed
+ throw non_derived_exception();
// CHECK-MESSAGES: [[@LINE-1]]:11: warning: throwing an exception whose type 'non_derived_exception' is not derived from 'std::exception'
// CHECK-MESSAGES: 9:1: note: type defined here
} catch (non_derived_exception &e) {
}
- throw non_derived_exception(); // Bad
+ throw non_derived_exception();
// CHECK-MESSAGES: [[@LINE-1]]:9: warning: throwing an exception whose type 'non_derived_exception' is not derived from 'std::exception'
// CHECK-MESSAGES: 9:1: note: type defined here
}
void allowed_throws() {
try {
- throw std::exception(); // Ok
+ throw std::exception(); // Ok
} catch (std::exception &e) { // Ok
}
throw std::exception();
try {
- throw derived_exception(); // Ok
+ throw derived_exception(); // Ok
} catch (derived_exception &e) { // Ok
}
throw derived_exception(); // Ok
try {
- throw deep_hierarchy(); // Ok, multiple levels of inheritance
+ throw deep_hierarchy(); // Ok, multiple levels of inheritance
} catch (deep_hierarchy &e) { // Ok
}
throw deep_hierarchy(); // Ok
@@ -75,39 +75,39 @@
class exotic_exception : public T {};
void generic_exceptions() {
- THROW_EXCEPTION(int); // Bad
+ THROW_EXCEPTION(int);
// CHECK MESSAGES: [[@LINE-1]]:3: warning: throwing an exception whose type 'int' is not derived from 'std::exception'
- THROW_EXCEPTION(non_derived_exception); // Bad
+ THROW_EXCEPTION(non_derived_exception);
// CHECK MESSAGES: [[@LINE-1]]:3: warning: throwing an exception whose type 'non_derived_exception' is not derived from 'std::exception'
// CHECK MESSAGES: 9:1: note: type defined here
- THROW_EXCEPTION(std::exception); // Ok
+ THROW_EXCEPTION(std::exception); // Ok
THROW_EXCEPTION(derived_exception); // Ok
- THROW_EXCEPTION(deep_hierarchy); // Ok
+ THROW_EXCEPTION(deep_hierarchy); // Ok
THROW_BAD_EXCEPTION;
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: throwing an exception whose type 'int' is not derived from 'std::exception'
// CHECK-MESSAGES: [[@LINE-25]]:35: note: expanded from macro 'THROW_BAD_EXCEPTION'
THROW_GOOD_EXCEPTION;
THROW_DERIVED_EXCEPTION;
- throw generic_exception<int>(); // Ok,
+ throw generic_exception<int>(); // Ok,
THROW_EXCEPTION(generic_exception<float>); // Ok
- throw bad_generic_exception<int>(); // Bad, not derived
+ throw bad_generic_exception<int>();
// CHECK-MESSAGES: [[@LINE-1]]:9: warning: throwing an exception whose type 'bad_generic_exception<int>' is not derived from 'std::exception'
- throw bad_generic_exception<std::exception>(); // Bad as well, since still not derived
+ throw bad_generic_exception<std::exception>();
// CHECK-MESSAGES: [[@LINE-1]]:9: warning: throwing an exception whose type 'bad_generic_exception<std::exception>' is not derived from 'std::exception'
- THROW_EXCEPTION(bad_generic_exception<int>); // Bad
+ THROW_EXCEPTION(bad_generic_exception<int>);
// CHECK MESSAGES: [[@LINE-1]]:3: warning: throwing an exception whose type 'bad_generic_exception<int>' is not derived from 'std::exception'
- THROW_EXCEPTION(bad_generic_exception<std::exception>); // Bad
+ THROW_EXCEPTION(bad_generic_exception<std::exception>);
// CHECK MESSAGES: [[@LINE-1]]:3: warning: throwing an exception whose type 'bad_generic_exception<std::exception>' is not derived from 'std::exception'
- throw exotic_exception<non_derived_exception>(); // Bad
+ throw exotic_exception<non_derived_exception>();
// CHECK-MESSAGES: [[@LINE-1]]:9: warning: throwing an exception whose type 'exotic_exception<non_derived_exception>' is not derived from 'std::exception'
- THROW_EXCEPTION(exotic_exception<non_derived_exception>); // Bad
+ THROW_EXCEPTION(exotic_exception<non_derived_exception>);
// CHECK MESSAGES: [[@LINE-1]]:3: warning: throwing an exception whose type 'exotic_exception<non_derived_exception>' is not derived from 'std::exception'
- throw exotic_exception<derived_exception>(); // Ok
+ throw exotic_exception<derived_exception>(); // Ok
THROW_EXCEPTION(exotic_exception<derived_exception>); // Ok
}
@@ -118,11 +118,11 @@
using UsingGood = deep_hierarchy;
void typedefed() {
- throw TypedefedBad(); // Bad
+ throw TypedefedBad();
// CHECK-MESSAGES: [[@LINE-1]]:9: warning: throwing an exception whose type 'TypedefedBad' (aka 'int') is not derived from 'std::exception'
throw TypedefedGood(); // Ok
- throw UsingBad(); // Bad
+ throw UsingBad();
// CHECK-MESSAGES: [[@LINE-1]]:9: warning: throwing an exception whose type 'UsingBad' (aka 'int') is not derived from 'std::exception'
throw UsingGood(); // Ok
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits