<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63018>63018</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            -Wnullable-to-nonnull-conversion no longer understands if-statements
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          CodingMarkus
      </td>
    </tr>
</table>

<pre>
    With `-Wnullable-to-nonnull-conversion` enabled and set to error (`-Werror`), the following code has always been failing since `_Nullable` has been introduced to Xcode:

`dispatch_cancel(csrc);`

with the type of `csrc` being `dispatch_source_t _Nullable`. However, this code did not fail so far:

`if (csrc) dispatch_cancel(csrc);`

as the `if`-statement guarantees that `csrc` is only passed to the function, if it is not `NULL` and note that `csrc` is a stack variable and no reference to it has ever left the current the stack frame, so it's impossible that this variable could become `NULL` after the `if`-statement and before the function call.

Starting with Xcode 14.3 (LLVM 15.0.0), all of a sudden this line fails as well, which seems a huge step backwards to me. It seems like clang/LLVM got worse as understanding code logic. This forces developer to implicitly case `csrc` to `_Nonnull` instead of just having to add an appropriate `if`-check, which is way better code.

BTW, the release notes of LLVM 15.0.0 imply nothing about such a change.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlE9v40YPxj_N-EJYkCX_PejwJgvjLZDdS7dNbwE1Q0mzGc8IQ8qGv31BOdk4aIuil8TCcMgfn4dDZPZ9JGrM5sFsvixwkiHl5jE5H_uvmF8nXrTJXZtnLwOYbbl8jlMI2AZaSlrGFPVzaVM8U2afotmWQFHPHWB0wCQgCSjnlMFU-znF_GW2pakOpnoEGQi6FEK6-NiDTY5gQAYMF7wytEQROvRBD9lHS8rx8u0NQwtq9Bzmo-TkJktOi_6hqUz9P1N-MeX7323pPI8odnixGC0FU-0tZ6ss9YNC3UVftGvFk-tIkDqtPAdvS2hJge7zcZqypReBe7g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