#include "clang/Analysis/Analyses/LiveVariables.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Analysis/AnalysisDeclContext.h"
#include "clang/Analysis/CFG.h"
#include "clang/Analysis/FlowSensitive/DataflowWorklist.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <optional>
#include <vector>
usingnamespaceclang;
namespace {
class LiveVariablesImpl { … };
}
static LiveVariablesImpl &getImpl(void *x) { … }
bool LiveVariables::LivenessValues::isLive(const Expr *E) const { … }
bool LiveVariables::LivenessValues::isLive(const VarDecl *D) const { … }
namespace {
template <typename SET>
SET mergeSets(SET A, SET B) { … }
}
void LiveVariables::Observer::anchor() { … }
LiveVariables::LivenessValues
LiveVariablesImpl::merge(LiveVariables::LivenessValues valsA,
LiveVariables::LivenessValues valsB) { … }
bool LiveVariables::LivenessValues::equals(const LivenessValues &V) const { … }
static bool isAlwaysAlive(const VarDecl *D) { … }
bool LiveVariables::isLive(const CFGBlock *B, const VarDecl *D) { … }
bool LiveVariables::isLive(const Stmt *S, const VarDecl *D) { … }
bool LiveVariables::isLive(const Stmt *Loc, const Expr *Val) { … }
namespace {
class TransferFunctions : public StmtVisitor<TransferFunctions> { … };
}
static const VariableArrayType *FindVA(QualType Ty) { … }
static const Expr *LookThroughExpr(const Expr *E) { … }
static void AddLiveExpr(llvm::ImmutableSet<const Expr *> &Set,
llvm::ImmutableSet<const Expr *>::Factory &F,
const Expr *E) { … }
static void AddAllConditionalTerms(llvm::ImmutableSet<const Expr *> &Set,
llvm::ImmutableSet<const Expr *>::Factory &F,
const Expr *Cond) { … }
void TransferFunctions::Visit(Stmt *S) { … }
static bool writeShouldKill(const VarDecl *VD) { … }
void TransferFunctions::VisitBinaryOperator(BinaryOperator *B) { … }
void TransferFunctions::VisitBlockExpr(BlockExpr *BE) { … }
void TransferFunctions::VisitDeclRefExpr(DeclRefExpr *DR) { … }
void TransferFunctions::VisitDeclStmt(DeclStmt *DS) { … }
void TransferFunctions::VisitObjCForCollectionStmt(ObjCForCollectionStmt *OS) { … }
void TransferFunctions::
VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *UE)
{ … }
void TransferFunctions::VisitUnaryOperator(UnaryOperator *UO) { … }
LiveVariables::LivenessValues
LiveVariablesImpl::runOnBlock(const CFGBlock *block,
LiveVariables::LivenessValues val,
LiveVariables::Observer *obs) { … }
void LiveVariables::runOnAllBlocks(LiveVariables::Observer &obs) { … }
LiveVariables::LiveVariables(void *im) : … { … }
LiveVariables::~LiveVariables() { … }
std::unique_ptr<LiveVariables>
LiveVariables::computeLiveness(AnalysisDeclContext &AC, bool killAtAssign) { … }
void LiveVariables::dumpBlockLiveness(const SourceManager &M) { … }
void LiveVariablesImpl::dumpBlockLiveness(const SourceManager &M) { … }
void LiveVariables::dumpExprLiveness(const SourceManager &M) { … }
void LiveVariablesImpl::dumpExprLiveness(const SourceManager &M) { … }
const void *LiveVariables::getTag() { … }
const void *RelaxedLiveVariables::getTag() { … }