#include "clang/Analysis/AnalysisDeclContext.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/LambdaCapture.h"
#include "clang/AST/ParentMap.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Analysis/Analyses/CFGReachabilityAnalysis.h"
#include "clang/Analysis/BodyFarm.h"
#include "clang/Analysis/CFG.h"
#include "clang/Analysis/CFGStmtMap.h"
#include "clang/Analysis/Support/BumpVector.h"
#include "clang/Basic/JsonSupport.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <memory>
usingnamespaceclang;
ManagedAnalysisMap;
AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *ADCMgr,
const Decl *D,
const CFG::BuildOptions &Options)
: … { … }
AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *ADCMgr,
const Decl *D)
: … { … }
AnalysisDeclContextManager::AnalysisDeclContextManager(
ASTContext &ASTCtx, bool useUnoptimizedCFG, bool addImplicitDtors,
bool addInitializers, bool addTemporaryDtors, bool addLifetime,
bool addLoopExit, bool addScopes, bool synthesizeBodies,
bool addStaticInitBranch, bool addCXXNewAllocator,
bool addRichCXXConstructors, bool markElidedCXXConstructors,
bool addVirtualBaseBranches, CodeInjector *injector)
: … { … }
void AnalysisDeclContextManager::clear() { … }
Stmt *AnalysisDeclContext::getBody(bool &IsAutosynthesized) const { … }
Stmt *AnalysisDeclContext::getBody() const { … }
bool AnalysisDeclContext::isBodyAutosynthesized() const { … }
bool AnalysisDeclContext::isBodyAutosynthesizedFromModelFile() const { … }
static bool isSelfDecl(const VarDecl *VD) { … }
const ImplicitParamDecl *AnalysisDeclContext::getSelfDecl() const { … }
void AnalysisDeclContext::registerForcedBlockExpression(const Stmt *stmt) { … }
const CFGBlock *
AnalysisDeclContext::getBlockForRegisteredExpression(const Stmt *stmt) { … }
static void addParentsForSyntheticStmts(const CFG *TheCFG, ParentMap &PM) { … }
CFG *AnalysisDeclContext::getCFG() { … }
CFG *AnalysisDeclContext::getUnoptimizedCFG() { … }
CFGStmtMap *AnalysisDeclContext::getCFGStmtMap() { … }
CFGReverseBlockReachabilityAnalysis *AnalysisDeclContext::getCFGReachablityAnalysis() { … }
void AnalysisDeclContext::dumpCFG(bool ShowColors) { … }
ParentMap &AnalysisDeclContext::getParentMap() { … }
AnalysisDeclContext *AnalysisDeclContextManager::getContext(const Decl *D) { … }
BodyFarm &AnalysisDeclContextManager::getBodyFarm() { … }
const StackFrameContext *
AnalysisDeclContext::getStackFrame(const LocationContext *ParentLC,
const Stmt *S, const CFGBlock *Blk,
unsigned BlockCount, unsigned Index) { … }
const BlockInvocationContext *AnalysisDeclContext::getBlockInvocationContext(
const LocationContext *ParentLC, const BlockDecl *BD, const void *Data) { … }
bool AnalysisDeclContext::isInStdNamespace(const Decl *D) { … }
std::string AnalysisDeclContext::getFunctionName(const Decl *D) { … }
LocationContextManager &AnalysisDeclContext::getLocationContextManager() { … }
void LocationContext::ProfileCommon(llvm::FoldingSetNodeID &ID,
ContextKind ck,
AnalysisDeclContext *ctx,
const LocationContext *parent,
const void *data) { … }
void StackFrameContext::Profile(llvm::FoldingSetNodeID &ID) { … }
void BlockInvocationContext::Profile(llvm::FoldingSetNodeID &ID) { … }
const StackFrameContext *LocationContextManager::getStackFrame(
AnalysisDeclContext *ctx, const LocationContext *parent, const Stmt *s,
const CFGBlock *blk, unsigned blockCount, unsigned idx) { … }
const BlockInvocationContext *LocationContextManager::getBlockInvocationContext(
AnalysisDeclContext *ADC, const LocationContext *ParentLC,
const BlockDecl *BD, const void *Data) { … }
const StackFrameContext *LocationContext::getStackFrame() const { … }
bool LocationContext::inTopFrame() const { … }
bool LocationContext::isParentOf(const LocationContext *LC) const { … }
static void printLocation(raw_ostream &Out, const SourceManager &SM,
SourceLocation Loc) { … }
void LocationContext::dumpStack(raw_ostream &Out) const { … }
void LocationContext::printJson(raw_ostream &Out, const char *NL,
unsigned int Space, bool IsDot,
std::function<void(const LocationContext *)>
printMoreInfoPerContext) const { … }
LLVM_DUMP_METHOD void LocationContext::dump() const { … }
namespace {
class FindBlockDeclRefExprsVals : public StmtVisitor<FindBlockDeclRefExprsVals>{ … };
}
DeclVec;
static DeclVec* LazyInitializeReferencedDecls(const BlockDecl *BD,
void *&Vec,
llvm::BumpPtrAllocator &A) { … }
llvm::iterator_range<AnalysisDeclContext::referenced_decls_iterator>
AnalysisDeclContext::getReferencedBlockVars(const BlockDecl *BD) { … }
std::unique_ptr<ManagedAnalysis> &AnalysisDeclContext::getAnalysisImpl(const void *tag) { … }
ManagedAnalysis::~ManagedAnalysis() = default;
AnalysisDeclContext::~AnalysisDeclContext() { … }
LocationContext::~LocationContext() = default;
LocationContextManager::~LocationContextManager() { … }
void LocationContextManager::clear() { … }