summaryrefslogtreecommitdiff
path: root/chromium/tools/clang
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-13 15:05:36 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-14 10:33:47 +0000
commite684a3455bcc29a6e3e66a004e352dea4e1141e7 (patch)
treed55b4003bde34d7d05f558f02cfd82b2a66a7aac /chromium/tools/clang
parent2b94bfe47ccb6c08047959d1c26e392919550e86 (diff)
downloadqtwebengine-chromium-e684a3455bcc29a6e3e66a004e352dea4e1141e7.tar.gz
BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0
Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/tools/clang')
-rw-r--r--chromium/tools/clang/blink_gc_plugin/BadPatternFinder.cpp60
-rw-r--r--chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp26
-rw-r--r--chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.h6
-rwxr-xr-xchromium/tools/clang/scripts/package.py159
-rwxr-xr-xchromium/tools/clang/scripts/update.py44
5 files changed, 241 insertions, 54 deletions
diff --git a/chromium/tools/clang/blink_gc_plugin/BadPatternFinder.cpp b/chromium/tools/clang/blink_gc_plugin/BadPatternFinder.cpp
index f3bec427ad9..ef1da662ac7 100644
--- a/chromium/tools/clang/blink_gc_plugin/BadPatternFinder.cpp
+++ b/chromium/tools/clang/blink_gc_plugin/BadPatternFinder.cpp
@@ -5,6 +5,7 @@
#include "BadPatternFinder.h"
#include "DiagnosticsReporter.h"
+#include <algorithm>
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
@@ -82,6 +83,62 @@ class OptionalGarbageCollectedMatcher : public MatchFinder::MatchCallback {
DiagnosticsReporter& diagnostics_;
};
+class MissingMixinMarker : public MatchFinder::MatchCallback {
+ public:
+ explicit MissingMixinMarker(clang::ASTContext& ast_context,
+ DiagnosticsReporter& diagnostics)
+ : ast_context_(ast_context), diagnostics_(diagnostics) {}
+
+ void Register(MatchFinder& match_finder) {
+ auto class_missing_mixin_marker = cxxRecordDecl(
+ decl().bind("bad_class"),
+ // Definition of a garbage-collected class
+ isDefinition(),
+ isDerivedFrom(cxxRecordDecl(decl().bind("gc_base_class"),
+ hasName("::blink::GarbageCollected"))),
+ // ...which derives some mixin...
+ isDerivedFrom(cxxRecordDecl(decl().bind("mixin_base_class"),
+ hasName("::blink::GarbageCollectedMixin"))),
+ // ...and doesn't use USING_GARBAGE_COLLECTED_MIXIN
+ unless(isSameOrDerivedFrom(
+ has(fieldDecl(hasName("mixin_constructor_marker_"))))),
+ // ...and might end up actually being constructed
+ unless(hasMethod(isPure())), unless(matchesName("::SameSizeAs")));
+ match_finder.addDynamicMatcher(class_missing_mixin_marker, this);
+ }
+
+ void run(const MatchFinder::MatchResult& result) {
+ auto* bad_class = result.Nodes.getNodeAs<clang::CXXRecordDecl>("bad_class");
+ auto* gc_base_class =
+ result.Nodes.getNodeAs<clang::CXXRecordDecl>("gc_base_class");
+ auto* mixin_base_class =
+ result.Nodes.getNodeAs<clang::CXXRecordDecl>("mixin_base_class");
+
+ clang::CXXBasePaths paths;
+ if (!bad_class->isDerivedFrom(mixin_base_class, paths))
+ return;
+ const auto& path = paths.front();
+
+ // It's most useful to describe the most derived "mixin" class (i.e. which
+ // does not derive the concrete GarbageCollected base).
+ auto mixin_it = std::find_if(
+ path.begin(), path.end(),
+ [gc_base_class](const clang::CXXBasePathElement& path_element) {
+ return !path_element.Class->isDerivedFrom(gc_base_class);
+ });
+ const clang::CXXRecordDecl* mixin_class = mixin_it->Class;
+ diagnostics_.MissingMixinMarker(bad_class, mixin_class, path.begin()->Base);
+
+ ++mixin_it;
+ for (auto it = path.begin() + 1; it != mixin_it; ++it)
+ diagnostics_.MissingMixinMarkerNote(it->Base);
+ }
+
+ private:
+ clang::ASTContext& ast_context_;
+ DiagnosticsReporter& diagnostics_;
+};
+
} // namespace
void FindBadPatterns(clang::ASTContext& ast_context,
@@ -94,5 +151,8 @@ void FindBadPatterns(clang::ASTContext& ast_context,
OptionalGarbageCollectedMatcher optional_gc(diagnostics);
optional_gc.Register(match_finder);
+ MissingMixinMarker missing_mixin_marker(ast_context, diagnostics);
+ missing_mixin_marker.Register(match_finder);
+
match_finder.matchAST(ast_context);
}
diff --git a/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp b/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
index 032f3ffe7a3..65dba9ba98b 100644
--- a/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
+++ b/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
@@ -162,6 +162,13 @@ const char kOptionalUsedWithGC[] =
"[blink-gc] Disallowed construction of %0 found; %1 is a garbage-collected "
"type. optional cannot hold garbage-collected objects.";
+const char kMissingMixinMarker[] =
+ "[blink-gc] Garbage-collected class %0 derives mixin class %1. "
+ "You must add USING_GARBAGE_COLLECTED_MIXIN(%2).";
+
+const char kMissingMixinMarkerNote[] =
+ "[blink-gc] Mixin base class derived here:";
+
} // namespace
DiagnosticBuilder DiagnosticsReporter::ReportDiagnostic(
@@ -275,6 +282,10 @@ DiagnosticsReporter::DiagnosticsReporter(
diagnostic_.getCustomDiagID(getErrorLevel(), kUniquePtrUsedWithGC);
diag_optional_used_with_gc_ =
diagnostic_.getCustomDiagID(getErrorLevel(), kOptionalUsedWithGC);
+ diag_missing_mixin_marker_ =
+ diagnostic_.getCustomDiagID(getErrorLevel(), kMissingMixinMarker);
+ diag_missing_mixin_marker_note_ = diagnostic_.getCustomDiagID(
+ DiagnosticsEngine::Note, kMissingMixinMarkerNote);
}
bool DiagnosticsReporter::hasErrorOccurred() const
@@ -600,3 +611,18 @@ void DiagnosticsReporter::OptionalUsedWithGC(
ReportDiagnostic(expr->getBeginLoc(), diag_optional_used_with_gc_)
<< optional << gc_type << expr->getSourceRange();
}
+
+void DiagnosticsReporter::MissingMixinMarker(
+ const clang::CXXRecordDecl* bad_class,
+ const clang::CXXRecordDecl* mixin_class,
+ const clang::CXXBaseSpecifier* first_base) {
+ ReportDiagnostic(first_base->getBaseTypeLoc(), diag_missing_mixin_marker_)
+ << bad_class << mixin_class << bad_class->getName()
+ << first_base->getSourceRange();
+}
+
+void DiagnosticsReporter::MissingMixinMarkerNote(
+ const clang::CXXBaseSpecifier* base) {
+ ReportDiagnostic(base->getBaseTypeLoc(), diag_missing_mixin_marker_note_)
+ << base->getSourceRange();
+}
diff --git a/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.h b/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.h
index 512874d646e..2d8b0c7ade1 100644
--- a/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.h
+++ b/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.h
@@ -86,6 +86,10 @@ class DiagnosticsReporter {
void OptionalUsedWithGC(const clang::Expr* expr,
const clang::CXXRecordDecl* optional,
const clang::CXXRecordDecl* gc_type);
+ void MissingMixinMarker(const clang::CXXRecordDecl* bad_class,
+ const clang::CXXRecordDecl* mixin_class,
+ const clang::CXXBaseSpecifier* first_base);
+ void MissingMixinMarkerNote(const clang::CXXBaseSpecifier* base);
private:
clang::DiagnosticBuilder ReportDiagnostic(
@@ -150,6 +154,8 @@ class DiagnosticsReporter {
unsigned diag_unique_ptr_used_with_gc_;
unsigned diag_optional_used_with_gc_;
+ unsigned diag_missing_mixin_marker_;
+ unsigned diag_missing_mixin_marker_note_;
};
#endif // TOOLS_BLINK_GC_PLUGIN_DIAGNOSTICS_REPORTER_H_
diff --git a/chromium/tools/clang/scripts/package.py b/chromium/tools/clang/scripts/package.py
index 745362c73e7..e616533ae17 100755
--- a/chromium/tools/clang/scripts/package.py
+++ b/chromium/tools/clang/scripts/package.py
@@ -8,7 +8,6 @@ to a tgz file."""
import argparse
import fnmatch
-import glob
import itertools
import os
import shutil
@@ -249,39 +248,124 @@ def main():
'lib/libBlinkGCPlugin.' + so_ext,
])
if sys.platform == 'darwin':
- want.extend([# Copy only the OSX and iossim (ASan, fuzzer and profile)
- # runtime libraries:
- 'lib/clang/*/lib/darwin/*asan_osx*',
- 'lib/clang/*/lib/darwin/*asan_iossim*',
- 'lib/clang/*/lib/darwin/*fuzzer_no_main*',
- 'lib/clang/*/lib/darwin/*profile_osx*',
- 'lib/clang/*/lib/darwin/*profile_iossim*',
- # And the OSX and ios builtin libraries (iossim is lipo'd into
- # ios) for the _IsOSVersionAtLeast runtime function.
- 'lib/clang/*/lib/darwin/*.ios.a',
- 'lib/clang/*/lib/darwin/*.osx.a',
- ])
+ want.extend([
+ # AddressSanitizer runtime.
+ 'lib/clang/*/lib/darwin/libclang_rt.asan_iossim_dynamic.dylib',
+ 'lib/clang/*/lib/darwin/libclang_rt.asan_osx_dynamic.dylib',
+
+ # Fuzzing instrumentation (-fsanitize=fuzzer-no-link).
+ 'lib/clang/*/lib/darwin/libclang_rt.fuzzer_no_main_osx.a',
+
+ # OS X and iOS builtin libraries (iossim is lipo'd into ios) for the
+ # _IsOSVersionAtLeast runtime function.
+ 'lib/clang/*/lib/darwin/libclang_rt.ios.a',
+ 'lib/clang/*/lib/darwin/libclang_rt.osx.a',
+
+ # Profile runtime (used by profiler and code coverage).
+ 'lib/clang/*/lib/darwin/libclang_rt.profile_iossim.a',
+ 'lib/clang/*/lib/darwin/libclang_rt.profile_osx.a',
+ ])
elif sys.platform.startswith('linux'):
# Add llvm-ar and lld for LTO.
want.append('bin/llvm-ar')
want.append('bin/lld')
- # Copy only
- # lib/clang/*/lib/linux/libclang_rt.{[atm]san,san,ubsan,fuzzer,profile}-*.a,
- # but not dfsan.
- want.extend(['lib/clang/*/lib/linux/*[atm]san*',
- 'lib/clang/*/lib/linux/*ubsan*',
- 'lib/clang/*/lib/linux/*libclang_rt.fuzzer_no_main*',
- 'lib/clang/*/lib/linux/*libclang_rt.san*',
- 'lib/clang/*/lib/linux/*profile*',
- 'lib/clang/*/share/msan_blacklist.txt',
- ])
+ want.extend([
+ # AddressSanitizer C runtime (pure C won't link with *_cxx).
+ 'lib/clang/*/lib/linux/libclang_rt.asan-i386.a',
+ 'lib/clang/*/lib/linux/libclang_rt.asan-x86_64.a',
+ 'lib/clang/*/lib/linux/libclang_rt.asan-x86_64.a.syms',
+
+ # AddressSanitizer C++ runtime.
+ 'lib/clang/*/lib/linux/libclang_rt.asan_cxx-i386.a',
+ 'lib/clang/*/lib/linux/libclang_rt.asan_cxx-x86_64.a',
+ 'lib/clang/*/lib/linux/libclang_rt.asan_cxx-x86_64.a.syms',
+
+ # AddressSanitizer Android runtime.
+ 'lib/clang/*/lib/linux/libclang_rt.asan-aarch64-android.so',
+ 'lib/clang/*/lib/linux/libclang_rt.asan-arm-android.so',
+ 'lib/clang/*/lib/linux/libclang_rt.asan-i686-android.so',
+
+ # Fuzzing instrumentation (-fsanitize=fuzzer-no-link).
+ 'lib/clang/*/lib/linux/libclang_rt.fuzzer_no_main-x86_64.a',
+
+ # MemorySanitizer C runtime (pure C won't link with *_cxx).
+ 'lib/clang/*/lib/linux/libclang_rt.msan-x86_64.a',
+ 'lib/clang/*/lib/linux/libclang_rt.msan-x86_64.a.syms',
+
+ # MemorySanitizer C++ runtime.
+ 'lib/clang/*/lib/linux/libclang_rt.msan_cxx-x86_64.a',
+ 'lib/clang/*/lib/linux/libclang_rt.msan_cxx-x86_64.a.syms',
+
+ # Profile runtime (used by profiler and code coverage).
+ 'lib/clang/*/lib/linux/libclang_rt.profile-i386.a',
+ 'lib/clang/*/lib/linux/libclang_rt.profile-x86_64.a',
+ 'lib/clang/*/lib/linux/libclang_rt.profile-aarch64-android.a',
+ 'lib/clang/*/lib/linux/libclang_rt.profile-arm-android.a',
+
+ # ThreadSanitizer C runtime (pure C won't link with *_cxx).
+ 'lib/clang/*/lib/linux/libclang_rt.tsan-x86_64.a',
+ 'lib/clang/*/lib/linux/libclang_rt.tsan-x86_64.a.syms',
+
+ # ThreadSanitizer C++ runtime.
+ 'lib/clang/*/lib/linux/libclang_rt.tsan_cxx-x86_64.a',
+ 'lib/clang/*/lib/linux/libclang_rt.tsan_cxx-x86_64.a.syms',
+
+ # UndefinedBehaviorSanitizer C runtime (pure C won't link with *_cxx).
+ 'lib/clang/*/lib/linux/libclang_rt.ubsan_standalone-i386.a',
+ 'lib/clang/*/lib/linux/libclang_rt.ubsan_standalone-x86_64.a',
+ 'lib/clang/*/lib/linux/libclang_rt.ubsan_standalone-x86_64.a.syms',
+
+ # UndefinedBehaviorSanitizer C++ runtime.
+ 'lib/clang/*/lib/linux/libclang_rt.ubsan_standalone_cxx-i386.a',
+ 'lib/clang/*/lib/linux/libclang_rt.ubsan_standalone_cxx-x86_64.a',
+ 'lib/clang/*/lib/linux/libclang_rt.ubsan_standalone_cxx-x86_64.a.syms',
+
+ # UndefinedBehaviorSanitizer Android runtime, needed for CFI.
+ 'lib/clang/*/lib/linux/libclang_rt.ubsan_standalone-aarch64-android.so',
+ 'lib/clang/*/lib/linux/libclang_rt.ubsan_standalone-arm-android.so',
+
+ # Blacklist for MemorySanitizer (used on Linux only).
+ 'lib/clang/*/share/msan_blacklist.txt',
+ ])
elif sys.platform == 'win32':
- want.extend(['lib/clang/*/lib/windows/clang_rt.asan*.dll',
- 'lib/clang/*/lib/windows/clang_rt.asan*.lib',
- 'lib/clang/*/lib/windows/clang_rt.fuzzer_no_main*.lib',
- 'lib/clang/*/lib/windows/clang_rt.profile*.lib',
- 'lib/clang/*/lib/windows/clang_rt.ubsan*.lib',
- ])
+ want.extend([
+ # AddressSanitizer C runtime (pure C won't link with *_cxx).
+ 'lib/clang/*/lib/windows/clang_rt.asan-i386.lib',
+ 'lib/clang/*/lib/windows/clang_rt.asan-x86_64.lib',
+
+ # AddressSanitizer C++ runtime.
+ 'lib/clang/*/lib/windows/clang_rt.asan_cxx-i386.lib',
+ 'lib/clang/*/lib/windows/clang_rt.asan_cxx-x86_64.lib',
+
+ # Fuzzing instrumentation (-fsanitize=fuzzer-no-link).
+ 'lib/clang/*/lib/windows/clang_rt.fuzzer_no_main-x86_64.lib',
+
+ # Thunk for AddressSanitizer needed for static build of a shared lib.
+ 'lib/clang/*/lib/windows/clang_rt.asan_dll_thunk-i386.lib',
+ 'lib/clang/*/lib/windows/clang_rt.asan_dll_thunk-x86_64.lib',
+
+ # AddressSanitizer runtime for component build.
+ 'lib/clang/*/lib/windows/clang_rt.asan_dynamic-i386.dll',
+ 'lib/clang/*/lib/windows/clang_rt.asan_dynamic-i386.lib',
+ 'lib/clang/*/lib/windows/clang_rt.asan_dynamic-x86_64.dll',
+ 'lib/clang/*/lib/windows/clang_rt.asan_dynamic-x86_64.lib',
+
+ # Thunk for AddressSanitizer for component build of a shared lib.
+ 'lib/clang/*/lib/windows/clang_rt.asan_dynamic_runtime_thunk-i386.lib',
+ 'lib/clang/*/lib/windows/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib',
+
+ # Profile runtime (used by profiler and code coverage).
+ 'lib/clang/*/lib/windows/clang_rt.profile-i386.lib',
+ 'lib/clang/*/lib/windows/clang_rt.profile-x86_64.lib',
+
+ # UndefinedBehaviorSanitizer C runtime (pure C won't link with *_cxx).
+ 'lib/clang/*/lib/windows/clang_rt.ubsan_standalone-i386.lib',
+ 'lib/clang/*/lib/windows/clang_rt.ubsan_standalone-x86_64.lib',
+
+ # UndefinedBehaviorSanitizer C++ runtime.
+ 'lib/clang/*/lib/windows/clang_rt.ubsan_standalone_cxx-i386.lib',
+ 'lib/clang/*/lib/windows/clang_rt.ubsan_standalone_cxx-x86_64.lib',
+ ])
if sys.platform in ('linux2', 'darwin'):
# Include libclang_rt.builtins.a for Fuchsia targets.
@@ -398,23 +482,6 @@ def main():
filter=PrintTarProgress)
MaybeUpload(args, cfiverifydir, platform)
- # Zip up the SafeStack runtime for Linux
- safestackdir = 'safestack-' + stamp
- shutil.rmtree(safestackdir, ignore_errors=True)
- os.makedirs(os.path.join(safestackdir, 'lib'))
- for build in glob.glob(os.path.join(LLVM_RELEASE_DIR, 'lib', 'clang', '*')):
- version = os.path.basename(build)
- dest_dir = os.path.join(safestackdir, 'lib', 'clang', version,
- 'lib', 'linux')
- os.makedirs(dest_dir)
- for lib in glob.glob(os.path.join(build, 'lib', 'linux',
- '*libclang_rt.safestack*')):
- shutil.copy(lib, dest_dir)
- with tarfile.open(safestackdir + '.tgz', 'w:gz') as tar:
- tar.add(os.path.join(safestackdir, 'lib'), arcname='lib',
- filter=PrintTarProgress)
- MaybeUpload(args, safestackdir, platform)
-
# On Mac, lld isn't part of the main zip. Upload it in a separate zip.
if sys.platform == 'darwin':
llddir = 'lld-' + stamp
diff --git a/chromium/tools/clang/scripts/update.py b/chromium/tools/clang/scripts/update.py
index 6cd0319de4f..8b762dc72a6 100755
--- a/chromium/tools/clang/scripts/update.py
+++ b/chromium/tools/clang/scripts/update.py
@@ -27,7 +27,7 @@ import zipfile
# Do NOT CHANGE this if you don't know what you're doing -- see
# https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md
# Reverting problematic clang rolls is safe, though.
-CLANG_REVISION = '344066'
+CLANG_REVISION = '346388'
use_head_revision = bool(os.environ.get('LLVM_FORCE_HEAD_REVISION', '0')
in ('1', 'YES'))
@@ -35,7 +35,7 @@ if use_head_revision:
CLANG_REVISION = 'HEAD'
# This is incremented when pushing a new build of Clang at the same revision.
-CLANG_SUB_REVISION=1
+CLANG_SUB_REVISION=5
PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION)
@@ -347,7 +347,7 @@ def AddGnuWinToPath():
return
gnuwin_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'gnuwin')
- GNUWIN_VERSION = '8'
+ GNUWIN_VERSION = '9'
GNUWIN_STAMP = os.path.join(gnuwin_dir, 'stamp')
if ReadStampFile(GNUWIN_STAMP) == GNUWIN_VERSION:
print 'GNU Win tools already up to date.'
@@ -358,6 +358,17 @@ def AddGnuWinToPath():
os.environ['PATH'] = gnuwin_dir + os.pathsep + os.environ.get('PATH', '')
+ # find.exe, mv.exe and rm.exe are from MSYS (see crrev.com/389632). MSYS uses
+ # Cygwin under the hood, and initializing Cygwin has a race-condition when
+ # getting group and user data from the Active Directory is slow. To work
+ # around this, use a horrible hack telling it not to do that.
+ # See https://crbug.com/905289
+ etc = os.path.join(gnuwin_dir, '..', '..', 'etc')
+ EnsureDirExists(etc)
+ with open(os.path.join(etc, 'nsswitch.conf'), 'w') as f:
+ f.write('passwd: files\n')
+ f.write('group: files\n')
+
win_sdk_dir = None
dia_dll = None
@@ -781,6 +792,14 @@ def UpdateClang(args):
'i686': 'x86',
}[target_arch]])
+ # NDK r16 "helpfully" installs libc++ as libstdc++ "so the compiler will
+ # pick it up by default". Only these days, the compiler tries to find
+ # libc++ instead. See https://crbug.com/902270.
+ shutil.copy(os.path.join(toolchain_dir, 'sysroot/usr/lib/libstdc++.a'),
+ os.path.join(toolchain_dir, 'sysroot/usr/lib/libc++.a'))
+ shutil.copy(os.path.join(toolchain_dir, 'sysroot/usr/lib/libstdc++.so'),
+ os.path.join(toolchain_dir, 'sysroot/usr/lib/libc++.so'))
+
# Build compiler-rt runtimes needed for Android in a separate build tree.
build_dir = os.path.join(LLVM_BUILD_DIR, 'android-' + target_arch)
if not os.path.exists(build_dir):
@@ -802,6 +821,7 @@ def UpdateClang(args):
'-DLLVM_CONFIG_PATH=' + os.path.join(LLVM_BUILD_DIR, 'bin/llvm-config'),
'-DCMAKE_C_FLAGS=' + ' '.join(cflags),
'-DCMAKE_CXX_FLAGS=' + ' '.join(cflags),
+ '-DCMAKE_ASM_FLAGS=' + ' '.join(cflags),
'-DSANITIZER_CXX_ABI=none',
'-DSANITIZER_CXX_ABI_LIBRARY=' + abi_libs,
'-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-u__cxa_demangle',
@@ -894,6 +914,15 @@ def UpdateClang(args):
return 0
+def gn_arg(v):
+ if v == 'True':
+ return True
+ if v == 'False':
+ return False
+ raise argparse.ArgumentTypeError('Expected one of %r or %r' % (
+ 'True', 'False'))
+
+
def main():
parser = argparse.ArgumentParser(description='Build Clang.')
parser.add_argument('--bootstrap', action='store_true',
@@ -928,10 +957,12 @@ def main():
'and using prebuilt cmake binaries')
parser.add_argument('--verify-version',
help='verify that clang has the passed-in version')
+ parser.add_argument('--with-android', type=gn_arg, nargs='?', const=True,
+ help='build the Android ASan runtime (linux only)',
+ default=sys.platform.startswith('linux'))
parser.add_argument('--without-android', action='store_false',
help='don\'t build Android ASan runtime (linux only)',
- dest='with_android',
- default=sys.platform.startswith('linux'))
+ dest='with_android')
parser.add_argument('--without-fuchsia', action='store_false',
help='don\'t build Fuchsia clang_rt runtime (linux/mac)',
dest='with_fuchsia',
@@ -985,9 +1016,6 @@ def main():
PACKAGE_VERSION = CLANG_REVISION + '-0'
args.force_local_build = True
- if 'OS=android' not in os.environ.get('GYP_DEFINES', ''):
- # Only build the Android ASan rt on ToT bots when targetting Android.
- args.with_android = False
# Don't build fuchsia runtime on ToT bots at all.
args.with_fuchsia = False