Commit 2883cd18 authored by Johann's avatar Johann Committed by Commit Bot

clang plugins: default no-members-in-stack-allocated to on

Artifacts can be removed after the clang prebuilt is updated.

Change-Id: I473c22843445745a39d1fc648a7bbcc336631b8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2152329Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarAnton Bikineev <bikineev@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Johann Koenig <johannkoenig@google.com>
Cr-Commit-Position: refs/heads/master@{#759880}
parent 99f41046
......@@ -116,6 +116,7 @@ config("config") {
"blink-gc-plugin",
]
# TODO(bikineev): Remove when clang pre-built has been updated.
# Disallow members in stack allocated classes.
cflags += [
"-Xclang",
......
......@@ -34,7 +34,9 @@ class BlinkGCPluginAction : public PluginASTAction {
if (arg == "dump-graph") {
options_.dump_graph = true;
} else if (arg == "no-members-in-stack-allocated") {
options_.no_members_in_stack_allocated = true;
// TODO(bikineev): Flag is on by default. Remove after
// third_party/blink/renderer/BUILD.gn has been updated.
continue;
} else if (arg == "enable-weak-members-in-unmanaged-classes") {
options_.enable_weak_members_in_unmanaged_classes = true;
} else {
......
......@@ -12,9 +12,6 @@
struct BlinkGCPluginOptions {
bool dump_graph = false;
// If |true|, disallow Member types in stack allocated classes.
bool no_members_in_stack_allocated = false;
// Member<T> fields are only permitted in managed classes,
// something CheckFieldsVisitor verifies, issuing errors if
// found in unmanaged classes. WeakMember<T> should be treated
......
......@@ -78,7 +78,6 @@ void CheckFieldsVisitor::AtValue(Value* edge) {
return;
}
if (options_.no_members_in_stack_allocated) {
// Members/WeakMembers are prohibited if the host is stack allocated, but
// heap collections with Members are okay.
if (stack_allocated_host_ && Parent() &&
......@@ -89,7 +88,6 @@ void CheckFieldsVisitor::AtValue(Value* edge) {
return;
}
}
}
// If in a stack allocated context, be fairly insistent that T in Member<T>
// is GC allocated, as stack allocated objects do not have a trace()
......@@ -117,8 +115,7 @@ void CheckFieldsVisitor::AtValue(Value* edge) {
current_, InvalidSmartPtr(Parent())));
return;
}
if (Parent()->IsRawPtr() &&
!(stack_allocated_host_ && options_.no_members_in_stack_allocated)) {
if (Parent()->IsRawPtr() && !stack_allocated_host_) {
RawPtr* rawPtr = static_cast<RawPtr*>(Parent());
Error error = rawPtr->HasReferenceType() ?
kReferencePtrToGCManaged : kRawPtrToGCManaged;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment