Run coverage reports through c++filt on Linux and macOS.

The code coverage reports from llvm-cov will emit detailed coverage
information for instantiated templates, but by default, will emit
the method names using their mangled form. llvm-cov allows for
providing a custom demangler.

This conditionally provides custom demangler, using c++filt when
running on Linux and macOS. Longer-term, a solution based on
llvm-symbolizer is more desirable for platform neutrality, but
this helps bridge the short-term need.

BUG=843246

Change-Id: I718016b05af0842ac148d06e968f362bc68b5fc8
Reviewed-on: https://chromium-review.googlesource.com/1060264
Commit-Queue: Ryan Sleevi <[email protected]>
Reviewed-by: Abhishek Arya <[email protected]>
Cr-Commit-Position: refs/heads/master@{#558863}
diff --git a/tools/code_coverage/coverage.py b/tools/code_coverage/coverage.py
index 7f45542..7f63a023 100755
--- a/tools/code_coverage/coverage.py
+++ b/tools/code_coverage/coverage.py
@@ -534,6 +534,8 @@
   subprocess_cmd.extend(
       ['-object=' + binary_path for binary_path in binary_paths[1:]])
   _AddArchArgumentForIOSIfNeeded(subprocess_cmd, len(binary_paths))
+  if _GetHostPlatform() in ['linux', 'mac']:
+    subprocess_cmd.extend(['-Xdemangler', 'c++filt', '-Xdemangler', '-n'])
   subprocess_cmd.extend(filters)
   if ignore_filename_regex:
     subprocess_cmd.append('-ignore-filename-regex=%s' % ignore_filename_regex)