<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 16, 2020, at 7:27 AM, James Y Knight <<a href="mailto:jyknight@google.com" class="">jyknight@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Thu, Oct 15, 2020 at 11:59 PM Chris Lattner <<a href="mailto:clattner@nondot.org" class="">clattner@nondot.org</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class=""><div class=""><blockquote type="cite" class=""><div class="">On Oct 14, 2020, at 6:49 PM, James Y Knight via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class=""><div class=""><blockquote class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class="gmail_quote"><div class=""><br class="">If such a hook mechanism is added, it then seems entirely plausible that <a href="https://github.com/apple/llvm-project/blob/apple/main/clang/lib/Sema/SemaAPINotes.cpp" target="_blank" class="">SemaAPINotes.cpp</a> and<span class=""> </span><a href="https://github.com/apple/llvm-project/tree/apple/main/clang/lib/APINotes" target="_blank" class="">lib/APINotes/*</a> can be moved from the clang-fork into swift itself without requiring significant modifications of the code, or any change in functionality of the feature.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Well, the APINotes also provide nullability information for ObjC interfaces, which is not part of Swift, but rather part of ObjC, so that still needs to be in clang.  That is, the functionality is useful for ObjC, and that doesn't make sense to be in Swift.</div><div class=""></div></div></div></blockquote><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class=""><br class=""></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class="">Theoretically one could imagine doing so -- but TTBOMK, it's never actually been used like this. All nullability annotations used by objc compilations live in the headers themselves, and the apinotes command-line options are passed only by Swift, for creating a Swift-ObjC-bridge module.<span class=""> </span></div></div></blockquote><br class=""></div><div class="">Nullability isn’t just useful for swift, it is also useful to the clang static analyzer and other tools that want to reason about C API semantics.</div></div></blockquote><div class=""><br class=""></div><div class="">Nullability is being used in ObjC to emit warnings, but apinotes is not. For ObjC compiles (and static analyzer), the nullability information comes from header files, _Nullable and _Nonnull keywords, "NS_ASSUME_NONNULL_BEGIN", etc.</div></div></div>
</div></blockquote></div><br class=""><div class="">Right, but APINotes are complementary to header annotations.  Some headers are readonly, e.g. if they are uncooperative system linux headers that won’t adopt the annotations.</div><div class=""><br class=""></div><div class="">-Chris</div></body></html>