Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

New code completion remarks/issues

<< < (36/54) > >>

blueshake:

--- Quote from: daniloz on October 09, 2009, 08:49:56 am ---Quick question... in the structs_typedefs.cpp (from the tests - thx Morten):

--- Code: ---struct _s
{
  int   x;
  float y;
};
typedef struct _s t_s;

typedef struct _s_inner
{
int z_inner;
} t_s_inner;

--- End code ---

C::B shows "t_s" as a typedef, BUT "t_s_inner" as a class. Is this a bug or a feature? :D

Btw, I was expecting to see "t_s_inner" as a typedef... ;)

daniloz

PS: why are structs treated as class by the CC?


--- End quote ---


not a bug,I do this.read the codes about void ParserThread::ReadClsNames(wxString& ancestor)
as I kown ,there is a bug in typedef handle .so......

blueshake:

--- Quote from: daniloz on October 09, 2009, 08:49:56 am ---Quick question... in the structs_typedefs.cpp (from the tests - thx Morten):

--- Code: ---struct _s
{
  int   x;
  float y;
};
typedef struct _s t_s;

typedef struct _s_inner
{
int z_inner;
} t_s_inner;

--- End code ---

C::B shows "t_s" as a typedef, BUT "t_s_inner" as a class. Is this a bug or a feature? :D

Btw, I was expecting to see "t_s_inner" as a typedef... ;)

daniloz

PS: why are structs treated as class by the CC?


--- End quote ---


fixed.


and fixed the typedef issue.
test codes:

--- Code: ---struct _s
{
  int   x;
  float y;
};
typedef struct _s t_s;
typedef t_s ssss;

ssss.
--- End code ---
patch:

--- Code: ---Index: src/plugins/codecompletion/parser/parserthread.cpp
===================================================================
--- src/plugins/codecompletion/parser/parserthread.cpp (revision 5859)
+++ src/plugins/codecompletion/parser/parserthread.cpp (working copy)
@@ -1795,13 +1795,15 @@
                   current.c_str(),
                   m_Str.c_str(),
                   (m_pLastParent ? m_pLastParent->m_Name.c_str():_T("<no-parent>")));
-            Token* newToken = DoAddToken(tkClass, current, m_Tokenizer.GetLineNumber());
+            Token* newToken = DoAddToken(tkTypedef, current, m_Tokenizer.GetLineNumber());
             if (!newToken)
                 break;
             else
             {
                 wxString tempAncestor = ancestor;
                 newToken->m_AncestorsString = tempAncestor;
+                newToken->m_ActualType = tempAncestor;
+                newToken->m_Type = tempAncestor;
             }
         }
         else // unexpected
Index: src/plugins/codecompletion/parser/token.cpp
===================================================================
--- src/plugins/codecompletion/parser/token.cpp (revision 5859)
+++ src/plugins/codecompletion/parser/token.cpp (working copy)
@@ -865,7 +865,7 @@
                 {
                     Token* ancestorToken = at(*it);
                     // only classes take part in inheritance
-                    if (ancestorToken && ancestorToken != token && (ancestorToken->m_TokenKind == tkClass || ancestorToken->m_TokenKind == tkEnum))// && !ancestorToken->m_IsTypedef)
+                    if (ancestorToken && ancestorToken != token && (ancestorToken->m_TokenKind == tkClass || ancestorToken->m_TokenKind == tkEnum || ancestorToken->m_TokenKind == tkTypedef))// && !ancestorToken->m_IsTypedef)
                     {
                         token->m_Ancestors.insert(*it);
                         ancestorToken->m_Descendants.insert(i);

--- End code ---

ollydbg:
Here is the patch to add TRACE to the token.cpp.

Also, this patch contains the previous post's patch by blueshake.

Currently, If you test the structs_typedefs.cbp.

Only these statements below failed.


--- Code: ---//    t_ptr.
//    t_ptr(3,3).

--- End code ---

PS: Is it a typo? the original code is:


--- Code: ---//    t_ptr_s(
//    t_ptr_s(3,3).

--- End code ---



[attachment deleted by admin]

ollydbg:
This is the testing patch for parsing the Macros for GCC 4.x

See the screenshot.



You should also change these section in your default.conf file. Just search by "TOKEN_REPLACEMENTS"




--- Code: --- <TOKEN_REPLACEMENTS>
<ssmap>
<_GLIBCXX_BEGIN_NAMESPACE>
<![CDATA[+namespace]]>
</_GLIBCXX_BEGIN_NAMESPACE>
<_GLIBCXX_BEGIN_NAMESPACE_TR1>
<![CDATA[-namespace tr1 {]]>
</_GLIBCXX_BEGIN_NAMESPACE_TR1>
<_GLIBCXX_BEGIN_NESTED_NAMESPACE>
<![CDATA[+namespace]]>
</_GLIBCXX_BEGIN_NESTED_NAMESPACE>
<_GLIBCXX_END_NAMESPACE>
<![CDATA[}]]>
</_GLIBCXX_END_NAMESPACE>
<_GLIBCXX_END_NAMESPACE_TR1>
<![CDATA[}]]>
</_GLIBCXX_END_NAMESPACE_TR1>
<_GLIBCXX_END_NESTED_NAMESPACE>
<![CDATA[}]]>
</_GLIBCXX_END_NESTED_NAMESPACE>
<_GLIBCXX_STD>
<![CDATA[std]]>
</_GLIBCXX_STD>
</ssmap>
</TOKEN_REPLACEMENTS>

--- End code ---


I'm still testing... :D

Edit

it seems works OK!



[attachment deleted by admin]

blueshake:
What I want to know is if doing this wil slow down the parse process?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version