Index: tools/clang/blink_gc_plugin/CollectVisitor.h |
diff --git a/tools/clang/blink_gc_plugin/CollectVisitor.h b/tools/clang/blink_gc_plugin/CollectVisitor.h |
index a3ccdd8a3311ac605add4fe09e05527b5846c1b2..8f1c591448493feec08eb8b6d69943365afda4c1 100644 |
--- a/tools/clang/blink_gc_plugin/CollectVisitor.h |
+++ b/tools/clang/blink_gc_plugin/CollectVisitor.h |
@@ -13,23 +13,43 @@ |
// This visitor collects the entry points for the checker. |
class CollectVisitor : public clang::RecursiveASTVisitor<CollectVisitor> { |
public: |
- typedef std::vector<clang::CXXRecordDecl*> RecordVector; |
- typedef std::vector<clang::CXXMethodDecl*> MethodVector; |
+ using RecordVector = std::vector<clang::CXXRecordDecl*>; |
+ using MethodVector = std::vector<clang::CXXMethodDecl*>; |
+ using SingletonVector = std::vector<clang::VarDecl*>; |
- CollectVisitor(); |
+ explicit CollectVisitor(bool check_var_decls); |
RecordVector& record_decls(); |
MethodVector& trace_decls(); |
+ const SingletonVector& singleton_decls() const; |
+ |
// Collect record declarations, including nested declarations. |
bool VisitCXXRecordDecl(clang::CXXRecordDecl* record); |
// Collect tracing method definitions, but don't traverse method bodies. |
bool VisitCXXMethodDecl(clang::CXXMethodDecl* method); |
+ // Collect static singleton declarations, traverses the function body. |
+ bool VisitFunctionDecl(clang::FunctionDecl*); |
+ |
private: |
+ class LocalVarsVisitor : public clang::RecursiveASTVisitor<LocalVarsVisitor> { |
+ public: |
+ explicit LocalVarsVisitor(CollectVisitor* parent) : parent_(parent) {} |
+ |
+ bool VisitVarDecl(clang::VarDecl* decl); |
+ |
+ private: |
+ CollectVisitor* parent_; |
+ }; |
+ |
RecordVector record_decls_; |
MethodVector trace_decls_; |
+ SingletonVector singleton_decls_; |
+ |
+ bool check_var_decls_; |
+ LocalVarsVisitor var_visitor_; |
}; |
#endif // TOOLS_BLINK_GC_PLUGIN_COLLECT_VISITOR_H_ |