| Index: tools/clang/plugins/FindBadConstructsConsumer.cpp
|
| diff --git a/tools/clang/plugins/FindBadConstructsConsumer.cpp b/tools/clang/plugins/FindBadConstructsConsumer.cpp
|
| index 3ff133dbc750b77f30aff6a38bb130a8ddabea00..a608cd29d172e6ab6939a9a574c4ac6e20a93c21 100644
|
| --- a/tools/clang/plugins/FindBadConstructsConsumer.cpp
|
| +++ b/tools/clang/plugins/FindBadConstructsConsumer.cpp
|
| @@ -66,6 +66,10 @@ const Type* UnwrapType(const Type* type) {
|
| return type;
|
| }
|
|
|
| +bool IsGtestTestFixture(const CXXRecordDecl* decl) {
|
| + return decl->getQualifiedNameAsString() == "testing::Test";
|
| +}
|
| +
|
| FixItHint FixItRemovalForVirtual(const SourceManager& manager,
|
| const CXXMethodDecl* method) {
|
| // Unfortunately, there doesn't seem to be a good way to determine the
|
| @@ -294,7 +298,12 @@ bool FindBadConstructsConsumer::IsMethodInBannedOrTestingNamespace(
|
| ++i) {
|
| const CXXMethodDecl* overridden = *i;
|
| if (IsMethodInBannedOrTestingNamespace(overridden) ||
|
| - InTestingNamespace(overridden)) {
|
| + // Provide an exception for ::testing::Test. gtest itself uses some
|
| + // magic to try to make sure SetUp()/TearDown() aren't capitalized
|
| + // incorrectly, but having the plugin enforce override is also nice.
|
| + (InTestingNamespace(overridden) &&
|
| + (!options_.strict_virtual_specifiers ||
|
| + !IsGtestTestFixture(overridden->getParent())))) {
|
| return true;
|
| }
|
| }
|
|
|