Author Topic: New code completion remarks/issues  (Read 211965 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #105 on: October 05, 2009, 09:53:43 am »
@blueshake:

look at the Get function prototype, it is a static function.
Code
class DLLIMPORT Manager
{
    static Manager* Get();
}
but, in the symbol tree debug dialog, you will see that the
Quote
type is Manager *
actual type is Manager

That's may be the cause of bug...


But it worked before.I updated the local copy,and it don't work.
look at these codes.The static are ignored.
Code
        else if (token==ParserConsts::kw_static ||
            token==ParserConsts::kw_virtual ||
            token==ParserConsts::kw_inline)
        {
            // do nothing (skip it)
        }

Hi, after one and a half hour examing. I find the bug, and the patch to fix it.

Code
Index: nativeparser.cpp
===================================================================
--- nativeparser.cpp (revision 5834)
+++ nativeparser.cpp (working copy)
@@ -1465,7 +1465,7 @@
                 tokenType = pttNamespace;
             else
                 tokenType = pttClass;
-            line.Remove(0, startAt + 2);
+            line.Remove(0, startAt + 1);
         }
         else
             line.Clear();

Here is the explanation:

For the code:
Code
Manager::Get()->
The nativeparser should divide the line to "Manager" and "Get".

The current trunk code just mistakenly divide to "Manager" and "et", so, this patch can solve the bug.
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.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #106 on: October 05, 2009, 10:15:42 am »
Cool man.

I just check the codes,found that we used IsOperatorEnd(startAt, line),so this is why patch should be applied.

@ollydbg
watch these codes in nativeparser.cpp
Code
        startAt = BeginOfToken(startAt, line);

        // Check for [Class]. ('.' pressed)
        if (IsOperatorDot(startAt, line))
        {
            --startAt;
            repeat = true; // yes -> repeat.
        }
        // Check for [Class]-> ('>' pressed)
        // Check for [Class]:: (':' pressed)
        else if (IsOperatorEnd(startAt, line))
        {
            startAt -= 2;
            repeat = true; // yes -> repeat.
        }
[/s]

should the startAt -=2;be changed to startAt -=1;.I think the reason is same to the patch. :D
« Last Edit: October 05, 2009, 10:17:39 am by blueshake »
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #107 on: October 05, 2009, 10:42:07 am »
I can confirm the issues I reported in reply 93,#99 can be fixed by ollydbg's #105 patch,even the tkTypedef can work too.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #108 on: October 05, 2009, 10:46:55 am »
I can confirm the issues I reported in reply 93,#99 can be fixed by ollydbg's #105 patch,even the tkTypedef can work too.
I'm so grad to hear that!!!! :lol:
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.

Offline mmkider

  • Almost regular
  • **
  • Posts: 150
Re: New code completion remarks/issues
« Reply #109 on: October 05, 2009, 12:03:38 pm »
Hi
I found a issue.

if stest is a struct;

stest->b. ;   //this is fail. Tip window can't pop up c
stest.b.c  ;  //this  is ok .


Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #110 on: October 05, 2009, 12:57:41 pm »
Hi
I found a issue.

if stest is a struct;

stest->b. ;   //this is fail. Tip window can't pop up c
stest.b.c  ;  //this  is ok .




Full test codes,please.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline mmkider

  • Almost regular
  • **
  • Posts: 150
Re: New code completion remarks/issues
« Reply #111 on: October 05, 2009, 01:30:10 pm »
Code

typedef struct U_TKey{
int u32Key;

}U_KEYPAD_TWOKEY;

typedef struct S_KeyPad{
U_KEYPAD_TWOKEY   unTKey;
void *   pParam;
char   u8CallBack_Type;
char  u8DebounceClk;
char  u8IntNum;
char  u8TriggerType;
}S_KEYPAD_CLASS;
It's ok
Code
S_KEYPAD_CLASS  sTest;
sTest.unTKey.u32Key=10;

It's fail.
Code

S_KEYPAD_CLASS  *psTest;
psTest->unTkey.     // can't popup u32Key

« Last Edit: October 05, 2009, 02:18:28 pm by mmkider »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: New code completion remarks/issues
« Reply #112 on: October 05, 2009, 01:56:52 pm »
This works fine here:
Code
  S_KEYPAD_CLASS *psTest;
  psTest->unTKey.
("u32Key" will be suggested).

...version, patform etc?
« Last Edit: October 05, 2009, 01:58:36 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mmkider

  • Almost regular
  • **
  • Posts: 150
Re: New code completion remarks/issues
« Reply #113 on: October 05, 2009, 02:06:05 pm »
This works fine here:
Code
  S_KEYPAD_CLASS *psTest;
  psTest->unTKey.
