| Index: tools/clang/blink_gc_plugin/CollectVisitor.cpp
|
| diff --git a/tools/clang/blink_gc_plugin/CollectVisitor.cpp b/tools/clang/blink_gc_plugin/CollectVisitor.cpp
|
| index 203e8adf24427a5fcb196f893feb1737d6caf41a..cae961e0cb9838f3e10e963f5da603c7b26a2154 100644
|
| --- a/tools/clang/blink_gc_plugin/CollectVisitor.cpp
|
| +++ b/tools/clang/blink_gc_plugin/CollectVisitor.cpp
|
| @@ -8,8 +8,8 @@
|
|
|
| using namespace clang;
|
|
|
| -CollectVisitor::CollectVisitor() {
|
| -}
|
| +CollectVisitor::CollectVisitor(bool check_var_decls)
|
| + : check_var_decls_(check_var_decls), var_visitor_(this) {}
|
|
|
| CollectVisitor::RecordVector& CollectVisitor::record_decls() {
|
| return record_decls_;
|
| @@ -19,6 +19,10 @@ CollectVisitor::MethodVector& CollectVisitor::trace_decls() {
|
| return trace_decls_;
|
| }
|
|
|
| +const CollectVisitor::SingletonVector& CollectVisitor::singleton_decls() const {
|
| + return singleton_decls_;
|
| +}
|
| +
|
| bool CollectVisitor::VisitCXXRecordDecl(CXXRecordDecl* record) {
|
| if (record->hasDefinition() && record->isCompleteDefinition())
|
| record_decls_.push_back(record);
|
| @@ -30,3 +34,22 @@ bool CollectVisitor::VisitCXXMethodDecl(CXXMethodDecl* method) {
|
| trace_decls_.push_back(method);
|
| return true;
|
| }
|
| +
|
| +bool CollectVisitor::LocalVarsVisitor::VisitVarDecl(VarDecl* decl) {
|
| + if (Config::IsStaticSingleton(decl) && !Config::IsIgnoreAnnotated(decl) &&
|
| + decl->isStaticLocal())
|
| + parent_->singleton_decls_.push_back(decl);
|
| + return true;
|
| +}
|
| +
|
| +bool CollectVisitor::VisitFunctionDecl(FunctionDecl* decl) {
|
| + if (!check_var_decls_)
|
| + return true;
|
| +
|
| + if (!decl->isThisDeclarationADefinition())
|
| + return true;
|
| +
|
| + if (Stmt* body = decl->getBody())
|
| + var_visitor_.TraverseStmt(body);
|
| + return true;
|
| +}
|
|
|