[PATCH] D32437: [analyzer] Nullability: fix a crash when adding notes inside a synthesized property accessor.

Anna Zaks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 17 10:44:58 PDT 2017


zaks.anna added a comment.

Thanks! A couple of minor comments below.



================
Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:699
+  // We cannot place diagnostics on autosynthesized code.
+  // Put them onto the call site through which we jumped into autosynthesized
+  // code for the first time.
----------------
Nit: You could probably factor this into a nicely named helper function.


================
Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:704
+    const LocationContext *ParentLC = LC->getParent();
+    while (ParentLC->getAnalysisDeclContext()->isBodyAutosynthesized()) {
+      LC = ParentLC;
----------------
Is ParentLC guaranteed never to be null? I would prefer checking for it inside the while. Even if it is not likely to happen now, the code could evolve to handle more cases..


================
Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:932
+        MD->isPropertyAccessor() &&
+        CalleeCtx->getAnalysisDeclContext()->isBodyAutosynthesized());
 }
----------------
There was a case where we wanted to produce events for auto synthesized code, could you add a comment on what they were? (Otherwise, it's not clear why we need the isPropertyAccessor check.)


https://reviews.llvm.org/D32437





More information about the cfe-commits mailing list