summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/consttobool.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/consttobool.cxx')
-rw-r--r--compilerplugins/clang/consttobool.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/compilerplugins/clang/consttobool.cxx b/compilerplugins/clang/consttobool.cxx
index 21fde3f547b1..a3c57d704b26 100644
--- a/compilerplugins/clang/consttobool.cxx
+++ b/compilerplugins/clang/consttobool.cxx
@@ -190,6 +190,15 @@ public:
return true;
}
}
+ if (auto const e = dyn_cast<CallExpr>(sub->IgnoreParenImpCasts()))
+ {
+ // Ignore use of `long __builtin_expect(long, long)`, as found in the definition of
+ // `assert` on macOS:
+ if (e->getBuiltinCallee() == Builtin::BI__builtin_expect)
+ {
+ return true;
+ }
+ }
bool suggestion;
bool replacement = {};
if (res.isInt())