Skip to content

Commit

Permalink
Allows to use a different clang version than the default system one
Browse files Browse the repository at this point in the history
For some project using new c++ features it maybe useful to for the use
of a specific verison of clang.

This very small patch allow this use by setting up an environment variable.

The use of an environment variable is forced by tree.py that locates
the libclang statically and not using an argument. Otherwise an
argument to generate command would have been preffered.
  • Loading branch information
atuleu committed May 20, 2020
1 parent fc7f594 commit f8b4eab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cldoc/includepaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@

from . import utf8

versionned_clang = 'clang++'
if "CLDOC_CLANG_VERSION" in os.environ:
versionned_clang = 'clang++-' + os.environ["CLDOC_CLANG_VERSION"]

def flags(f):
devnull = open(os.devnull)

try:
p = subprocess.Popen(['clang++', '-E', '-xc++'] + f + ['-v', '-'],
p = subprocess.Popen([versionned_clang, '-E', '-xc++'] + f + ['-v', '-'],
stdin=devnull,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
Expand Down
4 changes: 4 additions & 0 deletions cldoc/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .clang import cindex
import tempfile
import functools
import os

from .defdict import Defdict

Expand Down Expand Up @@ -55,6 +56,9 @@
else:
versions = [None, '7.0', '6.0', '5.0', '4.0', '3.9', '3.8', '3.7', '3.6', '3.5', '3.4', '3.3', '3.2']

if "CLDOC_CLANG_VERSION" in os.environ:
versions = [None , os.environ["CLDOC_CLANG_VERSION"] ]

for v in versions:
name = 'clang'

Expand Down

0 comments on commit f8b4eab

Please sign in to comment.