[cfe-dev] Disable #error?

Jacob Carlborg doob at me.com
Thu Jan 23 11:49:46 PST 2014

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?

/Jacob Carlborg

More information about the cfe-dev mailing list