[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 20 10:21:54 PDT 2020


jingham added a comment.

In D88483#2341538 <https://reviews.llvm.org/D88483#2341538>, @fallkrum wrote:

> Thanks a lot Jim for explanations, now it makes sense to me.
> Have one more question on class Type. Writing API test for the patch defined 2 functions like this:
>
>   void *func1(int) {
>           return NULL;
>   }
>   
>   void *func2(int) {
>           return NULL;
>   }
>
> Tried to find function type using target.FindFirstType('func1') and got nothing as a result. Call to module.GetTypes().GetTypeAtIndex(0).GetName() contained:
> "void *(int)".  Looking through clang::Decls found out that clang::FunctionDecl is child of clang::ValueDecl and it finally became clear to me that "func1", "func2" are not types at all but simply symbols (variables?) of the same type "void *(int)". Therefore module where above 2 functions were declared contained only 1 type "void *(int)". Investigating how DWARFASTParser works noticed that it do generates 2 Type instances for 2 defined functions with m_name variable set to "func1", "func2" respectively and m_compiler_type referencing the same  "void *(int)" (but not in it's string representation of course). 
> So the question is: Does class Type represents not only a type but also a variable (symbol or identifier, don't know how to name it correctly in this situation)?

My understanding is that functions have a type but aren't types themselves.  I'm not sure where you are seeing us make Type's for functions, can you say more about that?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88483/new/

https://reviews.llvm.org/D88483



More information about the lldb-commits mailing list