What's option about this simple patch:
commit c8eb8932bf5047072b301f2db42fa980ec548de6
Author: asmwarrior <ollydbg@codeblocks.org>
Date: Fri Feb 27 14:44:34 2015 +0800
* CC: do not save the macro usage.
macro usage is just like a function call, if we save all macro usages, our
token tree becomes too large. E.g. with this patch, the token number is
reduced from about 15000 to 13000 when parsing codeblocks.cbp. The only
case we need to save the macro usage are some special macro usages like
BEGIN_EVENT_TABLE or EVT_BUTTON, but this needs futures works.
diff --git a/src/plugins/codecompletion/parser/parserthread.cpp b/src/plugins/codecompletion/parser/parserthread.cpp
index 1d6f40e..cd5efee 100644
--- a/src/plugins/codecompletion/parser/parserthread.cpp
+++ b/src/plugins/codecompletion/parser/parserthread.cpp
@@ -2977,8 +2977,8 @@ void ParserThread::HandleMacroExpansion(int id, const wxString &peek)
Token* tk = m_TokenTree->at(id);
if (tk)
{
- TRACE(_T("HandleMacroExpansion() : Adding token '%s' (peek='%s')"), tk->m_Name.wx_str(), peek.wx_str());
- DoAddToken(tkMacroUse, tk->m_Name, m_Tokenizer.GetLineNumber(), 0, 0, peek);
+ //TRACE(_T("HandleMacroExpansion() : Adding token '%s' (peek='%s')"), tk->m_Name.wx_str(), peek.wx_str());
+ //DoAddToken(tkMacroUse, tk->m_Name, m_Tokenizer.GetLineNumber(), 0, 0, peek);
if (m_Options.parseComplexMacros)
m_Tokenizer.ReplaceMacroUsage(tk);
I don't understand what is the question.
Let me explain:
/* line 1 */ #define INT int
/* line 2 */ INT a;
In the above code, if we disable "storing macro usage", we have two tokens in the token tree:
1, macro definition token "#define INT int" in line 1
2, global variable token "a" in line 2
But currently enable "storing macro usage" will have another token in the tree:
3, macro usage token "INT" in line 2
I just means that such macro usage may happens too many times in source code(they just like functions calls), and we don't need to store them in the token tree to save memory usages.