Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] ICproject.getReferences(Ibinding), exist something similar?

Thanks you very much Markus for your quick answer.

Great document!

 

------------------------------------------------------
Daniel Barrientos

BMW EF-612, Softwareentwicklung und -test
Geb 79.6 2.Stock Raum 36

Tel:     +49-89-382-21886
Mobil: +49 176 601 21886

Daniel.Barrientos@xxxxxxxxxxxxxx

 

 

Von: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] Im Auftrag von Schorn, Markus
Gesendet: Donnerstag, 27. Oktober 2011 14:43
An: CDT General developers list.
Betreff: Re: [cdt-dev] ICproject.getReferences(Ibinding), exist something similar?

 

Below is a link to an overview on how to access information about c/c++ code, it contains a few code examples that may be helpful:

http://wiki.eclipse.org/images/c/c7/CDT_APIs_for_code_introspection.pdf

 

Markus.

 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Daniel.Barrientos@xxxxxxxxxxxxxx
Sent: Thursday, October 27, 2011 14:27
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] ICproject.getReferences(Ibinding), exist something similar?
Importance: Low

 

Hello everyone,

I am using CDT parser to implement some Code Static Analysis in my project.

But now I am facing a problem. I have a header file that defines:

Header.h

Void Function1();

Void Function2();

 

I also have 2 c files:

Cfile1.c

Void whatever1(){

                Funtion1();

}

 

Cfile2.c

Void whatever2(){

                Funtion2();

}

 

 

I want to detect if functions are used to determine if code can be optimized:

Until now I use for example:

IBinding functionname_binding=function.getName().resolveBinding();

Cfile1.getTraslationUnit().getAST().getReference(functionname_binding)

 

That works when I analyse Cfile1 or Cfile2.

So I ask: Ist everyfunction declared in header used in TranslationUnit that we analyse now?

 

 

But I would like to ask CDT: Ist everyfunction declared in header used in the project that we analyse now?

 

 

Unfortunately, I didn’t find a method like Cproject.getReferences(Ibinding) and when I make:

For all translation_unit:

tunit.getAST().getReference(functionname_binding)

 

it does not work because functionname_binding is the instance created previously to make the loop.

 

Can you help me on this??

Thanks

 

Daniel

 

------------------------------------------------------
Daniel Barrientos

BMW EF-612, Softwareentwicklung und -test
Geb 79.6 2.Stock Raum 36

Tel:     +49-89-382-21886
Mobil: +49 176 601 21886

Daniel.Barrientos@xxxxxxxxxxxxxx
------------------------------------------------------

 

 

 


Back to the top