From 898f186abe78b972d294949c260b279f76b32a2b Mon Sep 17 00:00:00 2001 Date: Mon, 17 May 2021 21:14:25 -0700 Subject: [PATCH 03/24] MacPorts Only: Prepare clang-format for replacement with absolute path --- clang/tools/clang-format/clang-format-bbedit.applescript | 2 +- clang/tools/clang-format/clang-format-diff.py | 2 +- clang/tools/clang-format/clang-format-sublime.py | 2 +- clang/tools/clang-format/clang-format.el | 3 +-- clang/tools/clang-format/clang-format.py | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/clang/tools/clang-format/clang-format-bbedit.applescript b/clang/tools/clang-format/clang-format-bbedit.applescript index fa88fe900480..eb09448be561 100644 --- a/clang/tools/clang-format/clang-format-bbedit.applescript +++ b/clang/tools/clang-format/clang-format-bbedit.applescript @@ -15,7 +15,7 @@ tell application "BBEdit" end tell set filePath to urlToPOSIXPath(fileURL) -set newContents to do shell script "/path/to/clang-format -offset=" & selectionOffset & " -length=" & selectionLength & " " & quoted form of filePath +set newContents to do shell script "@CLANG_FORMAT_PATH@ -offset=" & selectionOffset & " -length=" & selectionLength & " " & quoted form of filePath tell application "BBEdit" -- "set contents of text document 1 to newContents" scrolls to the bottom while diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py index 1f6ff0fe295f..8bab1b77c0c4 100755 --- a/clang/tools/clang-format/clang-format-diff.py +++ b/clang/tools/clang-format/clang-format-diff.py @@ -63,6 +63,6 @@ def main(): 'fallback in case clang-format is invoked with' '-style=file, but can not find the .clang-format' 'file to use.') - parser.add_argument('-binary', default='clang-format', + parser.add_argument('-binary', default='@CLANG_FORMAT_PATH@', help='location of binary to use for clang-format') args = parser.parse_args() diff --git a/clang/tools/clang-format/clang-format-sublime.py b/clang/tools/clang-format/clang-format-sublime.py index 20c867092ef5..ae823c1d05b6 100644 --- a/clang/tools/clang-format/clang-format-sublime.py +++ b/clang/tools/clang-format/clang-format-sublime.py @@ -18,7 +18,7 @@ import sublime_plugin import subprocess # Change this to the full path if clang-format is not on the path. -binary = 'clang-format' +binary = '@CLANG_FORMAT_PATH@' # Change this to format according to other formatting styles. See the output of # 'clang-format --help' for a list of supported styles. The default looks for diff --git a/clang/tools/clang-format/clang-format.el b/clang/tools/clang-format/clang-format.el index 768acb3a5d0d..e702bc6af4db 100644 --- a/clang/tools/clang-format/clang-format.el +++ b/clang/tools/clang-format/clang-format.el @@ -37,8 +37,7 @@ :group 'tools) (defcustom clang-format-executable - (or (executable-find "clang-format") - "clang-format") + "@CLANG_FORMAT_PATH@" "Location of the clang-format executable. A string containing the name or the full path of the executable." diff --git a/clang/tools/clang-format/clang-format.py b/clang/tools/clang-format/clang-format.py index 76fedb648147..9cb9825cbe5d 100644 --- a/clang/tools/clang-format/clang-format.py +++ b/clang/tools/clang-format/clang-format.py @@ -48,7 +48,7 @@ import vim # set g:clang_format_path to the path to clang-format if it is not on the path # Change this to the full path if clang-format is not on the path. -binary = 'clang-format' +binary = '@CLANG_FORMAT_PATH@' if vim.eval('exists("g:clang_format_path")') == "1": binary = vim.eval('g:clang_format_path') -- 2.21.1 (Apple Git-122.3)