[PATCH] D119004: [NFC][analyzer] Allow CallDescriptions to be matched with CallExprs

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 7 10:10:58 PST 2022

NoQ added a comment.

It's definitely a bug-prone scenario. I can totally see people stuffing whatever happens to be more readily available in the code into the API without thinking too much about the pros and cons. The difference between `CallExpr` and `CallEvent` is large in general but with respect to this API it's very subtle. I can easily imagine people missing it even when they know the difference between `CallExpr` and `CallEvent` in general. So I think it's worth attracting attention to.

Also technically a new overload *is* a new API. It just happens to have the same name as the old one.

Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h:102-103
+  /// Returns true if the CallEvent is a call to a function that matches
+  /// the CallDescription.
+  ///

Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h:182-183
+  /// ALWAYS prefer lookup with a CallEvent, when available. See comments above
+  /// CallDescription::matchesImprecise.
+  LLVM_NODISCARD const T *lookupImprecise(const CallExpr &Call) const {
In doxygen these comments will be below :)

I think this should be a full comment so that people didn't have to click.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list