News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

CC type tkMacro purpose?

Started by Alpha, April 14, 2014, 04:51:05 AM

Previous topic - Next topic

Alpha

I am unsure of what the purpose of tkMacro tokens in CC is.  However, when they show up, they tend to spam the popup:

Reducing the list to a logical set can easily be done with:

Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp (revision 9752)
+++ src/plugins/codecompletion/codecompletion.cpp (working copy)
@@ -968,6 +968,9 @@
                 if (preprocessorOnly && token->m_TokenKind != tkPreprocessor)
                     continue;

+                if (token->m_TokenKind & tkMacro && uniqueStrings.find(token->m_Name) != uniqueStrings.end())
+                    continue; // what is a "tkMacro" ??
+
                 int iidx = m_NativeParser.GetTokenKindImage(token);
                 if (alreadyRegistered.find(iidx) == alreadyRegistered.end())
                 {


But should tkMacro tokens be included in the search results in the first place?  What are they?

ollydbg

tkMacro means macro usage. (where the macros are used)
tkPreprocessor means macro definition.
I think tkMacro should be removed from the suggestion list, since there are many macros usages.

I think the "tkMacro" should be renamed to "tkMacroUsage", also, "tkPreprocessor" should be renamed to "tkMacroDefinition".
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

@Alpha:
The following 2 patches (in attachment) are what I would like to do such variable name refactoring, what's your opinion?
If no objections, I will commit them to trunk.
I think currently the CC plugin's "symbol tree" has a folder name "preprocessor" and "macro" which are quite confusing, so we need to fix them.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Alpha

Quote from: ollydbg on April 22, 2014, 09:30:14 AM
The following 2 patches (in attachment) are what I would like to do such variable name refactoring, what's your opinion?
I personally prefer the name changes: tkMacro -> tkMacroUse and tkPreprocessor-> tkMacroDef to avoid excess verbosity.  Other than that, I think the changes are fine.

ollydbg

#4
Quote from: Alpha on April 23, 2014, 04:11:03 PM
Quote from: ollydbg on April 22, 2014, 09:30:14 AM
The following 2 patches (in attachment) are what I would like to do such variable name refactoring, what's your opinion?
I personally prefer the name changes: tkMacro -> tkMacroUse and tkPreprocessor-> tkMacroDef to avoid excess verbosity.  Other than that, I think the changes are fine.
Thanks, just follow your advice, and done in trunk rev 9757.

Now, one task left is to change the png file names associated with the new variable names, but I'm not sure git-svn can handle all those changes.  ;)


preproc.png
preproc_folder.png
macro.png
macro_private.png
macro_protected.png
macro_public.png
macro_folder.png


Such as:  "preproc.png" to "macro_def.png";  "macro.png" to "macro_use.png", let me do it right now, If failed, I will report and seek help.

EDIT: image file name change is in r9758 now.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.