[PATCH] D75163: [analyzer][StreamChecker] Adding precall and refactoring.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 3 04:11:20 PST 2020


balazske marked 6 inline comments as done.
balazske added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:64-70
+/// Get the value of the stream argument out of the passed call event.
+/// The call should contain a function that is described by Desc.
+SVal getStreamArg(const FnDescription *Desc, const CallEvent &Call) {
+  assert(Desc && Desc->StreamArgNo != ArgNone &&
+         "Try to get a non-existing stream argument.");
+  return Call.getArgSVal(Desc->StreamArgNo);
+}
----------------
Szelethus wrote:
> You could make this a method of `FnDescription`.
Originally I wanted it too but there is no strong relation to it, somehow I like better to have it as separate function.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:148-151
+    // Ensure that not a member function is called.
+    const auto *FD = dyn_cast_or_null<FunctionDecl>(Call.getDecl());
+    if (!FD || FD->getKind() != Decl::Function)
+      return nullptr;
----------------
Szelethus wrote:
> I vaguely recall us having this conversation once, but isn't this redundant with 
> 
> ```lang=c++
>     if (!Call.isGlobalCFunction())
>       return nullptr;
> ```
> ? I don't mind not addressing this before commiting.
According to the documentation `isGlobalCFunction` should filter out member functions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75163





More information about the cfe-commits mailing list