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_CHECK_DISPATCH_VISITOR_H_ 6 #define TOOLS_BLINK_GC_PLUGIN_CHECK_DISPATCH_VISITOR_H_ 7 8 #include "clang/AST/RecursiveASTVisitor.h" 9 10 class RecordInfo; 11 12 // This visitor checks that a method contains within its body, a call to a 13 // method on the provided receiver class. This is used to check manual 14 // dispatching for trace and finalize methods. 15 class CheckDispatchVisitor 16 : public clang::RecursiveASTVisitor<CheckDispatchVisitor> { 17 public: 18 explicit CheckDispatchVisitor(RecordInfo* receiver); 19 20 bool dispatched_to_receiver(); 21 22 bool VisitMemberExpr(clang::MemberExpr* member); 23 bool VisitUnresolvedMemberExpr(clang::UnresolvedMemberExpr* member); 24 25 private: 26 RecordInfo* receiver_; 27 bool dispatched_to_receiver_; 28 }; 29 30 #endif // TOOLS_BLINK_GC_PLUGIN_CHECK_DISPATCH_VISITOR_H_ 31