Skip to main content

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

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