CollectVisitor.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef TOOLS_BLINK_GC_PLUGIN_COLLECT_VISITOR_H_
  5. #define TOOLS_BLINK_GC_PLUGIN_COLLECT_VISITOR_H_
  6. #include <vector>
  7. #include "clang/AST/AST.h"
  8. #include "clang/AST/RecursiveASTVisitor.h"
  9. // This visitor collects the entry points for the checker.
  10. class CollectVisitor : public clang::RecursiveASTVisitor<CollectVisitor> {
  11. public:
  12. typedef std::vector<clang::CXXRecordDecl*> RecordVector;
  13. typedef std::vector<clang::CXXMethodDecl*> MethodVector;
  14. CollectVisitor();
  15. RecordVector& record_decls();
  16. MethodVector& trace_decls();
  17. // Collect record declarations, including nested declarations.
  18. bool VisitCXXRecordDecl(clang::CXXRecordDecl* record);
  19. // Collect tracing method definitions, but don't traverse method bodies.
  20. bool VisitCXXMethodDecl(clang::CXXMethodDecl* method);
  21. private:
  22. RecordVector record_decls_;
  23. MethodVector trace_decls_;
  24. };
  25. #endif // TOOLS_BLINK_GC_PLUGIN_COLLECT_VISITOR_H_