Don't emit a path note marking the return site if the return statement does not
have a valid location. This fixes an assertion failure I introduced in r265839.
llvm-svn: 266031
}
PathDiagnosticLocation L(Ret, BRC.getSourceManager(), StackFrame);
+ if (!L.isValid() || !L.asLocation().isValid())
+ return nullptr;
+
return new PathDiagnosticEventPiece(L, Out.str());
}
@property(readonly) int *propertyReturningNull;
+@property(readonly) int *synthesizedProperty;
+
@end
@implementation SomeClass
// expected-warning@-2 {{Dereference of null pointer}}
#endif
}
+
+void testSynthesizedPropertyReturningNull(SomeClass *sc) {
+ if (sc.synthesizedProperty)
+ return;
+
+ int *result = sc.synthesizedProperty;
+ *result = 1;
+#ifndef SUPPRESSED
+ // expected-warning@-2 {{Dereference of null pointer}}
+#endif
+}