14#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_UNINITIALIZEDVALUES_H
15#define LLVM_CLANG_ANALYSIS_ANALYSES_UNINITIALIZEDVALUES_H
18#include "llvm/ADT/SmallVector.h"
22class AnalysisDeclContext;
42 bool UninitAfterCall =
false;
45 bool UninitAfterDecl =
false;
56 : User(User), AlwaysUninit(AlwaysUninit) {}
59 UninitBranches.push_back(B);
90 return AlwaysUninit ?
Always :
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
AnalysisDeclContext contains the context data for the function, method or block under analysis.
Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
This represents one expression.
Stmt - This represents one statement.
A use of a variable, which might be uninitialized.
const Expr * getUser() const
Get the expression containing the uninitialized use.
UninitUse(const Expr *User, bool AlwaysUninit)
SmallVectorImpl< Branch >::const_iterator branch_iterator
bool branch_empty() const
branch_iterator branch_end() const
void setUninitAfterCall()
void addUninitBranch(Branch B)
void setUninitAfterDecl()
branch_iterator branch_begin() const
Branches which inevitably result in the variable being used uninitialized.
Kind
The kind of uninitialized use.
@ Always
The use is always uninitialized.
@ AfterDecl
The use is uninitialized the first time it is reached after we reach the variable's declaration.
@ Maybe
The use might be uninitialized.
@ AfterCall
The use is uninitialized the first time it is reached after the function is called.
@ Sometimes
The use is uninitialized whenever a certain branch is taken.
Kind getKind() const
Get the kind of uninitialized use.
UninitVariablesHandler()=default
virtual void handleUseOfUninitVariable(const VarDecl *vd, const UninitUse &use)
Called when the uninitialized variable is used at the given expression.
virtual void handleSelfInit(const VarDecl *vd)
Called when the uninitialized variable analysis detects the idiom 'int x = x'.
virtual ~UninitVariablesHandler()
virtual void handleConstRefUseOfUninitVariable(const VarDecl *vd, const UninitUse &use)
Called when the uninitialized variable is used as const refernce argument.
Represents a variable declaration or definition.
The JSON file list parser is used to communicate input to InstallAPI.
void runUninitializedVariablesAnalysis(const DeclContext &dc, const CFG &cfg, AnalysisDeclContext &ac, UninitVariablesHandler &handler, UninitVariablesAnalysisStats &stats)
unsigned NumVariablesAnalyzed