[PATCH] D16873: Refactor MemRegionManager::getVarRegion to call two new functions, improving readability

Aleksei Sidorin via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 4 09:23:27 PST 2016


a.sidorin added a subscriber: a.sidorin.
a.sidorin added a comment.

Thanks ariccio! Some inline comments are below.


================
Comment at: llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1186
@@ +1185,3 @@
+  ///  associated with a specified globally stored, non-static local, VarDecl.
+  const MemRegion *getMemRegionGloballyStored(const VarDecl *D);
+
----------------
How about make these helper functions return `const MemSpaceRegion *` to make their signatures more meaningful?

================
Comment at: llvm/tools/clang/lib/StaticAnalyzer/Core/MemRegion.cpp:769
@@ -768,4 +768,3 @@
 
-const VarRegion* MemRegionManager::getVarRegion(const VarDecl *D,
-                                                const LocationContext *LC) {
-  const MemRegion *sReg = nullptr;
+const MemRegion* MemRegionManager::getMemRegionGloballyStored(const VarDecl *D) {
+  assert(D->hasGlobalStorage());
----------------
`get[Global/StaticLocal]MemSpaceForVariable`?

================
Comment at: llvm/tools/clang/lib/StaticAnalyzer/Core/MemRegion.cpp:843
@@ +842,3 @@
+                                                const LocationContext *LC) {
+  const MemRegion *sReg = nullptr;
+
----------------
`const MemSpaceRegion *StorageSpace?`


http://reviews.llvm.org/D16873





More information about the cfe-commits mailing list