Index: tools/clang/blink_gc_plugin/Config.h |
diff --git a/tools/clang/blink_gc_plugin/Config.h b/tools/clang/blink_gc_plugin/Config.h |
index 7354549457f8c89f21581edc76f5e02980d31206..533947002e95beb1488f4bcd5e439538e3ccb29f 100644 |
--- a/tools/clang/blink_gc_plugin/Config.h |
+++ b/tools/clang/blink_gc_plugin/Config.h |
@@ -8,6 +8,7 @@ |
#define TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ |
#include "clang/AST/AST.h" |
+#include "clang/AST/Attr.h" |
const char kNewOperatorName[] = "operator new"; |
const char kCreateName[] = "create"; |
@@ -101,6 +102,24 @@ class Config { |
IsGCMixinBase(name); |
} |
+ static bool IsAnnotated(clang::Decl* decl, const std::string& anno) { |
+ clang::AnnotateAttr* attr = decl->getAttr<clang::AnnotateAttr>(); |
+ return attr && (attr->getAnnotation() == anno); |
+ } |
+ |
+ static bool IsStackAnnotated(clang::Decl* decl) { |
+ return IsAnnotated(decl, "blink_stack_allocated"); |
+ } |
+ |
+ static bool IsIgnoreAnnotated(clang::Decl* decl) { |
+ return IsAnnotated(decl, "blink_gc_plugin_ignore"); |
+ } |
+ |
+ static bool IsIgnoreCycleAnnotated(clang::Decl* decl) { |
+ return IsAnnotated(decl, "blink_gc_plugin_ignore_cycle") || |
+ IsIgnoreAnnotated(decl); |
+ } |
+ |
static bool IsVisitor(const std::string& name) { return name == "Visitor"; } |
static bool IsTraceMethod(clang::CXXMethodDecl* method, |