Index: tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp |
diff --git a/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp b/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp |
index bdc5ca64c2913a2d3d9e4e297912e26527060535..0ea8f4cac36330f042492810e86e52989a56a7ab 100644 |
--- a/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp |
+++ b/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp |
@@ -1093,17 +1093,15 @@ class BlinkGCPluginConsumer : public ASTConsumer { |
bool InCheckedNamespace(RecordInfo* info) { |
if (!info) |
return false; |
- DeclContext* context = info->record()->getDeclContext(); |
- if (context->isRecord()) |
- return InCheckedNamespace(cache_.Lookup(context)); |
- while (context->isNamespace()) { |
- NamespaceDecl* decl = dyn_cast<NamespaceDecl>(context); |
- if (decl->isAnonymousNamespace()) |
- return false; |
- if (options_.checked_namespaces.find(decl->getNameAsString()) != |
- options_.checked_namespaces.end()) |
- return true; |
- context = decl->getDeclContext(); |
+ for (DeclContext* context = info->record()->getDeclContext(); |
+ !context->isTranslationUnit(); |
+ context = context->getParent()) { |
+ if (NamespaceDecl* decl = dyn_cast<NamespaceDecl>(context)) { |
+ if (options_.checked_namespaces.find(decl->getNameAsString()) != |
+ options_.checked_namespaces.end()) { |
+ return true; |
+ } |
+ } |
} |
return false; |
} |