Reputation: 4570
I've been silently dealing with this for months now and finally I feel the need to ask here. 'po' in lldb often results in the following output:
(lldb) error: :3:1: error: use of unresolved identifier 'inView' inView ^~~~~~
I'm writing up a custom animation view controller transition. I'm paused in the animateTransition(using transitionContext:)
method. inView
is a local variable defined at the start of the method. I'm using it on the next line. I want to query its value. It shows up in the 'variables view' part of the debugger (however just the name and no details).
So I see no reason why this shouldn't print out.
Now, before people talk about optimization, this is a fresh single view application running a default scheme. The default optimization settings for the Swift compiler have no optimization for the debug profile. This is indeed how my project is set up.
So what is the problem??
Upvotes: 2
Views: 114
Reputation: 27110
Even at the lowest optimization level (-Onone
) the swift compiler does a lot more optimization work than clang does for the C languages at -O0
. Swift relies on the optimizer to make its more complex basic model perform well, and needs to do some of this work even at -Onone
.
One of the common symptoms of debug info losing to optimization passes is a failure to track the location of variables. The debug information records the variable, but for some address ranges can't reconstruct its location. From your description it sounds like you are hitting this problem.
There's no one cause for this symptom, since the failure is the result of the interaction of all stages of the compiler & optimizer. The more instances of this the swift engineers can see, the more of the bad pathways they can fix. So please file bugs when you see this. The instructions for that are here:
https://swift.org/contributing/#reporting-bugs
Upvotes: 3