Enable UNOWNED_PTR_EXCLUSION checks for debug builds only.

Clang's inability to optimize out some redundant CHECK()s was noticed
while working on an unrelated CL. This is caused by the issue noted in
crbug.com/40836910, where __attribute__((annotate()) changed code gen
as a side effect of placating warnings in the plugin.

Bug: chromium:40836910
Change-Id: Idde4cecd3c329c4c7bac728d5c376a4574cd8f77
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/117550
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 193024a..72a6944 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -287,8 +287,10 @@
   defines = []
   if (clang_use_chrome_plugins) {
     # Catch misuse of C-style pointers.
+    # TODO(crbug.com/1320670): enable for non-debug builds once this stops
+    # interfering with code generation.
     # TODO(tsepez): enable for windows, too.
-    if (!is_win) {
+    if (is_debug && !is_win) {
       cflags += [
         "-Xclang",
         "-plugin-arg-find-bad-constructs",