[PATCH] D26762: Add a method to obtain this SVal of a method that created given StackFrameCtx

Devin Coughlin via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 16 15:35:21 PST 2016


dcoughlin added a comment.

Thanks for the patch!

How does this differ from `getCXXThisVal()` on `CXXInstanceCall` and its subclasses in CallEvent.h? Can that be used instead? Or are there places where you need access to this without a CallEvent?

Also: it seems like there are a lot of places in the analyzer codebase that do this dance (get the 'this' pointer, load from it). Can they be safely replaced with calls to this helper? If so, that would be awesome.



================
Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:769
+      return None;
+    Loc ThisLoc = getStateManager().getSValBuilder().getCXXThis(RD, SFC);
+    return getSVal(ThisLoc);
----------------
Why this overload of getCXXThis() and not the one taking a CXXMethodDecl?


https://reviews.llvm.org/D26762





More information about the cfe-commits mailing list