It is getting increasingly annoying that it's so hard to construct a PathDiagnosticLocation correctly. I think we should eventually make the API more defensive to invalid source locations.
Details
- Reviewers
dcoughlin xazax.hun a_sidorin rnkovacs mikhail.ramalho Szelethus baloghadamsoftware Charusso alexfh - Commits
- rGe2a8e4316058: [analyzer] PR41335: Fix crash when no-store event is in a body-farmed function.
rL358945: [analyzer] PR41335: Fix crash when no-store event is in a body-farmed function.
rC358945: [analyzer] PR41335: Fix crash when no-store event is in a body-farmed function.
Diff Detail
Event Timeline
Hmm, i think i'd love to know why doesn't the uninitialized variable checker fire on the if-statement as farmed by the body farm:
592 // Signature: 593 // _Bool OSAtomicCompareAndSwapPtr(void *__oldValue, 594 // void *__newValue, 595 // void * volatile *__theValue) 596 // Generate body: 597 // if (oldValue == *theValue) { 598 // *theValue = newValue; 599 // return YES; 600 // } 601 // else return NO;
(closing brace accidentally omitted in the original comment as well)
Passing arguments to this whole body farm thing doesn't work. It builds the body for the declaration on line 4 but then calls the declaration on line 5, and parameter variables in the synthesized body don't match parameter variables of the call, so it cannot read argument values :/
Don't canonicalize the decl in the body farm. The decl supplied by the AnalysisDeclContext is already the correct one (and not necessarily the canonical one).
Keep the defensive behavior for NoStoreFuncVisitor because it's generally the right thing to do for future-proofness.
Should this be marked with a FIXME?