[PATCH] D82256: [analyzer] Enabling ctr in evalCall event

Nithin VR via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 12:28:31 PDT 2020


vrnithinkumar marked 5 inline comments as done.
vrnithinkumar added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/AnalysisOrderChecker.cpp:130
+        llvm::errs() << " (" << ND->getQualifiedNameAsString() << ')';
+      llvm::errs() << " {" << Call.getNumArgs() << '}';
+      llvm::errs() << " [" << Call.getKindAsString() << ']';
----------------
Szelethus wrote:
> This seems a bit cryptic, how about `{argno:`?
For more clarity, added "{argno:".


================
Comment at: clang/lib/StaticAnalyzer/Core/CheckerManager.cpp:669
       ProgramPoint L = ProgramPoint::getProgramPoint(
-          cast<CallExpr>(Call.getOriginExpr()),
+          Call.getOriginExpr(),
           ProgramPoint::PostStmtKind,
----------------
This is for fixing the unit test failures. 
Previously `assert` to check the type inside `cast<CallExpr>`  was causing the unit test failures.
The reason was `CXXConstructExpr` was not inherited from `CallExpr` and the cast was causing the assert failure with `isa` check.

I am not sure removing the cast is the best solution.
And the TODO comment, I did not understood properly.

Alternative approach was to cast it to `CXXConstructExpr` if it is not `CallExpr` but not sure whether `runCheckersForEvalCall` should aware of  `CXXConstructExpr`.


================
Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:586
   ExplodedNodeSet dstCallEvaluated;
+  EvalCallOptions CallOpts;
   getCheckerManager().runCheckersForEvalCall(dstCallEvaluated, dstPreVisit,
----------------
NoQ wrote:
> vrnithinkumar wrote:
> > NoQ wrote:
> > > If you want you can make it an optional argument of `runCheckersForEvalCall()`, like it's done in `defaultEvalCall()`.
> > I tried to make it as default argument for `runCheckersForEvalCall()` but `struct EvalCallOptions` is forward declared in `CheckerManager.h`.
> Oh well! You probably still don't need a separate local variable, can you try `EvalCallOptions()` or even `{}`?
Updated to use `EvalCallOptions()`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82256





More information about the cfe-commits mailing list