[clang] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

Kristóf Umann via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 8 04:33:42 PST 2024


================
@@ -87,9 +87,11 @@ bool CheckerContext::isCLibraryFunction(const FunctionDecl *FD,
   if (!II)
     return false;
 
-  // Look through 'extern "C"' and anything similar invented in the future.
-  // If this function is not in TU directly, it is not a C library function.
-  if (!FD->getDeclContext()->getRedeclContext()->isTranslationUnit())
+  // C library functions are either declared directly within a TU (the common
+  // case) or they are accessed through the namespace `std` (when they are used
+  // in C++ via headers like <cstdlib>).
----------------
Szelethus wrote:

Same here.

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


More information about the cfe-commits mailing list