labath wrote:

> Okay, I see the problem, I didn't really think that retrieving the type 
> system when debugging Swift code would return C type system. Why is it like 
> this though?

It depends on how you retrieve the type system. You were iterating through the 
type systems of the target, which will return all of them because C and swift 
(and other languages) can coexist within the same process. There isn't such a 
thing as a "pure swift" application, so we should have a story for how the two 
will interact. Maybe story can be "we don't let the two interact", but it 
should be an explicit choice and we should thing through the consequences.

> Is there a reliable way to get a type system of the main language?

I don't think "main language" makes sense as a concept. The fact that Swift 
makes up 99% of your binary is not going to help you if what you really want to 
do is debug that 1% written in C. It *might* make sense to use the language of 
the currently selected frame but even there we need to be careful. The fact 
that you can access global variables means you can end up with non-local types 
even in this case.

> I also found now that the function TypeSystem::GetBasicTypeFromAST that the 
> code in Eval relies on is not even implemented in 
> [TypeSystemSwift](https://github.com/swiftlang/llvm-project/blob/a5b0b3daf26fd41b2caf61551b72f74b0e2a4ab7/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.h#L296).

I don't know why is that the case, but it wouldn't surprise me if that's 
somehow related to the fact that the BasicType enum is already very C specific.

https://github.com/llvm/llvm-project/pull/138551
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to