Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Is extern parsed is ast or the indexer?


For my delayed V4 release I'm trying to fix a known limitation in Sloeber and to do so I'd like to find the ICElement of the extern bloks.
I have the ITranslationUnit tu of the file.
When I try tu.getElement("extern"); I get a null back.
I tried some alternatives but I always get null.

I'm sure I have the correct tu as the following code works

String fileContent = new String(tu.getContents());
   if (fileContent.contains("extern \"C\"")) {

I looked for a type that could match but IMHO nothing seems to match.

I'd like to find out where the extern "C" { XXXXX} blok starts and stops.
Line level is ok.

I can do it with string parsing but it would be far more convenient if I could use getSourceRange.

So my question is: is extern parsed by the indexer and if so what type is it. I could find out myself is there is a way to dump the index/ast in a readable format.

Thanks and best wishes for 2017


Back to the top