Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: tools/clang/blink_gc_plugin/CollectVisitor.h

Issue 2696713003: blink_gc_plugin: detect singletons with embedded ScriptWrappables.
Patch Set: non-copying iteration Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_
« no previous file with comments | « tools/clang/blink_gc_plugin/CheckSingletonVisitor.cpp ('k') | tools/clang/blink_gc_plugin/CollectVisitor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698