diff options
author | Kristof Umann <dkszelethus@gmail.com> | 2018-09-14 09:07:40 +0000 |
---|---|---|
committer | Kristof Umann <dkszelethus@gmail.com> | 2018-09-14 09:07:40 +0000 |
commit | ceb5f6540f3dce0411ba04ed793cc7a0aa975893 (patch) | |
tree | 6ebefbf5642cebf7f426459219f7266cb0770e89 /clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp | |
parent | 6831d0caf234af47fe56efd569f4f42a2d78ea60 (diff) | |
download | bcm5719-llvm-ceb5f6540f3dce0411ba04ed793cc7a0aa975893.tar.gz bcm5719-llvm-ceb5f6540f3dce0411ba04ed793cc7a0aa975893.zip |
[analyzer][UninitializedObjectChecker] Updated comments
Some of the comments are incorrect, imprecise, or simply nonexistent.
Since I have a better grasp on how the analyzer works, it makes sense
to update most of them in a single swoop.
I tried not to flood the code with comments too much, this amount
feels just right to me.
Differential Revision: https://reviews.llvm.org/D51417
llvm-svn: 342215
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp b/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp index 22e3cbdb109..81ba04a2301 100644 --- a/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp @@ -1,4 +1,4 @@ -//===----- UninitializedPointer.cpp ------------------------------*- C++ -*-==// +//===----- UninitializedPointee.cpp ------------------------------*- C++ -*-==// // // The LLVM Compiler Infrastructure // @@ -90,9 +90,8 @@ public: // Utility function declarations. -/// Returns whether T can be (transitively) dereferenced to a void pointer type -/// (void*, void**, ...). The type of the region behind a void pointer isn't -/// known, and thus FD can not be analyzed. +/// Returns whether \p T can be (transitively) dereferenced to a void pointer +/// type (void*, void**, ...). static bool isVoidPointer(QualType T); using DereferenceInfo = std::pair<const TypedValueRegion *, bool>; @@ -107,9 +106,7 @@ static llvm::Optional<DereferenceInfo> dereference(ProgramStateRef State, // Methods for FindUninitializedFields. //===----------------------------------------------------------------------===// -// Note that pointers/references don't contain fields themselves, so in this -// function we won't add anything to LocalChain. -bool FindUninitializedFields::isPointerOrReferenceUninit( +bool FindUninitializedFields::isDereferencableUninit( const FieldRegion *FR, FieldChainInfo LocalChain) { assert(isDereferencableType(FR->getDecl()->getType()) && @@ -222,12 +219,11 @@ static llvm::Optional<DereferenceInfo> dereference(ProgramStateRef State, while (const MemRegion *Tmp = State->getSVal(R, DynT).getAsRegion()) { R = Tmp->getAs<TypedValueRegion>(); - if (!R) return None; // We found a cyclic pointer, like int *ptr = (int *)&ptr. - // TODO: Report these fields too. + // TODO: Should we report these fields too? if (!VisitedRegions.insert(R).second) return None; |