Skip to content

Commit 1dd7d8e

Browse files
committed
Merge pull request rhysd#36 from beyondmarc/fix_cli_args
Use -assume-filename command line argument only if Clang Format version is >= 3.8
2 parents 471f6d6 + 9e5e596 commit 1dd7d8e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

autoload/clang_format.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ function! clang_format#format(line1, line2)
158158
else
159159
let args .= " -style=file "
160160
endif
161-
let args .= printf("-assume-filename=%s ", shellescape(escape(expand('%:p'), " \t")))
161+
let v = clang_format#get_version()
162+
if (v[0] == 3 && v[1] >= 8) || v[0] > 3
163+
let args .= printf("-assume-filename=%s ", shellescape(escape(expand('%:p'), " \t")))
164+
endif
162165
let args .= g:clang_format#extra_args
163166
let clang_format = printf("%s %s --", g:clang_format#command, args)
164167
return s:system(clang_format, join(getline(1, '$'), "\n"))

0 commit comments

Comments
 (0)