Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] C++ Indexer does indextypedefs


Hello,

C++ Indexer  does not index typedef, hence typedefs are not displayed in Type Selection dialogs.

I have done investigation around this. It look like there is a bug in IndexerTypeJob2.updateTypes( ...)
In this function see the following bit of code.
---------------------------------------------------------
                  . . .
        for( int counter = 0; counter < 2; ++counter )
        {
                    IEntryResult[] typeEntries = fProjectIndex.getEntries( IIndex.TYPE, IIndex.ANY, ( counter == 0 ) ? IIndex.DECLARATION : IIndex.DEFINITION );
           
                    if (typeEntries != null) {
                            //TODO subprogress monitor
                            for (int i = 0; i < typeEntries.length; ++i) {
                                    if (monitor.isCanceled())
                                            throw new InterruptedException();
                                   
                                    IEntryResult entry = typeEntries[i];
                                   
                                    String name = entry.extractSimpleName();
                                    switch (entry.getKind() ) {
                                    case IIndex.TYPE_CLASS :
                                    case IIndex.TYPE_STRUCT :
                                    case IIndex.TYPE_TYPEDEF :
                                    case IIndex.TYPE_ENUM :
                                    case IIndex.TYPE_UNION :                        
                                            if (counter != 0 && name.length() != 0) {  // skip anonymous structs
                                                    addType(input, entry, null, index2ICElement( entry.getKind() ), name, entry.getEnclosingNames(), monitor);
                                            }
                                            break;
                                    default:
                                            break;
                                    }
                            }
                    }
        }
                ...

-------------------------------------------------------------
The look runs twice, In first round it get declarations, but does not do any thing, i am not sure why it is kept like that ?

Reason for not listing typedef in cache is that,  typedefs are retrieved when searching for DECLARATION, they are not retrieved when searching for DEFINITION. During the declaration loop, here we don't add anything as counter == 0. I have fix for this could be to typedefs during the DECLARATION round, but this based on my localized knowledge acquired during debugging, so i could be wrong in other cases.

I have some doubts :
  1)  From CDT developer point of view how does pdom and c++ indexer differ ?
         Do we need to call separate function for these two indexer, were does the switching take place? Is there any document that explains this ? What all things do they share in common ?
  2) Low Level Type are identified, if the name starts with '_' , is this condition due to some standards ?

Thanks and Regards,

- janees


Back to the top