clang-metatool
A framework for reusing code in clang tools
Public Member Functions | List of all members
clangmetatool::propagation::ConstantCStringPropagator Class Reference

#include <clangmetatool/propagation/constant_cstring_propagator.h>

Public Member Functions

 ConstantCStringPropagator (const clang::CompilerInstance *ci)
 
 ~ConstantCStringPropagator ()
 
PropagationResult< std::string > runPropagation (const clang::FunctionDecl *function, const clang::DeclRefExpr *variable)
 
void dump (std::ostream &stream) const
 

Detailed Description

ConstantCStringPropagator is a tool to run a propagation over the string variables that are used within functions and attempt to determine the string values of those variables.

The analysis runs once per function even if runPropagation is called multiple times.

It is also important to note that this analysis assumes that all loops will only be be run through the first time and effectively ignores any changes that may be made from reentering a block from the loop.

Definition at line 40 of file constant_cstring_propagator.h.

Constructor & Destructor Documentation

◆ ConstantCStringPropagator()

clangmetatool::propagation::ConstantCStringPropagator::ConstantCStringPropagator ( const clang::CompilerInstance *  ci)

Explicit constructor to allow for implementation details.

  • ci is a pointer to an instance of the clang compiler

◆ ~ConstantCStringPropagator()

clangmetatool::propagation::ConstantCStringPropagator::~ConstantCStringPropagator ( )

Explicit destructor.

Member Function Documentation

◆ dump()

void clangmetatool::propagation::ConstantCStringPropagator::dump ( std::ostream &  stream) const

Print out the variable contexts for all the functions that have been propagated.

◆ runPropagation()

PropagationResult<std::string> clangmetatool::propagation::ConstantCStringPropagator::runPropagation ( const clang::FunctionDecl *  function,
const clang::DeclRefExpr *  variable 
)

Given the surrounding function and the usage of a char* holding variable, attempt to determine the value held by that variable.

PropagationResult will return true for a call to isUnresolved() if a deterministic value cannot be determined for the variable.


The documentation for this class was generated from the following file: