[clang] [Don't Merge][-Wunsafe-buffer-usage] Add a new option for unsafe buffer warnings on libc functions (PR #105383)

via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 20 14:14:10 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff c89e9e7d9e9d7c4b30e2d911f4d68ec66e6c68d8 ddceaaf34a5237744991a077c0a88dca52eddf60 --extensions h,cpp -- clang/test/SemaCXX/warn-unsafe-buffer-usage-libc-functions-inline-namespace.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-libc-functions.cpp clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h clang/lib/Analysis/UnsafeBufferUsage.cpp clang/lib/Sema/AnalysisBasedWarnings.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-test-unreachable.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index 02e39161e2..7475845f4b 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -473,7 +473,7 @@ namespace libc_func_matchers {
 //                  "__builtin___" + LibcName + "_chk"   |
 //                  "__asan_" + LibcName
 //
-struct LibcFunNamePrefixSuffixParser {  
+struct LibcFunNamePrefixSuffixParser {
   StringRef matchName(StringRef FunName, bool isBuiltin) {
     // Try to match __builtin_:
     if (isBuiltin && FunName.starts_with("__builtin_"))
@@ -660,7 +660,7 @@ AST_MATCHER(FunctionDecl, isPredefinedUnsafeLibcFunc) {
 
   auto *II = Node.getIdentifier();
 
- if (!II)
+  if (!II)
     return false;
 
   StringRef Name = LibcFunNamePrefixSuffixParser().matchName(

``````````

</details>


https://github.com/llvm/llvm-project/pull/105383


More information about the cfe-commits mailing list