[cfe-users] Avoid all system include paths

Emilio Pombo via cfe-users cfe-users at lists.llvm.org
Sat Nov 12 12:47:00 PST 2016

On Fri, Nov 11, 2016 at 3:08 PM, Douglas Katzman <dougk at google.com> wrote:

> Remove '-nobuiltininc' and substitute '-nostdinc'.  That's in addition to
> '-nostdinc++'

Great answer Duglas, thank you very much, it has done perfectly for my
proposes... On my free time I'm working on a tool based on libclang to
provide an a generic API as facilitator to: parse, query and navigate
through a large database of C plus plus code project, and I'm putting all
my efforts specially on caching external headers parse, to optimize on
re-parse time of huge inline third party libraries that are shared between
translation units (obviously considering the preprocessor issues).

> On Fri, Nov 11, 2016 at 11:00 AM, Emilio Pombo via cfe-users <
> cfe-users at lists.llvm.org> wrote:
>> Hi,
>> I want to make clang parser to avoid all default and builtin include path
>> in my system (Ubuntu 14.04.5 LTS) for lib C and C++ stl (GNU, LLVM or
>> whatever). I'm using the two most canonical options for doing that (I
>> think): -*nobuiltininc* and -*nostdinc++*, also tried to change some
>> roots or prefixes with -isysroot , -iwithprefix or --gcc-toolchain, but
>> still with no luck.
>> A simple example of my clang unwanted behavior could be:
>> *$* echo '#include <aio.h>' > aio.cc
>> *$* clang++ -nobuiltininc -nostdinc++ -v aio.cc
>> clang version 3.9.1-svn281634-1~exp1 (branches/release_39)
>> ...
>> ignoring nonexistent directory "/include"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  */usr/local/include*
>> * /usr/include/x86_64-linux-gnu*
>> * /usr/include*
>> End of search list.
>> ...
>> So in this execution clang ends up finding the header aio.h (in
>> /usr/include/), while this is just the behavior I'm looking forward to
>> modify. Any ideas to change it?
>> With the clang verbose option, you can see that those paths are included
>> before the parser starts, using flags like: -*internal*-isystem and -
>> *internal*-externc-isystem, there is a way to change or turn-off those
>> internal settings?
>> Thanks in advance!
>> Emilio.
>> _______________________________________________
>> cfe-users mailing list
>> cfe-users at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20161112/89bea319/attachment.html>

More information about the cfe-users mailing list