@jens and sbezgodov
I read some source code about the m_IsLocal.
void ParserThread::HandleIncludes()
{
wxString filename;
bool isGlobal = !m_IsLocal;
wxString token = m_Tokenizer.GetToken();
// now token holds something like:
// "someheader.h"
// < and will follow iostream.h, >
if (TestDestroy())
return;
if (!token.IsEmpty())
{
if (token.GetChar(0) == '"')
{
// "someheader.h"
// don't use wxString::Replace(); it's too costly
size_t pos = 0;
while (pos < token.Length())
{
wxChar c = token.GetChar(pos);
if (c != _T('"'))
filename << c;
++pos;
}
}
else if (token.GetChar(0) == '<')
{
isGlobal = true;
// next token is filename, next is . (dot), next is extension
// basically we'll loop until >
while (1)
{
token = m_Tokenizer.GetToken();
if (token.IsEmpty())
break;
if (token.GetChar(0) != '>')
filename << token;
else
break;
}
}
}
if (!filename.IsEmpty())
{
TRACE(F(_T("HandleIncludes() : Found include file '%s'"), filename.wx_str()));
do
{
// setting all #includes as global
// it's amazing how many projects use #include "..." for global headers (MSVC mainly - booh)
isGlobal = true;
if (!(isGlobal ? m_Options.followGlobalIncludes : m_Options.followLocalIncludes))
break; // Nothing to do!
wxString real_filename = m_pParent->GetFullFileName(m_Filename, filename, isGlobal);
// Parser::GetFullFileName is thread-safe :)
if (real_filename.IsEmpty())
break; // File not found, do nothing.
{
wxCriticalSectionLocker lock(s_MutexProtection);
if (m_pTokensTree->IsFileParsed(real_filename))
break; // Already being parsed elsewhere
}
TRACE(F(_T("HandleIncludes() : Adding include file '%s'"), real_filename.wx_str()));
// since we 'll be calling directly the parser's method, let's make it thread-safe
{
wxCriticalSectionLocker lock2(s_mutexListProtection);
m_pParent->DoParseFile(real_filename, isGlobal);
}
} while (false);
}
}
So, most Tokens in header files should be global (not local), only files belong to the workspace is local. Is there something wrong in handling include files?...