[Lldb-commits] [PATCH] D64159: [Core] Generalize ValueObject::MaybeCalculateCompleteType

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 9 16:54:32 PDT 2019

xiaobai added inline comments.

Comment at: source/Target/ObjCLanguageRuntime.cpp:403
+ObjCLanguageRuntime::CalculateCompleteType(CompilerType base_type) {
+  CompilerType type_to_return;
jingham wrote:
> xiaobai wrote:
> > clayborg wrote:
> > > So a main question for ObjC here: do we always want to show the runtime type? Should we not check if the class inside of "base_type" is the one true definition and skip grabbing the runtime type here and return {}?
> > How do you know which is the "one true definition"?
> The only places you can add ivars to an ObjC class are in the @interface declaration (which is usually in the .h file for the class) and in the @implementation and the "class category" - which has to be in the same source file as the @implementation.  So if you find debug information for the .m file that contains the @implementation you have seen all the ivars of the class.  Clang marks that fact by putting "DW_AT_APPLE_objc_complete_type" with value "true" in the DW_TAG_structure_type die for the class.  If you see a type definition so marked, that it the "one true definition".
This makes sense to me, but I'm not sure if there are any abstractions that support this today. I did find a method `CompilerType::IsCompleteType` but I don't think that does this. I think that the only way to accomplish this right now is to reach into the DWARF directly, which I do not want to have to do here. I think preserving existing behavior is okay for now.



More information about the lldb-commits mailing list