[PATCH] D51300: [analyzer][UninitializedObjectChecker] No longer using nonloc::LazyCompoundVal

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 29 04:23:04 PDT 2018

Szelethus added inline comments.

Comment at: lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp:448-449
   Loc ThisLoc = Context.getSValBuilder().getCXXThis(CtorDecl->getParent(),
NoQ wrote:
> This totally needs `assert(CtorDecl == Context.getStackFrame()->getDecl())`. Otherwise we're in big trouble because we'll be looking into a this-region that doesn't exist on this stack frame.
> On second thought, though, i guess we should put this assertion into the constructor of `CXXThisRegion`. I'll do this.
> Also there's an overload of `getCXXThis` that accepts the method itself, no need to get parent.
Ummmm that wouldn't be very nice, because...

Comment at: lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp:456-483
 static bool willObjectBeAnalyzedLater(const CXXConstructorDecl *Ctor,
                                       CheckerContext &Context) {
-  Optional<nonloc::LazyCompoundVal> CurrentObject = getObjectVal(Ctor, Context);
-  if (!CurrentObject)
+  const TypedValueRegion *CurrRegion = getConstructedRegion(Ctor, Context);
+  if (!CurrRegion)
     return false;
...`willBeAnalyzerLater()` relies on this, and it uses all sorts of constructor decls to check whether `Context.getLocationContext()->getDecl()` would be a subregion of another object. Are you sure that this is incorrect?

  rC Clang


More information about the cfe-commits mailing list