[PATCH] D45532: [StaticAnalyzer] Checker to find uninitialized fields after a constructor call

Aleksei Sidorin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 25 11:15:16 PDT 2018


a.sidorin added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/CtorUninitializedMemberChecker.cpp:72
+  const FieldDecl *getEndOfChain() const { return Chain.back()->getDecl(); }
+  template <unsigned Size> void toString(SmallString<Size> &Buf) const;
+  friend struct FieldChainInfoComparator;
----------------
This can be rewritten like `void toString(SmallVectorImpl<char> &Buf) const;


================
Comment at: lib/StaticAnalyzer/Checkers/CtorUninitializedMemberChecker.cpp:306
+
+  const RecordDecl *RD =
+      R->getValueType()->getAs<RecordType>()->getDecl()->getDefinition();
----------------
What will happen if we analyze a member which is a pointer to a structure type and the structure is of incomplete type?


================
Comment at: lib/StaticAnalyzer/Checkers/CtorUninitializedMemberChecker.cpp:534
+
+  while (T.getTypePtrOrNull()) {
+    if (T->isVoidPointerType())
----------------
while (!T.isNull())


================
Comment at: test/Analysis/ctor-uninitialized-member.cpp:554
+
+void f23p15() {
+  void *vptr = malloc(sizeof(int));
----------------
Could you please explain what is the logic of test naming?


https://reviews.llvm.org/D45532





More information about the cfe-commits mailing list