tree: 75e774d59f8f1c00e0ee12aac9a5102213ac8445 [path history] [tgz]
  1. tests/
  2. BadPatternFinder.cpp
  3. BadPatternFinder.h
  4. BlinkGCPlugin.cpp
  5. BlinkGCPluginConsumer.cpp
  6. BlinkGCPluginConsumer.h
  7. BlinkGCPluginOptions.h
  8. CheckDispatchVisitor.cpp
  9. CheckDispatchVisitor.h
  10. CheckFieldsVisitor.cpp
  11. CheckFieldsVisitor.h
  12. CheckFinalizerVisitor.cpp
  13. CheckFinalizerVisitor.h
  14. CheckForbiddenFieldsVisitor.cpp
  15. CheckForbiddenFieldsVisitor.h
  16. CheckGCRootsVisitor.cpp
  17. CheckGCRootsVisitor.h
  18. CheckTraceVisitor.cpp
  19. CheckTraceVisitor.h
  20. CMakeLists.txt
  21. CollectVisitor.cpp
  22. CollectVisitor.h
  23. Config.cpp
  24. Config.h
  25. DiagnosticsReporter.cpp
  26. DiagnosticsReporter.h
  27. DIR_METADATA
  28. Edge.cpp
  29. Edge.h
  30. JsonWriter.h
  31. NeedsTracing.h
  32. OWNERS
  33. process-graph.py
  34. README.md
  35. RecordInfo.cpp
  36. RecordInfo.h
  37. TracingStatus.h
blink_gc_plugin/README.md

Clang Blink GC plugin

A Clang plugin that checks various invariants of the Blink garbage collection infrastructure.

Consider this plugin as a best effort. The plugin is not meant to be exhaustive and/or cover all potential GC issues. The plugin covers the most common Blink GC pitfalls, but may miss other potential (sometimes known) issues.

Build

Clang is built using CMake. To run cmake, this script can be used:

  ./tools/clang/scripts/build.py     \
    --without-android                \
    --without-fuchsia

The build directory is created into: third_party/llvm-build/Release+Asserts/ and you can build it again using:

  ninja -C third_party/llvm-build/Release+Asserts/

Run the tests

	./tools/clang/blink_gc_plugin/tests/test.py \
    $(pwd)/third_party/llvm-build/Release+Asserts/bin/clang

Using the plugin

To enable the plugin, add the following to your BUILD.gn file:

cflags += [
    "-Xclang",
    "-add-plugin",
    "-Xclang",
    "blink-gc-plugin",
]

To further enable specific plugin options, add the following:

cflags += [
    "-Xclang",
    "-plugin-arg-blink-gc-plugin",
    "-Xclang",
    "<option>",
]

See blink/renderer/BUILD.gn for example.