[PATCH] D46891: [StaticAnalyzer] Added a getLValue method to ProgramState for bases

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 25 07:52:42 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC333278: [analyzer] Added a getLValue method to ProgramState for bases (authored by Szelethus, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D46891

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h


Index: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
===================================================================
--- include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
@@ -294,6 +294,13 @@
   ProgramStateRef enterStackFrame(const CallEvent &Call,
                                   const StackFrameContext *CalleeCtx) const;
 
+  /// Get the lvalue for a base class object reference.
+  Loc getLValue(const CXXBaseSpecifier &BaseSpec, const SubRegion *Super) const;
+
+  /// Get the lvalue for a base class object reference.
+  Loc getLValue(const CXXRecordDecl *BaseClass, const SubRegion *Super,
+                bool IsVirtual) const;
+
   /// Get the lvalue for a variable reference.
   Loc getLValue(const VarDecl *D, const LocationContext *LC) const;
 
@@ -724,6 +731,22 @@
   return this;
 }
 
+inline Loc ProgramState::getLValue(const CXXBaseSpecifier &BaseSpec,
+                                   const SubRegion *Super) const {
+  const auto *Base = BaseSpec.getType()->getAsCXXRecordDecl();
+  return loc::MemRegionVal(
+           getStateManager().getRegionManager().getCXXBaseObjectRegion(
+                                            Base, Super, BaseSpec.isVirtual()));
+}
+
+inline Loc ProgramState::getLValue(const CXXRecordDecl *BaseClass,
+                                   const SubRegion *Super,
+                                   bool IsVirtual) const {
+  return loc::MemRegionVal(
+           getStateManager().getRegionManager().getCXXBaseObjectRegion(
+                                                  BaseClass, Super, IsVirtual));
+}
+
 inline Loc ProgramState::getLValue(const VarDecl *VD,
                                const LocationContext *LC) const {
   return getStateManager().StoreMgr->getLValueVar(VD, LC);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46891.148607.patch
Type: text/x-patch
Size: 1855 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180525/6902d8e8/attachment.bin>


More information about the cfe-commits mailing list