[llvm-dev] How to get the TypeIndex for the class/structure given its member function's TypeIndex in PdbAstBuilder?
Zequan Wu via llvm-dev
llvm-dev at lists.llvm.org
Thu Nov 11 16:28:51 PST 2021
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()
On Thu, Nov 11, 2021 at 3:21 PM Zequan Wu <zequanwu at google.com> wrote:
> Hi,
>
> 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.
> auto iter = m_parent_types.find(type_id.index);
>
> Am I using m_parent_types incorrectly? Or is there any other ways to get
> the class/structure's TypeIndex?
>
> Zequan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211111/61e33619/attachment.html>
More information about the llvm-dev
mailing list