Enable cppgc plugins for standalone pdfium builds. This will catch some cppgc usage errors. If desired, the plugin can be turned off via the following GN argument clang_use_chrome_plugins=false Bug: pdfium:1671 Change-Id: Ib47c1579e1d863be44db38a63e029442d1bfabb0 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79171 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn index b69dda6..55ca4f2 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/clang/clang.gni") import("//testing/test.gni") import("pdfium.gni") @@ -47,6 +48,16 @@ if (is_clang) { # Override -Wno-c++11-narrowing. cflags += [ "-Wc++11-narrowing" ] + + # Catch misuse of cppgc in XFA. + if (pdf_enable_xfa && clang_use_chrome_plugins) { + cflags += [ + "-Xclang", + "-add-plugin", + "-Xclang", + "blink-gc-plugin", + ] + } } if (!is_win && !is_clang) {