Chromium Code Reviews| Index: tools/clang/scripts/update.py |
| diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py |
| index 520903da26edbcb221866d9224268d27b6cc97a6..54a166f5c5ce39f3ad76d528c5e23723d5dcc3ee 100755 |
| --- a/tools/clang/scripts/update.py |
| +++ b/tools/clang/scripts/update.py |
| @@ -373,6 +373,23 @@ def CopyDiaDllTo(target_dir): |
| CopyFile(dia_dll, target_dir) |
| +def VeryifyVersionOfBuiltClangMatchesVERSION(): |
| + """Checks that `clang --version` outputs VERSION. If this fails, VERSION |
| + in this file is out-of-date and needs to be updated (possibly in an |
| + `if use_head_revision:` block in main() first).""" |
| + if sys.platform == 'win32': |
| + # FIXME: Parse `clang-cl /?` output for built clang's version and check |
|
hans
2016/08/08 16:11:23
Doesn't the code below work on Windows too? Regula
Nico
2016/08/08 17:01:32
That's a good point. I figured it'd be nicer to ge
|
| + pass |
| + else: |
| + clang = os.path.join(LLVM_BUILD_DIR, 'bin', 'clang') |
| + version_out = subprocess.check_output([clang, '--version']) |
| + version_out = re.match(r'clang version (\S+)', version_out).group(1) |
| + if version_out != VERSION: |
| + print ('unexpected clang version %s (not %s), update VERSION in update.py' |
| + % (version_out, VERSION)) |
| + sys.exit(1) |
| + |
| + |
| def UpdateClang(args): |
| print 'Updating Clang to %s...' % PACKAGE_VERSION |
| @@ -648,7 +665,7 @@ def UpdateClang(args): |
| elif sys.platform.startswith('linux'): |
| RunCommand(['strip', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')]) |
| - # TODO(thakis): Check that `clang --version` matches VERSION. |
| + VeryifyVersionOfBuiltClangMatchesVERSION() |
| # Do an out-of-tree build of compiler-rt. |
| # On Windows, this is used to get the 32-bit ASan run-time. |