Update clang to r339409.
Change-Id: I800772d2d838223be1f6b40d490c4591b937fca2
diff --git a/linux-x64/clang/share/clang/bash-autocomplete.sh b/linux-x64/clang/share/clang/bash-autocomplete.sh
index 3872dd2..bcda789 100755
--- a/linux-x64/clang/share/clang/bash-autocomplete.sh
+++ b/linux-x64/clang/share/clang/bash-autocomplete.sh
@@ -12,7 +12,7 @@
{
local cur prev words cword arg flags w1 w2
# If latest bash-completion is not supported just initialize COMPREPLY and
- # initialize variables by setting manualy.
+ # initialize variables by setting manually.
_init_completion -n 2> /dev/null
if [[ "$?" != 0 ]]; then
COMPREPLY=()
@@ -38,7 +38,8 @@
# expand ~ to $HOME
eval local path=${COMP_WORDS[0]}
- flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*//' )
+ # Use $'\t' so that bash expands the \t for older versions of sed.
+ flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e $'s/\t.*//' )
# If clang is old that it does not support --autocomplete,
# fall back to the filename completion.
if [[ "$?" != 0 ]]; then
diff --git a/linux-x64/clang/share/clang/clang-format-diff.py b/linux-x64/clang/share/clang/clang-format-diff.py
index ffa30e7..ce4c1d6 100755
--- a/linux-x64/clang/share/clang/clang-format-diff.py
+++ b/linux-x64/clang/share/clang/clang-format-diff.py
@@ -25,10 +25,12 @@
import argparse
import difflib
import re
-import string
import subprocess
-import StringIO
import sys
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
def main():
@@ -84,14 +86,14 @@
line_count = int(match.group(3))
if line_count == 0:
continue
- end_line = start_line + line_count - 1;
+ end_line = start_line + line_count - 1
lines_by_file.setdefault(filename, []).extend(
['-lines', str(start_line) + ':' + str(end_line)])
# Reformat files containing changes in place.
- for filename, lines in lines_by_file.iteritems():
+ for filename, lines in lines_by_file.items():
if args.i and args.verbose:
- print 'Formatting', filename
+ print('Formatting {}'.format(filename))
command = [args.binary, filename]
if args.i:
command.append('-i')
@@ -100,20 +102,23 @@
command.extend(lines)
if args.style:
command.extend(['-style', args.style])
- p = subprocess.Popen(command, stdout=subprocess.PIPE,
- stderr=None, stdin=subprocess.PIPE)
+ p = subprocess.Popen(command,
+ stdout=subprocess.PIPE,
+ stderr=None,
+ stdin=subprocess.PIPE,
+ universal_newlines=True)
stdout, stderr = p.communicate()
if p.returncode != 0:
- sys.exit(p.returncode);
+ sys.exit(p.returncode)
if not args.i:
with open(filename) as f:
code = f.readlines()
- formatted_code = StringIO.StringIO(stdout).readlines()
+ formatted_code = StringIO(stdout).readlines()
diff = difflib.unified_diff(code, formatted_code,
filename, filename,
'(before formatting)', '(after formatting)')
- diff_string = string.join(diff, '')
+ diff_string = ''.join(diff)
if len(diff_string) > 0:
sys.stdout.write(diff_string)
diff --git a/linux-x64/clang/share/clang/clang-format.el b/linux-x64/clang/share/clang/clang-format.el
index 6c626e0..4f11daf 100755
--- a/linux-x64/clang/share/clang/clang-format.el
+++ b/linux-x64/clang/share/clang/clang-format.el
@@ -153,7 +153,7 @@
nil nil clang-format-executable
nil `(,temp-buffer ,temp-file) nil
`("-output-replacements-xml"
- ;; Gaurd against a nil assume-file-name.
+ ;; Guard against a nil assume-file-name.
;; If the clang-format option -assume-filename
;; is given a blank string it will crash as per
;; the following bug report
diff --git a/linux-x64/clang/share/clang/clang-include-fixer.el b/linux-x64/clang/share/clang/clang-include-fixer.el
index ab10002..c3a3bba 100755
--- a/linux-x64/clang/share/clang/clang-include-fixer.el
+++ b/linux-x64/clang/share/clang/clang-include-fixer.el
@@ -314,14 +314,18 @@
(goto-char (clang-include-fixer--closest-overlay overlays)))
(cl-flet ((header (info) (let-alist info .Header)))
;; The header-infos is already sorted by include-fixer.
- (let* ((header (completing-read
+ (let* ((headers (mapcar #'header .HeaderInfos))
+ (header (completing-read
(clang-include-fixer--format-message
"Select include for '%s': " symbol)
- (mapcar #'header .HeaderInfos)
- nil :require-match nil
- 'clang-include-fixer--history))
+ headers nil :require-match nil
+ 'clang-include-fixer--history
+ ;; Specify a default to prevent the behavior
+ ;; described in
+ ;; https://github.com/DarwinAwardWinner/ido-completing-read-plus#why-does-ret-sometimes-not-select-the-first-completion-on-the-list--why-is-there-an-empty-entry-at-the-beginning-of-the-completion-list--what-happened-to-old-style-default-selection.
+ (car headers)))
(info (cl-find header .HeaderInfos :key #'header :test #'string=)))
- (cl-assert info)
+ (unless info (user-error "No header selected"))
(setcar .HeaderInfos info)
(setcdr .HeaderInfos nil))))
(mapc #'delete-overlay overlays)))))
diff --git a/linux-x64/clang/share/clang/clang-rename.py b/linux-x64/clang/share/clang/clang-rename.py
index 3cc6644..0cb8a26 100755
--- a/linux-x64/clang/share/clang/clang-rename.py
+++ b/linux-x64/clang/share/clang/clang-rename.py
@@ -7,10 +7,14 @@
* `g:clang_rename_path` in ~/.vimrc points to valid clang-rename executable
* `binary` in clang-rename.py points to valid to clang-rename executable
-To install, simply put this into your ~/.vimrc
+To install, simply put this into your ~/.vimrc for python2 support
noremap <leader>cr :pyf <path-to>/clang-rename.py<cr>
+For python3 use the following command (note the change from :pyf to :py3f)
+
+ noremap <leader>cr :py3f <path-to>/clang-rename.py<cr>
+
IMPORTANT NOTE: Before running the tool, make sure you saved the file.
All you have to do now is to place a cursor on a variable/function/class which
@@ -18,6 +22,7 @@
name if the cursor points to a valid symbol.
'''
+from __future__ import print_function
import vim
import subprocess
import sys
@@ -30,8 +35,8 @@
# Get arguments for clang-rename binary.
offset = int(vim.eval('line2byte(line("."))+col(".")')) - 2
if offset < 0:
- print >> sys.stderr, '''Couldn\'t determine cursor position.
- Is your file empty?'''
+ print('Couldn\'t determine cursor position. Is your file empty?',
+ file=sys.stderr)
return
filename = vim.current.buffer.name
@@ -51,7 +56,7 @@
stdout, stderr = p.communicate()
if stderr:
- print stderr
+ print(stderr)
# Reload all buffers in Vim.
vim.command("checktime")
diff --git a/linux-x64/clang/share/man/man1/scan-build.1 b/linux-x64/clang/share/man/man1/scan-build.1
index 3d3a9f8..cf7e7b1 100755
--- a/linux-x64/clang/share/man/man1/scan-build.1
+++ b/linux-x64/clang/share/man/man1/scan-build.1
@@ -116,7 +116,7 @@
uses a simpler, less powerful constraint model used by checker-0.160
and earlier.
.It Fl maxloop Ar N
-Specifiy the number of times a block can be visited before giving
+Specify the number of times a block can be visited before giving
up. Default is 4. Increase for more comprehensive coverage at a
cost of speed.
.It Fl no-failure-reports
diff --git a/linux-x64/clang/share/scan-view/startfile.py b/linux-x64/clang/share/scan-view/startfile.py
index 6739359..f58dbee 100644
--- a/linux-x64/clang/share/scan-view/startfile.py
+++ b/linux-x64/clang/share/scan-view/startfile.py
@@ -62,7 +62,7 @@
preexec_fn=setsid, startupinfo=startupinfo)
# It is assumed that this kind of tools (gnome-open, kfmclient,
- # exo-open, xdg-open and open for OSX) immediately exit after lauching
+ # exo-open, xdg-open and open for OSX) immediately exit after launching
# the specific application
returncode = pipe.wait()
if hasattr(self, 'fixreturncode'):
@@ -85,7 +85,7 @@
if sys.platform[:3] == 'win':
class Start(BaseController):
- '''Controller for the win32 start progam through os.startfile.'''
+ '''Controller for the win32 start program through os.startfile.'''
def open(self, filename):
try:
@@ -201,6 +201,6 @@
def open(filename):
- '''Open a file or an URL in the registered default application.'''
+ '''Open a file or a URL in the registered default application.'''
return _open(filename)