LLDB mainline
Classes | Functions
lldb_private::postfix Namespace Reference

Classes

class  BinaryOpNode
 A node representing a binary expression. More...
 
class  InitialValueNode
 A node representing the canonical frame address. More...
 
class  IntegerNode
 A node representing an integer literal. More...
 
class  Node
 The base class for all nodes in the parsed postfix tree. More...
 
class  RegisterNode
 A node representing the value of a register with the given register number. More...
 
class  SymbolNode
 A node representing a symbolic reference to a named entity. More...
 
class  UnaryOpNode
 A node representing a unary operation. More...
 
class  Visitor
 A template class implementing a visitor pattern, but with a couple of twists: More...
 

Functions

bool ResolveSymbols (Node *&node, llvm::function_ref< Node *(SymbolNode &symbol)> replacer)
 A utility function for "resolving" SymbolNodes.
 
template<typename T , typename... Args>
T * MakeNode (llvm::BumpPtrAllocator &alloc, Args &&... args)
 
NodeParseOneExpression (llvm::StringRef expr, llvm::BumpPtrAllocator &alloc)
 Parse the given postfix expression.
 
std::vector< std::pair< llvm::StringRef, Node * > > ParseFPOProgram (llvm::StringRef prog, llvm::BumpPtrAllocator &alloc)
 
void ToDWARF (Node &node, Stream &stream)
 Serialize the given expression tree as DWARF.
 

Function Documentation

◆ MakeNode()

template<typename T , typename... Args>
T * lldb_private::postfix::MakeNode ( llvm::BumpPtrAllocator &  alloc,
Args &&...  args 
)
inline

Definition at line 207 of file PostfixExpression.h.

◆ ParseFPOProgram()

std::vector< std::pair< llvm::StringRef, Node * > > lldb_private::postfix::ParseFPOProgram ( llvm::StringRef  prog,
llvm::BumpPtrAllocator &  alloc 
)

◆ ParseOneExpression()

Node * lldb_private::postfix::ParseOneExpression ( llvm::StringRef  expr,
llvm::BumpPtrAllocator &  alloc 
)

Parse the given postfix expression.

The parsed nodes are placed into the provided allocator.

Definition at line 46 of file PostfixExpression.cpp.

References GetBinaryOpType(), and GetUnaryOpType().

Referenced by lldb_private::breakpad::SymbolFileBreakpad::ParseCFIUnwindRow(), and ParseFPOProgram().

◆ ResolveSymbols()

bool lldb_private::postfix::ResolveSymbols ( Node *&  node,
llvm::function_ref< Node *(SymbolNode &symbol)>  replacer 
)

A utility function for "resolving" SymbolNodes.

It traverses a tree and calls the callback function for all SymbolNodes it encountered. The replacement function should return the node it wished to replace the current SymbolNode with (this can also be the original node), or nullptr in case of an error. The nodes returned by the callback are inspected and replaced recursively, except for the case when the function returns the exact same node as the input one. It returns true if all SymbolNodes were replaced successfully.

Referenced by lldb_private::breakpad::SymbolFileBreakpad::ParseCFIUnwindRow(), lldb_private::breakpad::SymbolFileBreakpad::ParseWinUnwindPlan(), and ResolveFPOProgram().

◆ ToDWARF()

void lldb_private::postfix::ToDWARF ( Node node,
Stream stream 
)

Serialize the given expression tree as DWARF.

The result is written into the given stream. The AST should not contain any SymbolNodes. If the expression contains InitialValueNodes, the generated expression will assume that their value will be provided as the top value of the initial evaluation stack (as is the case with the CFA value in register eh_unwind rules).

Definition at line 247 of file PostfixExpression.cpp.

Referenced by lldb_private::npdb::TranslateFPOProgramToDWARFExpression().