[Bug 66825] class browser and structures

Roberto Raggi roberto at kdevelop.org
Thu Nov 13 15:18:06 UTC 2003


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
     
http://bugs.kde.org/show_bug.cgi?id=66825     
roberto at kdevelop.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From roberto at kdevelop.org  2003-11-13 15:17 -------
Subject: kdevelop/languages/cpp

CVS commit by raggi: 


now the class store works with C-style typedef/struct definitions like

typedef struct
{
   int z;
} DATA;

CCMAIL: 66825-done at bugs.kde.org


  M +15 -1     store_walker.cpp   1.57
  M +3 -1      store_walker.h   1.14


--- kdevelop/languages/cpp/store_walker.cpp  #1.56:1.57
@@ -43,4 +43,6 @@ void StoreWalker::parseTranslationUnit( 
     m_inSignals = false;
     m_inStorageSpec = false;
+    m_inTypedef = false;
+    m_currentDeclarator = 0;
     m_anon = 0;
     m_imports.clear();
@@ -110,5 +112,15 @@ void StoreWalker::parseUsingDirective( U
 void StoreWalker::parseTypedef( TypedefAST* ast )
 {
+    DeclaratorAST* oldDeclarator = m_currentDeclarator;
+    
+    if( ast && ast->initDeclaratorList() && ast->initDeclaratorList()->initDeclaratorList().count() > 0 ) {
+            QPtrList<InitDeclaratorAST> lst( ast->initDeclaratorList()->initDeclaratorList() );
+            m_currentDeclarator = lst.at( 0 )->declarator();
+    }
+    
+    m_inTypedef = true;    
     TreeParser::parseTypedef( ast );
+    m_inTypedef = false;
+    m_currentDeclarator = oldDeclarator;
 }
 
@@ -260,5 +272,7 @@ void StoreWalker::parseClassSpecifier( C
 
     QString className;
-    if( !ast->name() ){
+    if( !ast->name() && m_currentDeclarator && m_currentDeclarator->declaratorId() ) {
+        className = m_currentDeclarator->declaratorId()->text().stripWhiteSpace();
+    } else if( !ast->name() ){
         QFileInfo fileInfo( m_fileName );
         QString shortFileName = fileInfo.baseName();

--- kdevelop/languages/cpp/store_walker.h  #1.13:1.14
@@ -73,5 +73,7 @@ private:
     int m_anon;
     bool m_inStorageSpec;
+    bool m_inTypedef;
 
+    DeclaratorAST* m_currentDeclarator;
     QValueStack<NamespaceDom> m_currentNamespace;
     QValueStack<ClassDom> m_currentClass;




More information about the KDevelop-devel mailing list