Chromium Code Reviews| Index: tools/clang/plugins/FindBadConstructsConsumer.cpp |
| diff --git a/tools/clang/plugins/FindBadConstructsConsumer.cpp b/tools/clang/plugins/FindBadConstructsConsumer.cpp |
| index 00d4cb9a2316e42dbffd147d21ce93e418c0b867..17ca1f5f38505c5feb8321b6fb28c3622eb98fa3 100644 |
| --- a/tools/clang/plugins/FindBadConstructsConsumer.cpp |
| +++ b/tools/clang/plugins/FindBadConstructsConsumer.cpp |
| @@ -675,7 +675,16 @@ void FindBadConstructsConsumer::CountType(const Type* type, |
| } |
| case Type::Typedef: { |
| while (const TypedefType* TT = dyn_cast<TypedefType>(type)) { |
| - type = TT->getDecl()->getUnderlyingType().getTypePtr(); |
| + if (auto* decl = TT->getDecl()) { |
| + const std::string name = decl->getNameAsString(); |
| + if (auto* context = decl->getDeclContext()) { |
|
dcheng
2016/11/10 06:58:56
I've learned that null checking this shouldn't be
hans
2016/11/10 16:35:36
I don't think it should be necessary. I don't see
palmer
2016/11/10 23:25:58
Done.
|
| + if (name == "atomic_int" && context->isStdNamespace()) { |
| + (*trivial_member)++; |
| + return; |
| + } |
| + } |
| + type = decl->getUnderlyingType().getTypePtr(); |
| + } |
| } |
| CountType(type, |
| trivial_member, |