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

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

Issue 1385193002: Bisect clang Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 246985 Created 5 years, 2 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/CheckTraceVisitor.h
diff --git a/tools/clang/blink_gc_plugin/CheckTraceVisitor.h b/tools/clang/blink_gc_plugin/CheckTraceVisitor.h
new file mode 100644
index 0000000000000000000000000000000000000000..580a6fba99bb1a2ad931df579763d05ba0e273ab
--- /dev/null
+++ b/tools/clang/blink_gc_plugin/CheckTraceVisitor.h
@@ -0,0 +1,59 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TOOLS_BLINK_GC_PLUGIN_CHECK_TRACE_VISITOR_H_
+#define TOOLS_BLINK_GC_PLUGIN_CHECK_TRACE_VISITOR_H_
+
+#include <string>
+
+#include "RecordInfo.h"
+#include "clang/AST/AST.h"
+#include "clang/AST/RecursiveASTVisitor.h"
+
+class RecordCache;
+class RecordInfo;
+
+// This visitor checks a tracing method by traversing its body.
+// - A member field is considered traced if it is referenced in the body.
+// - A base is traced if a base-qualified call to a trace method is found.
+class CheckTraceVisitor : public clang::RecursiveASTVisitor<CheckTraceVisitor> {
+ public:
+ CheckTraceVisitor(clang::CXXMethodDecl* trace,
+ RecordInfo* info,
+ RecordCache* cache);
+
+ bool delegates_to_traceimpl() const;
+
+ bool VisitMemberExpr(clang::MemberExpr* member);
+ bool VisitCallExpr(clang::CallExpr* call);
+
+ private:
+ bool IsTraceCallName(const std::string& name);
+
+ clang::CXXRecordDecl* GetDependentTemplatedDecl(
+ clang::CXXDependentScopeMemberExpr* expr);
+
+ void CheckCXXDependentScopeMemberExpr(
+ clang::CallExpr* call,
+ clang::CXXDependentScopeMemberExpr* expr);
+ bool CheckTraceBaseCall(clang::CallExpr* call);
+ bool CheckTraceFieldMemberCall(clang::CXXMemberCallExpr* call);
+ bool CheckTraceFieldCall(const std::string& name,
+ clang::CXXRecordDecl* callee,
+ clang::Expr* arg);
+ bool CheckRegisterWeakMembers(clang::CXXMemberCallExpr* call);
+
+ bool IsWeakCallback() const;
+
+ void MarkTraced(RecordInfo::Fields::iterator it);
+ void FoundField(clang::FieldDecl* field);
+ void MarkAllWeakMembersTraced();
+
+ clang::CXXMethodDecl* trace_;
+ RecordInfo* info_;
+ RecordCache* cache_;
+ bool delegates_to_traceimpl_;
+};
+
+#endif // TOOLS_BLINK_GC_PLUGIN_CHECK_TRACE_VISITOR_H_
« no previous file with comments | « tools/clang/blink_gc_plugin/CheckGCRootsVisitor.cpp ('k') | tools/clang/blink_gc_plugin/CheckTraceVisitor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698