clang
7.0.0
|
#include "ClangSACheckers.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include <algorithm>
Go to the source code of this file.
Functions | |
static Optional< nonloc::LazyCompoundVal > | getObjectVal (const CXXConstructorDecl *CtorDecl, CheckerContext &Context) |
Returns the object that was constructed by CtorDecl, or None if that isn't possible. More... | |
static bool | isCalledByConstructor (const CheckerContext &Context) |
Checks whether the constructor under checking is called by another constructor. More... | |
static bool | isVoidPointer (const FieldDecl *FD) |
Returns whether FD can be (transitively) dereferenced to a void pointer type (void*, void**, ...). More... | |
static bool | isPrimitiveType (const QualType &T) |
Returns true if T is a primitive type. More... | |
static void | printNoteMessage (llvm::raw_ostream &Out, const FieldChainInfo &Chain) |
Constructs a note message for a given FieldChainInfo object. More... | |
static StringRef | getVariableName (const FieldDecl *Field) |
Returns with Field's name. More... | |
Variables | |
static llvm::ImmutableListFactory< const FieldRegion * > | Factory |
|
static |
Returns the object that was constructed by CtorDecl, or None if that isn't possible.
Definition at line 626 of file UninitializedObjectChecker.cpp.
References clang::ento::SVal::castAs(), clang::ento::SVal::getAs(), clang::ento::SValBuilder::getCXXThis(), clang::CXXMethodDecl::getParent(), clang::ento::CheckerContext::getStackFrame(), clang::ento::CheckerContext::getState(), and clang::ento::CheckerContext::getSValBuilder().
|
static |
Returns with Field's name.
This is a helper function to get the correct name even if Field is a captured lambda variable.
Definition at line 667 of file UninitializedObjectChecker.cpp.
References clang::CXXRecordDecl::captures_begin(), clang::ento::CheckerManager::getAnalyzerOptions(), clang::AnalyzerOptions::getBooleanOption(), clang::FieldDecl::getFieldIndex(), clang::NamedDecl::getName(), clang::FieldDecl::getParent(), and clang::ento::CheckerManager::registerChecker().
Referenced by isPrimitiveType().
|
static |
Checks whether the constructor under checking is called by another constructor.
Definition at line 642 of file UninitializedObjectChecker.cpp.
References clang::LocationContext::getDecl(), clang::ento::CheckerContext::getLocationContext(), and clang::LocationContext::getParent().
Returns true if T is a primitive type.
We defined this type so that for objects that we'd only like analyze as much as checking whether their value is undefined or not, such as ints and doubles, can be analyzed with ease. This also helps ensuring that every special field type is handled correctly.
Definition at line 227 of file UninitializedObjectChecker.cpp.
References getVariableName(), clang::Type::isBuiltinType(), clang::Type::isEnumeralType(), clang::Type::isMemberPointerType(), and printNoteMessage().
Returns whether FD 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.
Definition at line 614 of file UninitializedObjectChecker.cpp.
References clang::Type::getPointeeType(), clang::ValueDecl::getType(), clang::QualType::isNull(), and clang::Type::isVoidPointerType().
|
static |
Constructs a note message for a given FieldChainInfo object.
Definition at line 654 of file UninitializedObjectChecker.cpp.
Referenced by isPrimitiveType().
|
static |
Definition at line 204 of file UninitializedObjectChecker.cpp.
Referenced by clang::ento::ProgramStatePartialTrait< llvm::ImmutableMap< Key, Data, Info > >::CreateContext(), clang::ento::ProgramStatePartialTrait< llvm::ImmutableSet< Key, Info > >::CreateContext(), clang::ento::ProgramStatePartialTrait< llvm::ImmutableList< T > >::CreateContext(), clang::ento::CreateRangeConstraintManager(), clang::ento::ProgramStatePartialTrait< llvm::ImmutableMap< Key, Data, Info > >::DeleteContext(), clang::ento::ProgramStatePartialTrait< llvm::ImmutableSet< Key, Info > >::DeleteContext(), clang::ento::ProgramStatePartialTrait< llvm::ImmutableList< T > >::DeleteContext(), clang::ento::BlockCounter::Factory::Factory(), GetFactory(), clang::AttributePool::getFactory(), clang::ento::ProgramStatePartialTrait< llvm::ImmutableMap< Key, Data, Info > >::MakeContext(), clang::ento::ProgramStatePartialTrait< llvm::ImmutableSet< Key, Info > >::MakeContext(), clang::ento::ProgramStatePartialTrait< llvm::ImmutableList< T > >::MakeContext(), removeRefBinding(), and clang::ento::BlockCounter::Factory::~Factory().