class VarBypassDetector

Declaration

class VarBypassDetector { /* full declaration omitted */ };

Description

The class detects jumps which bypass local variables declaration: goto L; int a; L: This is simplified version of JumpScopeChecker. Primary differences: * Detects only jumps into the scope local variables. * Does not detect jumps out of the scope of local variables. * Not limited to variables with initializers, JumpScopeChecker is limited.

Declared at: clang/lib/CodeGen/VarBypassDetector.h:39

Member Variables

private llvm::SmallVector< std::pair<unsigned int, const VarDecl*>, 48> Scopes
private llvm::SmallVector< std::pair<const Stmt*, unsigned int>, 16> FromScopes
private llvm::DenseMap<const Stmt*, unsigned int> ToScopes
private llvm::DenseSet<const VarDecl*> Bypasses
private bool AlwaysBypassed = false

Method Overview

  • private bool BuildScopeInformation(const clang::Decl * D, unsigned int & ParentScope)
  • private bool BuildScopeInformation(const clang::Stmt * S, unsigned int & origParentScope)
  • private void Detect()
  • private void Detect(unsigned int From, unsigned int To)
  • public void Init(const clang::Stmt * Body)
  • public bool IsBypassed(const clang::VarDecl * D) const

Methods

bool BuildScopeInformation(
    const clang::Decl* D,
    unsigned int& ParentScope)

Declared at: clang/lib/CodeGen/VarBypassDetector.h:62

Parameters

const clang::Decl* D
unsigned int& ParentScope

bool BuildScopeInformation(
    const clang::Stmt* S,
    unsigned int& origParentScope)

Declared at: clang/lib/CodeGen/VarBypassDetector.h:63

Parameters

const clang::Stmt* S
unsigned int& origParentScope

void Detect()

Declared at: clang/lib/CodeGen/VarBypassDetector.h:64

void Detect(unsigned int From, unsigned int To)

Declared at: clang/lib/CodeGen/VarBypassDetector.h:65

Parameters

unsigned int From
unsigned int To

void Init(const clang::Stmt* Body)

Declared at: clang/lib/CodeGen/VarBypassDetector.h:53

Parameters

const clang::Stmt* Body

bool IsBypassed(const clang::VarDecl* D) const

Description

Returns true if the variable declaration was by bypassed by any goto or switch statement.

Declared at: clang/lib/CodeGen/VarBypassDetector.h:57

Parameters

const clang::VarDecl* D