Skip to content

Commit 4ef04b5

Browse files
authored
Merge pull request #46 from tiennou/fix/apple-clang-compat
Use the locally installed clang, and make it work on macOS
2 parents e455ee6 + 019b8c0 commit 4ef04b5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/docurium/docparser.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ class DocParser
1212
def find_clang_includes
1313
@includes ||=
1414
begin
15-
bindir = `#{ENV["LLVM_CONFIG"]} --bindir`.strip
16-
clang = "#{bindir}/clang"
15+
clang = if ENV["LLVM_CONFIG"]
16+
bindir = `#{ENV["LLVM_CONFIG"]} --bindir`.strip
17+
"#{bindir}/clang"
18+
else
19+
"clang"
20+
end
21+
1722
output, _status = Open3.capture2e("#{clang} -v -x c -", :stdin_data => "")
1823
includes = []
1924
output.each_line do |line|
20-
if line =~ %r{^\s+/.*lib/clang.*/include}
25+
if line =~ %r{^\s+/(.*usr|.*lib/clang.*)/include}
2126
includes << line.strip
2227
end
2328
end

0 commit comments

Comments
 (0)