Hi,<div><br></div><div>Some popular open-source projects have a code layout which looks something like this:</div><div><br></div><div>project/</div><div>  libs/</div><div>    some_third_party_lib/</div><div>    my_own_lib/</div>
<div>  foo/my_code/</div><div>  bar/my_code/</div><div><br></div><div>... with a single include path pointing at the root of the project. When rolling out new warnings to such projects, warnings in the project's own code should be fixed, and warnings in third-party headers should typically be ignored. However, this is currently hard to achieve.</div>
<div><br></div><div>The natural way to suppress warnings from third-party headers would be to treat them as system headers, but we only have two ways to achieve this: -isystem (which doesn't work for this file layout), and #pragma system_header (which requires updating *all* the third_party headers). Neither of these seems to be a good solution to the problem.</div>
<div><br></div><div>The attached patch addresses this by adding two command-line arguments: -isystem-prefix FOO/ treats all #include "FOO/..." directives as including a system header, and -ino-system-prefix FOO/BAR/ treats all #include "FOO/BAR/..." directives as not including a system header. The latest-specified argument wins, and the overrides only apply to files which are found relative to a header search path (and not ones which are found relative to the current file, or by absolute path).</div>
<div><br></div><div>Is this OK for mainline Clang? The implementation is currently not optimized for the case of large numbers of such arguments -- we can deal with that later if it becomes an issue.</div><div><br></div><div>
Richard</div>