[PATCH] D74735: [analyzer] Add support for CXXInheritedCtorInitExpr.

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 03:21:54 PST 2020


steakhal added inline comments.


================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:916-918
+  virtual const CXXInheritedCtorInitExpr *getOriginExpr() const {
+    return cast<CXXInheritedCtorInitExpr>(AnyFunctionCall::getOriginExpr());
+  }
----------------
NoQ wrote:
> steakhal wrote:
> > Why is this function virtual?
> > If we want such behavior we should mark the `CallEvent::getOriginExpr` virtual and just //override// it here.
> > As-of-now, this just hides the previous implementation, causing potential problems.
> > 
> > This code-smell occures several times across this class hierachy.
> > 
> > Is this the expected behavior @NoQ?
> I think you're right, it should have been virtual from the start. Weird. Probably the only reason this works is that all overrides do literally the same thing, just cast to different types. But if even one of them doesn't we're in trouble. Yeah this needs to be fixed.
D90754 aims to fix this. Thank you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74735



More information about the cfe-commits mailing list