Merge "Split -isystem headers into separate variables"
diff --git a/core/Makefile b/core/Makefile
index cdf24dd..c86c499 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1615,7 +1615,7 @@
   $(HOST_LIBRARY_PATH)/libbrillo-http$(HOST_SHLIB_SUFFIX) \
   $(HOST_LIBRARY_PATH)/libchrome$(HOST_SHLIB_SUFFIX) \
   $(HOST_LIBRARY_PATH)/libcurl-host$(HOST_SHLIB_SUFFIX) \
-  $(HOST_LIBRARY_PATH)/libevent-host$(HOST_SHLIB_SUFFIX) \
+  $(HOST_LIBRARY_PATH)/libevent$(HOST_SHLIB_SUFFIX) \
   $(HOST_LIBRARY_PATH)/libprotobuf-cpp-lite$(HOST_SHLIB_SUFFIX) \
   $(HOST_LIBRARY_PATH)/libssl-host$(HOST_SHLIB_SUFFIX) \
   $(HOST_LIBRARY_PATH)/libz-host$(HOST_SHLIB_SUFFIX) \
diff --git a/core/clang/tidy.mk b/core/clang/tidy.mk
index 019e6f0..35871f0 100644
--- a/core/clang/tidy.mk
+++ b/core/clang/tidy.mk
@@ -16,9 +16,9 @@
 
 # Most Android source files are not clang-tidy clean yet.
 # Global tidy checks include only google* and misc-macro-parentheses,
-# but not google-readability*.
+# but not google-readability* or google-runtime-references.
 DEFAULT_GLOBAL_TIDY_CHECKS := \
-  -*,google*,-google-readability*,misc-macro-parentheses
+  -*,google*,-google-readability*,-google-runtime-references,misc-macro-parentheses
 
 # Disable style rules usually not followed by external projects.
 # Every word in DEFAULT_LOCAL_TIDY_CHECKS list has the following format:
@@ -37,9 +37,9 @@
   external/webrtc/:,google-runtime-int \
   hardware/qcom:,-google-build-using-namespace \
   hardware/qcom:,-google-explicit-constructor,-google-runtime-int \
-  vendor/lge:,-google-build-using-namespace \
+  vendor/lge:,-google-build-using-namespace,-misc-macro-parentheses \
   vendor/lge:,-google-explicit-constructor,-google-runtime-int \
-  vendor/widevine:,-google-build-using-namespace \
+  vendor/widevine:,-google-build-using-namespace,-misc-macro-parentheses \
   vendor/widevine:,-google-explicit-constructor,-google-runtime-int \
 
 # Returns 2nd word of $(1) if $(2) has prefix of the 1st word of $(1).
diff --git a/core/clang/versions.mk b/core/clang/versions.mk
index ef28880..5988eff 100644
--- a/core/clang/versions.mk
+++ b/core/clang/versions.mk
@@ -1,5 +1,5 @@
 ## Clang/LLVM release versions.
 
 LLVM_RELEASE_VERSION := 3.8
-LLVM_PREBUILTS_VERSION ?= clang-2812033
+LLVM_PREBUILTS_VERSION ?= clang-3016494
 LLVM_PREBUILTS_BASE ?= prebuilts/clang/host
diff --git a/core/config.mk b/core/config.mk
index 6f504b2..594c273 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -645,8 +645,10 @@
 
 GLOBAL_CLANG_CFLAGS_NO_OVERRIDE := \
     -Werror=address-of-temporary \
-    -Werror=null-dereference \
     -Werror=return-type \
+    # Bug: http://b/29823425 Disable -Wnull-dereference until the new cases
+    # detected by this warning in Clang r271374 are fixed.
+    #-Werror=null-dereference \
 
 GLOBAL_CPPFLAGS_NO_OVERRIDE :=
 
diff --git a/core/goma.mk b/core/goma.mk
index 0d5f428..c0c27c5 100644
--- a/core/goma.mk
+++ b/core/goma.mk
@@ -46,7 +46,7 @@
   # gomacc can start goma client's daemon process automatically, but
   # it is safer and faster to start up it beforehand. We run this as a
   # background process so this won't slow down the build.
