[PATCH] D51057: [analyzer][UninitializedObjectChecker] Fixed dereferencing

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 23 09:27:12 PDT 2018


Szelethus marked 5 inline comments as done.
Szelethus added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h:259
+  return T->isBuiltinType() || T->isEnumeralType() ||
+         T->isMemberPointerType() || T->isBlockPointerType();
+}
----------------
I'm not sure this is correct -- do block pointers belong here? Since their region is not `TypedValueRegion`, I though they better fit here.


================
Comment at: lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h:261-265
+inline bool isLocType(const QualType &T) {
+  return T->isAnyPointerType() || T->isReferenceType() ||
+         T->isBlockPointerType();
+}
+
----------------
NoQ wrote:
> We have a fancy static `Loc::isLocType()`.
Oh, good to know! However, it also returns true for `nullptr_t`, which also happens to be a `BuiltinType`. I'd like to keep `isPrimitiveType` and (the now renamed) `isDereferencableType` categories disjunctive. Primitive types require no further analysis other then checking whether they are initialized or not, which is true for `nullptr_t` objects.


================
Comment at: lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp:240-244
+    if (Tmp->getRegion()->getSymbolicBase())
       return None;
-    }
 
-    V = State->getSVal(*Tmp, DynT);
+    DynT = DynT->getPointeeType();
+    R = Tmp->getRegionAs<TypedValueRegion>();
----------------
NoQ wrote:
> This code seems to be duplicated with the "0th iteration" before the loop. I guess you can put everything into the loop.
I moved some code into the loop, but I think that I really need a 0th iteration to make the code readable.


https://reviews.llvm.org/D51057





More information about the cfe-commits mailing list