[PATCH] D77846: [analyzer][CallAndMessage][NFC] Split up checkPreCall

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 20 05:56:04 PDT 2020


Szelethus added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp:27
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
----------------
balazske wrote:
> Are these new includes needed?
Nope, you're right.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp:371
-  const Decl *D = Call.getDecl();
-  if (D && (isa<FunctionDecl>(D) || isa<BlockDecl>(D))) {
-    // If we have a function or block declaration, we can make sure we pass
----------------
@balazske this is the corresponding condition that got changed. Now, your inline is fair, and I remember being puzzled by needing that condition to not crash. One thing to note is that CallAndMessage really tests every part of CallEvent, and since its registered very early (its also a dependency in addition to being a core checker) it runs before most other checkers. Anyways, I revisited each of the new functions I added, and wow, you totally nailed it. Nothing crashes if I remove that condition, but I vividly remember it breaking earlier.

So yeah, nice catch!




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

https://reviews.llvm.org/D77846





More information about the cfe-commits mailing list