[PATCH] D111534: [analyzer][NFC] Refactor CallEvent::isCalled()

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 18 08:52:46 PDT 2021


ASDenysPetrov added a comment.

Thank you for adding me. I'll make a deeper review later.



================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:1289
+  /// E.g. { "std", "vector", "data" } -> "vector", "std"
+  auto begin_qualified_name_parts() const {
+    return std::next(QualifiedName.rbegin());
----------------
What rules did you use to name this functions? It seems that it goes against [[ https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly | LLVM naming rules]].


================
Comment at: clang/lib/StaticAnalyzer/Core/CallEvent.cpp:336-352
+  const auto ExactMatchArgAndParamCounts =
+      [](const CallEvent &Call, const CallDescription &CD) -> bool {
+    const bool ArgsMatch =
+        !CD.RequiredArgs || CD.RequiredArgs == Call.getNumArgs();
+    const bool ParamsMatch =
+        !CD.RequiredParams || CD.RequiredParams == Call.parameters().size();
+    return ArgsMatch && ParamsMatch;
----------------
Can we move these lambdas in separate functions? IMO it could make the code even more readable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111534



More information about the cfe-commits mailing list