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

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

Issue 2588943002: Disallow heap objects containing unsafe on-heap iterators. (Closed)
Patch Set: formatting Created 4 years 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/Config.h
diff --git a/tools/clang/blink_gc_plugin/Config.h b/tools/clang/blink_gc_plugin/Config.h
index 8f494bbf2184a4cdefd9400d3d4ab1026870e626..7defe2a1559acf5a4b7cf466729f759ebf5fb726 100644
--- a/tools/clang/blink_gc_plugin/Config.h
+++ b/tools/clang/blink_gc_plugin/Config.h
@@ -32,6 +32,10 @@ const char kVisitorVarName[] = "visitor";
const char kAdjustAndMarkName[] = "adjustAndMark";
const char kIsHeapObjectAliveName[] = "isHeapObjectAlive";
const char kIsEagerlyFinalizedName[] = "IsEagerlyFinalizedMarker";
+const char kConstIteratorName[] = "const_iterator";
+const char kIteratorName[] = "iterator";
+const char kConstReverseIteratorName[] = "const_reverse_iterator";
+const char kReverseIteratorName[] = "reverse_iterator";
class Config {
public:
@@ -101,6 +105,16 @@ class Config {
name == "PersistentHeapHashMap";
}
+ static bool IsGCCollectionWithUnsafeIterator(const std::string& name) {
+ if (!IsGCCollection(name))
+ return false;
+ // The list hash set iterators refer to the set, not the
+ // backing store and are consequently safe.
+ if (name == "HeapListHashSet" || name == "PersistentHeapListHashSet")
+ return false;
+ return true;
+ }
+
static bool IsHashMap(const std::string& name) {
return name == "HashMap" ||
name == "HeapHashMap" ||
@@ -131,6 +145,11 @@ class Config {
IsGCMixinBase(name);
}
+ static bool IsIterator(const std::string& name) {
+ return name == kIteratorName || name == kConstIteratorName ||
+ name == kReverseIteratorName || name == kConstReverseIteratorName;
+ }
+
// Returns true of the base classes that do not need a vtable entry for trace
// because they cannot possibly initiate a GC during construction.
static bool IsSafePolymorphicBase(const std::string& name) {

Powered by Google App Engine
This is Rietveld 408576698