[-Wcompletion-handler] Support checks with builtins
authorValeriy Savchenko <vsavchenko@apple.com>
Mon, 8 Feb 2021 15:47:21 +0000 (18:47 +0300)
committerValeriy Savchenko <vsavchenko@apple.com>
Tue, 9 Feb 2021 08:32:24 +0000 (11:32 +0300)
commitd1522d349f4d4b960ff7a37303103e95aa535af3
tree8c8230f7903bfe9be2ea4ff181b42c286bb9c819
parent5b8db127a30f583c5437579c8a9412d07745f2b1
[-Wcompletion-handler] Support checks with builtins

It is very common to check callbacks and completion handlers for null.
This patch supports such checks using built-in functions:
  * __builtin_expect
  * __builtin_expect_with_probablity
  * __builtin_unpredictable

rdar://73455388

Differential Revision: https://reviews.llvm.org/D96268
clang/lib/Analysis/CalledOnceCheck.cpp
clang/test/SemaObjC/warn-called-once.m