kuilpd wrote:

> The biggest problem is in your step 2. We can't make GetBuiltinTypeByName the 
> first thing in ResolveTypeByName. Doing that would prevent users from every 
> being able to redefine types with the same names as the builtins, which is 
> something I've been told is allowed in Swift, e.g.

Ah, I see, I didn't realize that this logic might not work for other languages. 
Mainly I suggested to change the way we parse the basic types, using 
`GetBuiltinTypeByName` instead of doing it manually. But this manual 
implementation comes from lldb-eval, which handled only C++, so it prioritizes 
the basic types the same way: if it finds something that looks like a basic 
type, it just returns the according CompilerType without looking for user types 
any further. 

In any case, Swift, if I understand correctly, doesn't really have builtin 
types, all the types like `Int` or `Float` are effectively user types defined 
in the standard library. The important distinction is that C++ builtin types 
may not be found by `ResolveTypeByName` that searches types in modules, so we 
need explicitly check if something is a builtin type, while for Swift we don't 
need to. So from my understanding `GetBuiltinTypeByName` in `TypeSystemSwift` 
can just always return nothing, and the code can move on to searching user 
types.

Need some Swift insight here :) @jimingham @adrian-prantl 


https://github.com/llvm/llvm-project/pull/159500
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to