Home | History | Annotate | Download | only in blink_gc_plugin
      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 
      5 #ifndef TOOLS_BLINK_GC_PLUGIN_COLLECT_VISITOR_H_
      6 #define TOOLS_BLINK_GC_PLUGIN_COLLECT_VISITOR_H_
      7 
      8 #include <vector>
      9 
     10 #include "clang/AST/AST.h"
     11 #include "clang/AST/RecursiveASTVisitor.h"
     12 
     13 // This visitor collects the entry points for the checker.
     14 class CollectVisitor : public clang::RecursiveASTVisitor<CollectVisitor> {
     15  public:
     16   typedef std::vector<clang::CXXRecordDecl*> RecordVector;
     17   typedef std::vector<clang::CXXMethodDecl*> MethodVector;
     18 
     19   CollectVisitor();
     20 
     21   RecordVector& record_decls();
     22   MethodVector& trace_decls();
     23 
     24   // Collect record declarations, including nested declarations.
     25   bool VisitCXXRecordDecl(clang::CXXRecordDecl* record);
     26 
     27   // Collect tracing method definitions, but don't traverse method bodies.
     28   bool VisitCXXMethodDecl(clang::CXXMethodDecl* method);
     29 
     30  private:
     31   RecordVector record_decls_;
     32   MethodVector trace_decls_;
     33 };
     34 
     35 #endif  // TOOLS_BLINK_GC_PLUGIN_COLLECT_VISITOR_H_
     36