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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 13:30:54 PST 2020


NoQ 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());
+  }
----------------
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.


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