Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to get definition of a declaration that is in a header file.

I basically want to perform some renames of the declaration, find the structure and make some renames of the members inside the struct. Basically refactoring of the declaration, then find the definition and perform some refactoring there.



On Thu, Apr 21, 2016 at 9:53 PM, Nathan Ridge <zeratul976@xxxxxxxxxxx> wrote:
> I generally use Binding.getDefn() if the type of binding is CPPCLasstype
>
> But, if the definition is outside, then what I get
> is org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPClassType and this
> has no getDefn().
>
> Basically , its a struct definition node and I want to get it

CDT does not keep ASTs for files in the index. It creates an AST for a file during indexing, saves information from the AST into the index, and then discards the AST.

Therefore, you have two options:
  1) Get the information you want from the index.
  2) Re-parse the header file to get an AST for it.

Depending on what it is exactly you want to do, one or the other may be more appropriate.

Regards,
Nate

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top