[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] Disable #error?
From:       Sean Silva <silvas () purdue ! edu>
Date:       2014-01-23 20:11:02
Message-ID: CAHnXoanK0+M=EK-pLiPSninO1YFbZ2O+9+A7gvV-9P5Dep0NVw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Thu, Jan 23, 2014 at 2:49 PM, Jacob Carlborg <doob@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@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>

[Attachment #5 (text/html)]

<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, \
Jan 23, 2014 at 2:49 PM, Jacob Carlborg <span dir="ltr">&lt;<a \
href="mailto:doob@me.com" target="_blank">doob@me.com</a>&gt;</span> wrote:<br> \
<blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div \
class="im">On 2014-01-23 20:19, Sean Silva wrote:<br>

<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
 By what file it is declared in? How else would you determine this? You<br>
can get the complete file path of the containing file with<br>
&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1SourceManager.html#a1b7402699ef496ecc9b2db28a83f0c1b" \
target="_blank">http://clang.llvm.org/<u></u>doxygen/classclang_1_<u></u>1SourceManager.html#<u></u>a1b7402699ef496ecc9b2db28a83f0<u></u>c1b</a>&gt;.<br>


</blockquote>
<br></div>
Say I have these four files, in three different libraries:<br>
<br>
// /home/foo/libcollection/<u></u>include/collection/list/list.h<br>
struct List;<br>
<br>
// /home/foo/libnet/include/net/<u></u>socket.h<br>
struct Socket;<br>
<br>
// /home/foo/libmain/include/<u></u>util/sub.h<br>
struct Sub;<br>
<br>
// /home/foo/libmain/include/<u></u>umbrella.h<br>
#include &quot;collection/list/list.h&quot;<br>
#include &quot;net/socket.h&quot;<br>
#include &quot;util/sub.h&quot;<br>
<br>
Here I&#39;m interested in translating the file &quot;umbrella.h&quot;. The \
preprocessor will concatenate all files to something like this:<br> <br>
// main_prepocessed.h<br>
struct List;<br>
struct Socket;<br>
struct Sub;<br>
<br>
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?</blockquote> <div><br></div><div>There \
is no main_preprocessed.h as far as clang is concerned (unless you manually create \
it, but then clang leaves #line&#39;s to keep track of where things are \
from).</div><div><br></div><div>If you look at the SourceLocation for `struct List`, \
it will tell you that the declaration is in \
`/home/foo/libcollection/<u></u>include/collection/list/list.h`.</div> \
<div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" \
style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div \
class=""> <div class="h5"><br>
<br>
-- <br>
/Jacob Carlborg<br>
<br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" \
target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br> \
</div></div></blockquote></div><br></div></div>



_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic