[cfe-dev] How to make clang recognize the system files included in a C++ source file?

Ani Safaryan ani.safaryan at yahoo.com
Wed Jan 12 22:06:24 PST 2011


Hello all,

I am writing a simple program which outputs the C++ types specified in the
source file. When I include a user-defined header file in my source file and
want the program to output the types specified in it I add the following:
.....
std::vector<clang::DirectoryLookup> v;
std::string s = "/path for the header file/";
const clang::DirectoryEntry* d = m_file_manager.getDirectory(s);
v.push_back(clang::DirectoryLookup(d, clang::SrcMgr::C_User, true, false));
clang::HeaderSearch m_header_search.SetSearchPaths(v, 0, 0);
.........
        
When I include system file in my source file(e.g #include <string>) and want
the program to output also the types specified in I do the following
modifications and get the following errors:
        
.........
std::vector<clang::DirectoryLookup> v;
std::string s = "/path for the header file/";
const clang::DirectoryEntry* d = m_file_manager.getDirectory(s);
v.push_back(clang::DirectoryLookup(d, clang::SrcMgr::C_User, true, false));
clang::HeaderSearch m_header_search.SetSearchPaths(v, 0, 0);
.........        
        
Stack dump:             
0.    /usr/include/c++/4.3/iosfwd:133:3: current parser token 'typedef'
        
Note InitHeaderSearch.h is not available in my clang version.

Regards,
Ani



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110112/79856c8d/attachment.html>


More information about the cfe-dev mailing list