llvm/clang/lib/Analysis/LiveVariables.cpp

//=- LiveVariables.cpp - Live Variable Analysis for Source CFGs ----------*-==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements Live Variables analysis for source-level CFGs.
//
//===----------------------------------------------------------------------===//

#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 {};
} // namespace

static LiveVariablesImpl &getImpl(void *x) {}

//===----------------------------------------------------------------------===//
// Operations and queries on LivenessValues.
//===----------------------------------------------------------------------===//

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) {}
} // namespace

void LiveVariables::Observer::anchor() {}

LiveVariables::LivenessValues
LiveVariablesImpl::merge(LiveVariables::LivenessValues valsA,
                         LiveVariables::LivenessValues valsB) {}

bool LiveVariables::LivenessValues::equals(const LivenessValues &V) const {}

//===----------------------------------------------------------------------===//
// Query methods.
//===----------------------------------------------------------------------===//

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) {}

//===----------------------------------------------------------------------===//
// Dataflow computation.
//===----------------------------------------------------------------------===//

namespace {
class TransferFunctions : public StmtVisitor<TransferFunctions> {};
} // namespace

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) {}

/// Add as a live expression all individual conditions in a logical expression.
/// For example, for the expression:
/// "(a < b) || (c && d && ((e || f) != (g && h)))"
/// the following expressions will be added as live:
/// "a < b", "c", "d", "((e || f) != (g && h))"
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() {}