Skip to content

Commit 3100ff5

Browse files
committed
Use -assume-filename command line argument only if Clang Format version is >= 3.8
1 parent 471f6d6 commit 3100ff5

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)