<HTML><HEAD><TITLE>Samsung Enterprise Portal mySingle</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<STYLE id=mysingle_style type=text/css>P {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
TD {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
LI {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
BODY {
        LINE-HEIGHT: 1.4; MARGIN: 10px; FONT-FAMILY: Arial, arial; FONT-SIZE: 9pt
}
</STYLE>

<META name=GENERATOR content=ActiveSquare></HEAD>
<BODY>
<META name=GENERATOR content=ActiveSquare>
<P> </P>
<P>Probably you are looking for some base graph walk. A look into "computeOffsetHint" function in lib/CodeGen/CGExprCXX.cpp might provide you some idea. But this function calculates the offset hint for doing pointer arithmetic.</P>
<P> </P>
<P>------- <B>Original Message</B> -------</P>
<P><B>Sender</B> : Sebastian Redl<sebastian.redl@getdesigned.at></P>
<P><B>Date</B> : May 13, 2013 21:55 (GMT+09:00)</P>
<P><B>Title</B> : Re: [cfe-dev] Getting RecordDecl from CXXBaseSpecifier</P>
<P> </P><BR>On 13.05.2013, at 06:15, Justin Arruda wrote:<BR><BR>> Hello all.  New to cfe-dev (and participating in mailing lists in general).<BR>> <BR>> The question I'm hoping to have answered is as simple as the subject<BR>> implies. I have a CXXRecordDecl,<BR>> and I am trying to determine which of its bases is derived from a<BR>> class that I know this CXXRecordDecl<BR>> is also derived from.<BR>> <BR>> i.e.<BR>> class A;<BR>> class B : public A;<BR>> class C;<BR>> <BR>> class D : public B, public C<BR>> Looking for which base D gets its A from.<BR>> <BR>> I am also seeking general advice for my project as it pertains to my<BR>> usage of clang.  I am using<BR>> libtooling and ASTMatchers to create Python bindings for a game engine.<BR>> <BR>> This is some sample input I am using for my generator: [test-input].<BR>> <BR>> When attempting to locate which base of MyBaz and MyDerived gets their<BR>> inheritance of Colossus::MyBase,<BR>> I've tried the following strategy: Obtain the type of the base<BR>> specifier, and using an appropriate<BR>> DeclContext, look up the declaration.  Once I have the declaration, I<BR>> can use its methods to determine if<BR>> it's derived from Colossus::MyBase (or is that class).<BR>> <BR>> // Get the qualified name of the base<BR>> QualType type = aBaseSpecifier->getType();<BR>> DeclarationName baseDeclName( type.getBaseTypeIdentifier() );<BR>> <BR>> // Grab a context to look up the decl<BR>> const DeclContext* lookupContext = theCxxRecordDecl->getLookupContext();<BR>> <BR>> DeclContext::lookup_const_result lr = lookupContext->lookup(baseDeclName);<BR><BR>Looking up the name of the type is too complicated. Also, why do you want the decl? If you want to compare for equality, the type is more interesting.<BR><BR>In any case, the QualType returned by CXXBaseSpecifier::getType() will always (perhaps unless you're dealing with a template definition) be a RecordType underneath; just use type->getAs<RECORDTYPE>() to get the RecordType. Then you can use getDecl() on the result, which returns a RecordDecl, but in C++ every RecordDecl is a CXXRecordDecl, so you can just cast<CXXRECORDDECL> it.<BR><BR>Sebastian<BR>_______________________________________________<BR>cfe-dev mailing list<BR>cfe-dev@cs.uiuc.edu<BR>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<BR>
<P> </P>
<P> </P><!--SP:senthil.t-->
<P>Regards</P>
<P>Senthil Kumar</P>
<P> </P><!--senthil.t:EP-->
<P> </P></BODY></HTML><img src='http://ext.samsung.net/mailcheck/SeenTimeChecker?do=d6065e8d54c1989c2e67b817ecd85624f843ace4bc1f29a89cdd14f0554fc2de1d78c8484d0968ef1d70666c366810d91b20909a04efd4d2748cfe1d4e847419cf878f9a26ce15a0' border=0 width=0 height=0 style='display:none'>