[clang] [-Wunsafe-buffer-usage] Fix a bug and suppress libc warnings for C files (PR #109496)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 20 19:11:40 PDT 2024
================
@@ -250,7 +250,9 @@ AST_MATCHER_P(Stmt, ignoreUnsafeBufferInContainer,
AST_MATCHER_P(Stmt, ignoreUnsafeLibcCall, const UnsafeBufferUsageHandler *,
Handler) {
- return Handler->ignoreUnsafeBufferInLibcCall(Node.getBeginLoc());
+ if (Finder->getASTContext().getLangOpts().CPlusPlus)
+ return Handler->ignoreUnsafeBufferInLibcCall(Node.getBeginLoc());
+ return true; /* Only warn about libc calls for C++ */
----------------
jkorous-apple wrote:
This implementation should warn in Obj-C++ too and it should not in Obj-C but you might want to test that.
https://github.com/llvm/llvm-project/pull/109496
More information about the cfe-commits
mailing list