[PATCH] D67706: [clang][analyzer] Using CallDescription in StreamChecker.

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 1 06:43:20 PDT 2019


Szelethus added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:127-131
+  for (auto P : Call.parameters()) {
+    QualType T = P->getType();
+    if (!T->isIntegralOrEnumerationType() && !T->isPointerType())
+      return nullptr;
+  }
----------------
balazske wrote:
> Szelethus wrote:
> > I'm not sure why we need this, is it true that *all* stream related functions return a pointer or a numerical value? Are we actually checking whether this really is a library function? If so, this looks pretty arbitrary.
> This comes from code of CStringChecker:
> ```
>   // Pro-actively check that argument types are safe to do arithmetic upon.
>   // We do not want to crash if someone accidentally passes a structure
>   // into, say, a C++ overload of any of these functions. We could not check
>   // that for std::copy because they may have arguments of other types.
> ```
> Still I am not sure that the checker works correct with code that contains similar named but "arbitrary" functions.
Oops, meant to write that ", is it true that *all* stream related functions have only pointer or a numerical parameters?".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67706/new/

https://reviews.llvm.org/D67706





More information about the cfe-commits mailing list