Bug 66825 - class browser and structures
Summary: class browser and structures
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-29 12:47 UTC by Sven Schmidt
Modified: 2013-03-31 00:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Schmidt 2003-10-29 12:47:01 UTC
Version:            (using KDE KDE 3.1.3)
Installed from:    Compiled From Sources
Compiler:          gcc 3.3(prerelease) SuSE 8.2 
OS:          Linux

The class browser lists structures defined like this

//Enth
Comment 1 Amilcar do Carmo Lucas 2003-10-29 13:23:24 UTC
Use:

struct RGB_STR
{
//�bermalen oder nicht
int f;

//RGB-Werte des Punktes
int r;
int g;
int b;

}

And it will work.

Are you using KDevelop 3.0.0 Beta 1 ?
Comment 2 Roberto Raggi 2003-11-13 15:17:01 UTC
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@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;


Comment 3 Aleix Pol 2013-03-31 00:50:31 UTC
Moving all the bugs from the CPP Parser. It was not well defined the difference between it and C++ Language Support and people kept reporting in both places indistinctively