[analyzer] Invalidate the object in opaque ctor calls regardless if an arg refers to it
The conservative call invalidation logic is a bit complicated, and would deserve some refactoring.
When a call has some arguments, we escape them. Except, if its a pointer to constant storage - because we assume that the program honors const-correctness.
In that case, it puts it in the "Preserved" list to keep its contents. However, if we had a constructor call that's job is to initialize an object had a const pointer/reference parameter then the invalidation didn't take place.
This meant that if the object was on the stack, that we start warning about uninitialized fields when accessed. (See the example) Similar could be achieved on the heap of course.
We should have honored the fact that the constructor should initialize the pointee of "this", thus escape that region regardless (in other words, don't put it on the "preserved" list).
This doesn't fix the root cause, but cures a symptom. Ideally, we should redesign the argument invalidation from the ground up. See the attached FIXME test case.
rdar://156942972 (cherry picked from commit efa32e36323e0c92b33c34aea61009026c164686)
@swift-ci please test llvm
@swift-ci please test
@swift-ci please test macOS
@swift-ci please test macOS
@swift-ci please test macOS
This is getting really ridiculous. 5th time the charm. @swift-ci please test macOS
Maybe the lucky 6 will work. That's the highest you can roll on a usual cube. @swift-ci please test macOS
02:28:20 Clang :: Modules/pch-config-macros.c
02:28:20 LLVM :: Transforms/IndVarSimplify/unreachable-exit.ll
These two are known failures.
@swift-ci please test macOS