("u32Key" will be suggested).

...version, patform etc?

I use codeblocks svn 5839 in the WinXp sp2.
In my system, "u32Key" will not be suggested.

Code
S_KEYPAD_CLASS  *psTest;
psTest->unTkey.                      // can't popup u32Key
« Last Edit: October 05, 2009, 02:10:41 pm by mmkider »

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #114 on: October 05, 2009, 02:14:16 pm »
Work here,too.see the attachment.

Sorry to say that,but tktypedef don't work again.ollydbg is right,something is wrong with codes below,if I comment them,worked.!!!!!!!!

Code
        if (token->m_TokenKind == tkTypedef)
        {
            std::queue<ParserComponent> type_components;
            BreakUpComponents(parser, token->m_ActualType, type_components);

            while(!components.empty())
            {
                ParserComponent comp = components.front();
                components.pop();
                type_components.push(comp);
            }

    #if DEBUG_CC_AI
            if (s_DebugSmartSense)
            #if wxCHECK_VERSION(2, 9, 0)
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Replacing %s to %s"), token->m_Name.wx_str(), token->m_ActualType.wx_str()));
            #else
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Replacing %s to %s"), token->m_Name.c_str(), token->m_ActualType.c_str()));
            #endif
    #endif
            return FindAIMatches(parser, type_components, result, parentTokenIdx, noPartialMatch, caseSensitive, use_inheritance, kindMask, search_scope);
        }

    }



[attachment deleted by admin]
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline mmkider

  • Almost regular
  • **
  • Posts: 150
Re: New code completion remarks/issues
« Reply #115 on: October 05, 2009, 02:33:58 pm »
Work here,too.see the attachment.

Sorry to say that,but tktypedef don't work again.ollydbg is right,something is wrong with codes below,if I comment them,worked.!!!!!!!!

Code
        if (token->m_TokenKind == tkTypedef)
        {
            std::queue<ParserComponent> type_components;
            BreakUpComponents(parser, token->m_ActualType, type_components);

            while(!components.empty())
            {
                ParserComponent comp = components.front();
                components.pop();
                type_components.push(comp);
            }

    #if DEBUG_CC_AI
            if (s_DebugSmartSense)
            #if wxCHECK_VERSION(2, 9, 0)
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Replacing %s to %s"), token->m_Name.wx_str(), token->m_ActualType.wx_str()));
            #else
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Replacing %s to %s"), token->m_Name.c_str(), token->m_ActualType.c_str()));
            #endif
    #endif
            return FindAIMatches(parser, type_components, result, parentTokenIdx, noPartialMatch, caseSensitive, use_inheritance, kindMask, search_scope);
        }

    }



I update src of codeblocks to SVN 5840.
It work well.

Thank all.


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: New code completion remarks/issues
« Reply #116 on: October 05, 2009, 02:54:07 pm »
Sorry to say that,but tktypedef don't work again.ollydbg is right,something is wrong with codes below,if I comment them,worked.!!!!!!!!
What does not work exactly? My test cases all work very well...?! Are you using latest SVN code?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mmkider

  • Almost regular
  • **
  • Posts: 150
Re: New code completion remarks/issues
« Reply #117 on: October 05, 2009, 03:03:13 pm »
Sorry to say that,but tktypedef don't work again.ollydbg is right,something is wrong with codes below,if I comment them,worked.!!!!!!!!
What does not work exactly? My test cases all work very well...?! Are you using latest SVN code?

I can't  update all easily.
Because I remain wxflatnotebook in the src of codeblocks.
So I use other folder to update new src of codeblocks  and trandsfer some codes  of  my interest to my old folder.
I thank I do some wrong  thing between the new folder and the old folder :(.

« Last Edit: October 05, 2009, 03:44:11 pm by mmkider »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #118 on: October 05, 2009, 03:17:31 pm »
Sorry to say that,but tktypedef don't work again.ollydbg is right,something is wrong with codes below,if I comment them,worked.!!!!!!!!
What does not work exactly? My test cases all work very well...?! Are you using latest SVN code?

@Morten

blueshake's test code in this post:
http://forums.codeblocks.org/index.php/topic,11187.msg76788.html#msg76788

failed when entering "wwww", there is a flash of the suggestion list.
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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: New code completion remarks/issues
« Reply #119 on: October 05, 2009, 03:26:50 pm »
failed when entering "wwww", there is a flash of the suggestion list.

CC works for me in this case on linux, but not on windows (immediately close of suggestion window -> flash), but CC believes wwwwwwwww is a class, that's most likely because of the tktypedef-stuff.