mozilla/dxr

Make clang compiler path dxr.config variable (with make time default)

Closed this issue · 4 comments

The clang plugin almost always needs to be run against the same version of the compiler it was built against. This probably should be specified at compile time, so that invoking dxr index will use the correct clang compiler.

Alternatively, dxr should just bundle the appropriate version of clang that the plugin is designed for.

Hi, Chris. The plugin itself is full of ifdefs and supports a range of clang versions—it looks like 3.2-3.5. We do "bundle" the one we test against (3.5), in that we install it by default on the vagrant box.

That in mind, what did you have in mind? Perhaps we should, for example, stick clang3.5 in CC rather than merely clang.

Hi Erik,

Consider the following scenario:

Project X needs to be built with a specific version of clang (maybe it's a clang plugin project itself, like YCM, uses C++ features that only got implemented recently, needs a specific flag that only exists for some clang versions, or it uses it's own clang plugins during compilation, like chromium does). The plugin will need to be recompiled, and dxr will need to invoke the correct version of clang and use the correct plugin. Some projects, YCM and chromium, for example, bundle their own versions of clang to ensure that they have compatibility.

Since this will be a per project behavior, dxr will need to figure out where to find the clang version for that project, (and potentially rebuild the plugin for that project). Hence my suggestion that these be dxr.config variables.

Makes sense to me. Feel free to work up a patch.

Cool. :)