-  $(shell ( GOMA_HERMETIC=error $(goma_ctl) ensure_start ) &> /dev/null &)
+  $(shell ( $(goma_ctl) ensure_start ) &> /dev/null &)
 
   goma_ctl :=
   goma_dir :=
diff --git a/tools/warn.py b/tools/warn.py
index 6324429..8f7a638 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -119,7 +119,7 @@
         'patterns':[r".*: warning: incompatible implicit declaration of built-in function .+"] },
     { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'',
         'description':'Null passed as non-null argument',
-        'patterns':[r".*: warning: Null passed to a callee that requires a non-null argument"] },
+        'patterns':[r".*: warning: Null passed to a callee that requires a non-null"] },
     { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wunused-parameter',
         'description':'Unused parameter',
         'patterns':[r".*: warning: unused parameter '.*'"] },
@@ -1366,6 +1366,9 @@
     { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
         'description':'Possible broken line continuation',
         'patterns':[r".*: warning: backslash and newline separated by space"] },
+    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wundefined-var-template',
+        'description':'Undefined variable template',
+        'patterns':[r".*: warning: instantiation of variable .* no definition is available"] },
     { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wundefined-inline',
         'description':'Inline function is not defined',
         'patterns':[r".*: warning: inline function '.*' is not defined"] },
@@ -1504,9 +1507,9 @@
     { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wnon-literal-null-conversion',
         'description':'Zero used as null pointer',
         'patterns':[r".*: warning: expression .* zero treated as a null pointer constant"] },
-    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wliteral-conversion',
+    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
         'description':'Implicit conversion changes value',
-        'patterns':[r".*: warning: implicit conversion .* changes value from .* to .*literal-conversion"] },
+        'patterns':[r".*: warning: implicit conversion .* changes value from .* to .*-conversion"] },
     { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
         'description':'Passing NULL as non-pointer argument',
         'patterns':[r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"] },
@@ -1734,8 +1737,17 @@
         'description':'clang-tidy c++ core guidelines',
         'patterns':[r".*: .+\[cppcoreguidelines-.+\]$"] },
     { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
-        'description':'clang-tidy google-runtime',
-        'patterns':[r".*: .+\[google-runtime-.+\]$"] },
+        'description':'clang-tidy google-default-arguments',
+        'patterns':[r".*: .+\[google-default-arguments\]$"] },
+    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
+        'description':'clang-tidy google-runtime-int',
+        'patterns':[r".*: .+\[google-runtime-int\]$"] },
+    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
+        'description':'clang-tidy google-runtime-operator',
+        'patterns':[r".*: .+\[google-runtime-operator\]$"] },
+    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
+        'description':'clang-tidy google-runtime-references',
+        'patterns':[r".*: .+\[google-runtime-references\]$"] },
     { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
         'description':'clang-tidy google-build',
         'patterns':[r".*: .+\[google-build-.+\]$"] },
@@ -1749,6 +1761,9 @@
         'description':'clang-tidy google-global',
         'patterns':[r".*: .+\[google-global-.+\]$"] },
     { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
+        'description':'clang-tidy google- other',
+        'patterns':[r".*: .+\[google-.+\]$"] },
+    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
         'description':'clang-tidy modernize',
         'patterns':[r".*: .+\[modernize-.+\]$"] },
     { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
@@ -1977,15 +1992,15 @@
 compilepatterns()
 
 # read the log file and classify all the warnings
-lastmatchedline = ''
+warninglines = set()
 for line in infile:
     # replace fancy quotes with plain ol' quotes
     line = line.replace("‘", "'");
     line = line.replace("’", "'");
     if warningpattern.match(line):
-        if line != lastmatchedline:
+        if line not in warninglines:
             classifywarning(line)
-            lastmatchedline = line
+            warninglines.add(line)
     else:
         # save a little bit of time by only doing this for the first few lines
         if linecounter < 50: