Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Standalone indexer works for C not C++

What language is returned by the language mapper?

We don't use the standalone indexer in quite the same way you are using it, so there may be a subtle difference somewhere in some of the code you don't show.

===========================
Chris Recoskie
Team Lead, IBM CDT and RDT
IBM Toronto

Inactive hide details for Nicolas Anquetil ---07/16/2010 05:58:47 AM---Hi guys, You might recall that I asked how to parse and Nicolas Anquetil ---07/16/2010 05:58:47 AM---Hi guys, You might recall that I asked how to parse and index C projects with


From:

Nicolas Anquetil <anquetil.nicolas@xxxxxxxxx>

To:

cdt-dev@xxxxxxxxxxx

Date:

07/16/2010 05:58 AM

Subject:

[cdt-dev] Standalone indexer works for C not C++

Sent by:

cdt-dev-bounces@xxxxxxxxxxx




Hi guys,

You might recall that I asked how to parse and index C projects with
CDT standalone.

Well I succeeded thanks to your help.

However, I also want the same thing for C++ and strangely enough,
things appear to behave differently :-(

Would you have a suggestion?

Following is an excerpt of the code:
---
List<String> tus = // all C (resp. C++) files in the project
directory. this includes .h
IIndexLocationConverter locationConverter = new
URILocationConverter(projectDir.toURI());  // note
URILocationConverter is based on URIRelativeLocationConverter
macroDefinitions = Collections.emptyMap();
scannerInfo = new ScannerInfo(macroDefinitions, includePaths);
indexer = new StandaloneFastIndexer(new File("xyz"),
locationConverter, linkageFactoryMap, scannerInfo,
/*FileEncodingRegistry*/null, mapper, LOG);
indexer.rebuild(tus, new NullProgressMonitor());
foreach C /* resp. C++ */ file
 FileContent fc = FileContent.createForExternalFileLocation(srcfile);
 IASTTranslationUnit unit =
mapper.getLanguage(srcfile).getASTTranslationUnit(fc, scannerInfo,
ExternalFilesProvider.getInstance(), indexer.getIndex(), 0, LOG);
---

The problem is that with C++ name.resolveBinding() is null in the following:
---
IASTName name = // some ASTName from the unit
indexer.getIndex().findDeclarations(name.resolveBinding())
---


With C projects it does work :-(

I understand it is a lot of uncomplete code. If you need the whole
thing I can send it.

I believe the main question is: Why is it working for C and not C++?
What is the difference?
any suggestion where I should look?

thanks

nicolas

--
Nicolas Anquetil        Univ. Lille1 / INRIA-equipe RMod
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


GIF image

GIF image


Back to the top