Skip to content

Commit

Permalink
If Oilpan is enabled, warn of raw heap pointer fields by default.
Browse files Browse the repository at this point in the history
It is unsafe to keep fields with raw pointers into the Oilpan heap, as
such untraced references risk going stale. With potentially undesirable
consequences.

Now that we've addressed and handled all such untraced references as part
of Blink's transition to Oilpan, it is time to enable the clang GC plugin
warning for such raw pointer uses.

It shouldn't represent a major imposition to developers to handle such
raw pointer uses correctly, but for now we will only emit a warning and
not an error.

R=haraken
BUG=515524

Review URL: https://codereview.chromium.org/1464293002

Cr-Commit-Position: refs/heads/master@{#361656}
  • Loading branch information
sigbjornf authored and Commit bot committed Nov 25, 2015
1 parent f7a91ff commit 3a192c3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/clang/scripts/blink_gc_plugin_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,27 @@

FLAGS = '-Xclang -add-plugin -Xclang blink-gc-plugin'
PREFIX= ' -Xclang -plugin-arg-blink-gc-plugin -Xclang '

warn_raw_pointers = None
for arg in sys.argv[1:]:
if arg == 'enable-oilpan=1':
FLAGS += PREFIX + 'enable-oilpan'
if warn_raw_pointers is None:
warn_raw_pointers = True
elif arg == 'dump-graph=1':
FLAGS += PREFIX + 'dump-graph'
elif arg == 'warn-raw-ptr=1':
FLAGS += PREFIX + 'warn-raw-ptr'
warn_raw_pointers = True
elif arg == 'warn-raw-ptr=0':
warn_raw_pointers = False
elif arg == 'warn-unneeded-finalizer=1':
FLAGS += PREFIX + 'warn-unneeded-finalizer'
elif arg.startswith('custom_clang_lib_path='):
CLANG_LIB_PATH = arg[len('custom_clang_lib_path='):]

if warn_raw_pointers is True:
FLAGS += PREFIX + 'warn-raw-ptr'

if not sys.platform in ['win32', 'cygwin']:
LIBSUFFIX = 'dylib' if sys.platform == 'darwin' else 'so'
FLAGS = ('-Xclang -load -Xclang "%s/libBlinkGCPlugin.%s" ' + FLAGS) % \
Expand Down

0 comments on commit 3a192c3

Please sign in to comment.