[cfe-dev] Disable #error?

Sean Silva silvas at purdue.edu
Thu Jan 23 12:11:02 PST 2014


On Thu, Jan 23, 2014 at 2:49 PM, Jacob Carlborg <doob at me.com> wrote:

> On 2014-01-23 20:19, Sean Silva wrote:
>
>  By what file it is declared in? How else would you determine this? You
>> can get the complete file path of the containing file with
>> <http://clang.llvm.org/doxygen/classclang_1_1SourceManager.html#
>> a1b7402699ef496ecc9b2db28a83f0c1b>.
>>
>
> Say I have these four files, in three different libraries:
>
> // /home/foo/libcollection/include/collection/list/list.h
> struct List;
>
> // /home/foo/libnet/include/net/socket.h
> struct Socket;
>
> // /home/foo/libmain/include/util/sub.h
> struct Sub;
>
> // /home/foo/libmain/include/umbrella.h
> #include "collection/list/list.h"
> #include "net/socket.h"
> #include "util/sub.h"
>
> Here I'm interested in translating the file "umbrella.h". The preprocessor
> will concatenate all files to something like this:
>
> // main_prepocessed.h
> struct List;
> struct Socket;
> struct Sub;
>
> I assume I will get back the full path to where these declarations
> originates from. How do I then know that Sub is part of libmain and is a
> sub header. And how do I know that List and Socket is not part of libmain?


There is no main_preprocessed.h as far as clang is concerned (unless you
manually create it, but then clang leaves #line's to keep track of where
things are from).

If you look at the SourceLocation for `struct List`, it will tell you that
the declaration is in `/home/foo/libcollection/
include/collection/list/list.h`.

-- Sean Silva


>
>
> --
> /Jacob Carlborg
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140123/168641a7/attachment.html>


More information about the cfe-dev mailing list