[cfe-dev] python bindings

Sam Price thesamprice at gmail.com
Thu Feb 21 20:52:57 PST 2013


That is what I want.
I think I need to use an ASTContext to get get the size of a type though.

Waiting for code to compile. I ended up with something like this

int clang_getSizeOf(CXType CT ) {

  CXTranslationUnit TU = GetTU( CT );

  ASTUnit * AU = clang::cxtu::getASTUnit( TU );

  const ASTContext & AC = AU->getASTContext();

  QualType T = GetQualType( CT );

  return AC.getTypeSize(T);

}




On Thu, Feb 21, 2013 at 4:14 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com>wrote:

> On Feb 20, 2013, at 6:07 PM, Sam Price <thesamprice at gmail.com> wrote:
>
> > I got the python bindings to work,
> > However I want to get size, and offset information for various types.
> >
> > This doesn't seem to be exposed in the Index.h file
> >
> > Would I just add new routines to that file?
> > Where are the index.h routines at?
> > Would I add a new routine
> > int getSizeOfCursor(Cursor)
> > Get the ASTContext from the cursor,
> > and then do GetTypeInfo from the ASTContext?
> >
> > and then expose it on the cindex.py routine?
>
> Are you interested in something like:
> "int clang_getSizeOfType(CXType T);"
> ?
>
> Start by taking a look at how
> "int clang_getNumArgTypes(CXType T);"
> is implemented.
>
> >
> > --
> > Thanks,
> >
> > Sam Price
> >
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>


-- 
Thank you,

Sam Price
(707) 742-3726
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130221/aa894784/attachment.html>


More information about the cfe-dev mailing list