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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 23 14:09:05 PST 2020


NoQ marked 6 inline comments as done.
NoQ added inline comments.


================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:872
+///
+/// Example: \c class T : public S { using S::S; }; T(1);
+class CXXInheritedConstructorCall : public AnyFunctionCall {
----------------
martong wrote:
> Perhaps the example could provide the definition of  the class `S` too.
Dunno, it's kinda obvious that it has some constructor from an integer, and that's really the only thing that we need to know about it. Also what's the proper way to make a line break in `\c`? Because i always forget how to build with doxygen :)


================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:896
+public:
+  virtual const CXXInheritedCtorInitExpr *getOriginExpr() const {
+    return cast<CXXInheritedCtorInitExpr>(AnyFunctionCall::getOriginExpr());
----------------
baloghadamsoftware wrote:
> I wonder whether we could reduce code-duplication using some kind of mixin-like inheritance here.
Maybe but sounds complicated. There isn't *that* much duplication. Most of the code is either inherited from a superclass or is actually different.

I guess a common superclass for `CXXConstructorCall` and `CXXInheritedConstructorCall` should be sufficient for most purposes.

Yeah, let me actually do this.


================
Comment at: clang/lib/StaticAnalyzer/Core/SymbolManager.cpp:545
 
+    // Anonymous parameters of an inheriting constructor are live for the entire
+    // duration of the constructor.
----------------
martong wrote:
> `live` -> `alive` ?
Ah yes, I'd love me some good ol' `RelaxedAliveVariablesAnalysis` (:

Dunno why the terminology is made that way (i.e., live as in "live music"), but it seems to be that way :/


Repository:
  rC Clang

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

https://reviews.llvm.org/D74735





More information about the cfe-commits mailing list