class LocationContext

Declaration

class LocationContext : public Node { /* full declaration omitted */ };

Description

It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext and inside the function calls the BlockInvocationContext. It is needed for context sensitive analysis to model entering, leaving or inlining function calls.

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:215

Inherits from: FoldingSetBase::Node

Member Variables

private clang::LocationContext::ContextKind Kind
private clang::AnalysisDeclContext* Ctx
private const clang::LocationContext* Parent
private int64_t ID

Method Overview

  • protected LocationContext(clang::LocationContext::ContextKind k, clang::AnalysisDeclContext * ctx, const clang::LocationContext * parent, int64_t ID)
  • public virtual void Profile(llvm::FoldingSetNodeID & ID)
  • public static void ProfileCommon(llvm::FoldingSetNodeID & ID, clang::LocationContext::ContextKind ck, clang::AnalysisDeclContext * ctx, const clang::LocationContext * parent, const void * data)
  • public void dump() const
  • public void dumpStack(llvm::raw_ostream & Out) const
  • public template <typename T>T * getAnalysis() const
  • public clang::AnalysisDeclContext * getAnalysisDeclContext() const
  • public clang::CFG * getCFG() const
  • public const clang::Decl * getDecl() const
  • public int64_t getID() const
  • public clang::LocationContext::ContextKind getKind() const
  • public const clang::LocationContext * getParent() const
  • public const clang::ParentMap & getParentMap() const
  • public const clang::ImplicitParamDecl * getSelfDecl() const
  • public const clang::StackFrameContext * getStackFrame() const
  • public virtual bool inTopFrame() const
  • public bool isParentOf(const clang::LocationContext * LC) const
  • public void printJson(llvm::raw_ostream & Out, const char * NL = "\n", unsigned int Space = 0, bool IsDot = false, std::function<void (const LocationContext *)> printMoreInfoPerContext = [](const clang::LocationContext *) { }) const
  • public virtual ~LocationContext()

Inherited from FoldingSetBase::Node:

Methods

LocationContext(
    clang::LocationContext::ContextKind k,
    clang::AnalysisDeclContext* ctx,
    const clang::LocationContext* parent,
    int64_t ID)

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:230

Parameters

clang::LocationContext::ContextKind k
clang::AnalysisDeclContext* ctx
const clang::LocationContext* parent
int64_t ID

virtual void Profile(llvm::FoldingSetNodeID& ID)

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:267

Parameters

llvm::FoldingSetNodeID& ID

static void ProfileCommon(
    llvm::FoldingSetNodeID& ID,
    clang::LocationContext::ContextKind ck,
    clang::AnalysisDeclContext* ctx,
    const clang::LocationContext* parent,
    const void* data)

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:293

Parameters

llvm::FoldingSetNodeID& ID
clang::LocationContext::ContextKind ck
clang::AnalysisDeclContext* ctx
const clang::LocationContext* parent
const void* data

void dump() const

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:291

void dumpStack(llvm::raw_ostream& Out) const

Description

Prints out the call stack.

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:272

Parameters

llvm::raw_ostream& Out
The out stream.

template <typename T>
T* getAnalysis() const

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:255

Templates

T

clang::AnalysisDeclContext*
getAnalysisDeclContext() const

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:244

clang::CFG* getCFG() const

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:253

const clang::Decl* getDecl() const

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:251

int64_t getID() const

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:241

clang::LocationContext::ContextKind getKind()
    const

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:239

const clang::LocationContext* getParent() const

Description

It might return null.

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:247

const clang::ParentMap& getParentMap() const

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:257

const clang::ImplicitParamDecl* getSelfDecl()
    const

Description

\copydoc AnalysisDeclContext::getSelfDecl()

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:260

const clang::StackFrameContext* getStackFrame()
    const

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:262

virtual bool inTopFrame() const

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:265

Returns

Whether the current LocationContext has no caller context.

bool isParentOf(
    const clang::LocationContext* LC) const

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:249

Parameters

const clang::LocationContext* LC

void printJson(
    llvm::raw_ostream& Out,
    const char* NL = "\n",
    unsigned int Space = 0,
    bool IsDot = false,
    std::function<void(const LocationContext*)>
        printMoreInfoPerContext =
            [](const clang::LocationContext*) {
            }) const

Description

Prints out the call stack in \c json format.

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:285

Parameters

llvm::raw_ostream& Out
The out stream.
const char* NL = "\n"
The newline.
unsigned int Space = 0
The space count for indentation.
bool IsDot = false
Whether the output format is \c dot.
std::function<void(const LocationContext*)> printMoreInfoPerContext = [](const clang::LocationContext *) { }
A callback to print more information for each context, for example:

virtual ~LocationContext()

Declared at: clang/include/clang/Analysis/AnalysisDeclContext.h:237