<div dir="ltr">NVM, just noticed that the DeclContext for the parent record is available. I can get tye QualType using: llvm::dyn_cast<clang::TypeDecl>(parent)->getTypeForDecl()->getCanonicalTypeInternal()</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 11, 2021 at 3:21 PM Zequan Wu <<a href="mailto:zequanwu@google.com">zequanwu@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm trying to call TypeSystemClang::AddMethodToCXXRecordType in PdbAstBuilder::GetOrCreateFunctionDecl to create a function decl in the case when the function is inside a record. It requires the record's type as the first argument. So, I think I need to get its TypeIndex first. I tried to do the following, but it fails to find the parent's TypeIndex. type_id.index is the member function's TypeIndex.</div><div><font face="monospace">auto iter = m_parent_types.find(type_id.index);</font><br></div><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">Am I using m_parent_types incorrectly? Or is there any other ways to get the class/structure's TypeIndex?</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Zequan</font></div></div>
</blockquote></div>