clang tools: Add --bootstrap to the documentation for update.py

This lets us build the clang tools with clang not gcc, which appears to
have bugs!

Also work around the gcc bug in one place we know it happens anyways,
just because.

R=dcheng
BUG=580745

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

Cr-Commit-Position: refs/heads/master@{#371933}
diff --git a/docs/clang_tool_refactoring.md b/docs/clang_tool_refactoring.md
index 3d9c9ed..ef7faabe 100644
--- a/docs/clang_tool_refactoring.md
+++ b/docs/clang_tool_refactoring.md
@@ -97,7 +97,7 @@
 Synopsis:
 
 ```shell
-tools/clang/scripts/update.py --force-local-build --without-android \
+tools/clang/scripts/update.py --bootstrap --force-local-build --without-android \
   --tools blink_gc_plugin plugins rewrite_to_chrome_style
 ```
 
@@ -109,6 +109,9 @@
 [//tools/clang](https://chromium.googlesource.com/chromium/src/+/master/tools/clang).
 Generally, `--tools` should always include `blink_gc_plugin` and `plugins`: otherwise, Chromium won't build.
 
+It is important to use --bootstrap as there appear to be [bugs](https://crbug.com/580745)
+in the clang library this script produces if you build it with gcc, which is the default.
+
 ## Running
 First, build all chromium targets to avoid failures due to missing dependecies
 that are generated as part of the build:
diff --git a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
index db208ab..08ce7b7 100644
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
@@ -111,7 +111,10 @@
       original_name.substr(strlen(kBlinkFieldPrefix)));
   // The few examples I could find used struct-style naming with no `_` suffix
   // for unions.
-  if (decl.getParent()->isClass())
+  bool c = decl.getParent()->isClass();
+  // There appears to be a GCC bug that makes this branch incorrectly if we
+  // don't use a temp variable!! Clang works right. crbug.com/580745
+  if (c)
     name += '_';
   return true;
 }