mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
These APIs are quite convoluted. The checks for var_decl need to be performed in just the right order. The is a consequence of complexity in the SIL representation itself, not a problem with the APIs. It is common for code to accidentally call a less-complete form of the API. It is essential that they be defined in a central location, and the we get the same answer whether we start with an Instruction, Argument, or Value. The primary public interface should always check for debug_value users. The varDecl property is actually an implementation detail. It is questionable whether a function like findVarDecl() that returns a basic property of SIL and does not require arguments should be a property instead. It is a function to hint that it may scan the use-list, which is not something we normally want SIL properties to do. Use-lists can grow linearly in function size. But, again, this is a natural result of the SIL representation and needs to be considered an implementation detail.