Russell Wallace via llvm-dev
2015-Sep-22 12:43 UTC
[llvm-dev] SourceMgr include relative to current file
SourceMgr provides AddIncludeFile which I'm thinking of using for parsing the TPTP language. As far as I can see, AddIncludeFile only deals with #include <...> style, i.e. only search the include directories. I don't see any code for dealing with #include "...", i.e. first look relative to the current file. Is there something I'm missing? How does clang handle this? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150922/2ca23182/attachment.html>
Sean Silva via llvm-dev
2015-Sep-23 00:19 UTC
[llvm-dev] SourceMgr include relative to current file
On Tue, Sep 22, 2015 at 5:43 AM, Russell Wallace via llvm-dev < llvm-dev at lists.llvm.org> wrote:> SourceMgr provides AddIncludeFile which I'm thinking of using for parsing > the TPTP language. > > As far as I can see, AddIncludeFile only deals with #include <...> style, > i.e. only search the include directories. I don't see any code for dealing > with #include "...", i.e. first look relative to the current file. > > Is there something I'm missing? How does clang handle this? >Clang is a totally different beast, and the meaning of "..." vs. <...> is not what you just described (it is much more complicated). It sounds like what you want is to just add the directory containing the file as an include path. -- Sean Silva> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150922/205a6357/attachment.html>
Russell Wallace via llvm-dev
2015-Sep-23 02:56 UTC
[llvm-dev] SourceMgr include relative to current file
Yeah, I was oversimplifying for brevity, but you're right, clang uses a different and much more complex code path altogether, and adding the directory of the current file might work, or else just implementing my own include logic; I think you can still use the file stack in SourceMgr. On Wed, Sep 23, 2015 at 1:19 AM, Sean Silva <chisophugis at gmail.com> wrote:> > > On Tue, Sep 22, 2015 at 5:43 AM, Russell Wallace via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> SourceMgr provides AddIncludeFile which I'm thinking of using for parsing >> the TPTP language. >> >> As far as I can see, AddIncludeFile only deals with #include <...> style, >> i.e. only search the include directories. I don't see any code for dealing >> with #include "...", i.e. first look relative to the current file. >> >> Is there something I'm missing? How does clang handle this? >> > > Clang is a totally different beast, and the meaning of "..." vs. <...> is > not what you just described (it is much more complicated). > > It sounds like what you want is to just add the directory containing the > file as an include path. > > -- Sean Silva > > >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150923/b9b10adb/attachment.html>