This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Move description of toolchain specific include directories from the common driver code to the corresponding `MultilibSet` declarations
ClosedPublic

Authored by atanasyan on Jul 30 2014, 3:35 AM.

Details

Summary

The patch moves description of toolchain specific include directories from the common driver code to the corresponding MultilibSet declarations.

The MultilibSet can hold an optional callback function which is responsible to return a set of include directories specific for the toolchain. That allows, for example, to remove MIPS toolchain specific directories from Linux::AddClangSystemIncludeArgs method and simplify adding new directories in the future.

Diff Detail

Event Timeline

atanasyan updated this revision to Diff 12013.Jul 30 2014, 3:35 AM
atanasyan retitled this revision from to [Driver] Move description of toolchain specific include directories from the common driver code to the corresponding `MultilibSet` declarations.
atanasyan updated this object.
atanasyan edited the test plan for this revision. (Show Details)
atanasyan added a reviewer: rafael.
atanasyan added a subscriber: Unknown Object (MLST).

The code change seems reasonable if the flexibility of a callback is needed. I have no opinion on whether it is.

Do you have the followup change where this is used?

include/clang/Driver/Multilib.h
158

setincludeDirsCallback would be the correct name, no?

Yes, I am going to add more code into these callback in the next patch. See http://reviews.llvm.org/D4790.

include/clang/Driver/Multilib.h
158

OK

There is a functionality change in that CSMipsMultilibs will not search InstallDir + "/../../../../sysroot/usr/include". Is that expected?

lib/Driver/ToolChains.cpp
1838

This is identical to the first lambda, no? Can you factor it out?

In fact CSMipsMultilibs and FSFMipsMultilibs toolchains require different include paths. Currently we have to probe all possible paths in the Linux::AddClangSystemIncludeArgs() routine. One of the goal of this patch is to get paths from the toolchain description and do not enumerate all possible variants. So it is intended change.

lib/Driver/ToolChains.cpp
1838

Yes, both lambdas are identical now but it is just a chance. The corresponding toolchains are not related, have separate directories trees in the tests etc. So I think the factoring out might make the code more complicated and error prone.

rafael accepted this revision.Aug 5 2014, 2:21 PM
rafael edited edge metadata.

LGTM then.

This revision is now accepted and ready to land.Aug 5 2014, 2:21 PM
atanasyan closed this revision.Aug 5 2014, 11:01 PM

Thanks for review.

Closed by commit rL214949.