Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::SymbolsUtil Class Reference

Utility class to manipulate c++/IR symbols, mangling and demangling names. More...

#include <symbols-util.h>

Collaboration diagram for impala::SymbolsUtil:

Static Public Member Functions

static bool IsMangled (const std::string &symbol)
 Returns true if this symbol is mangled. More...
 
static std::string Demangle (const std::string &name)
 
static std::string DemangleNameOnly (const std::string &symbol)
 
static std::string MangleUserFunction (const std::string &fn_name, const std::vector< ColumnType > &arg_types, bool has_var_args=false, ColumnType *ret_argument=NULL)
 
static std::string ManglePrepareOrCloseFunction (const std::string &fn_name)
 

Detailed Description

Utility class to manipulate c++/IR symbols, mangling and demangling names.

Definition at line 24 of file symbols-util.h.

Member Function Documentation

string SymbolsUtil::Demangle ( const std::string &  name)
static

Returns the demangled string. The name is assumed to be a mangled string using the gcc/llvm convention. Returns the empty string if the name is not valid.

Definition at line 57 of file symbols-util.cc.

Referenced by DemangleNameOnly(), impala::TestDemangling(), impala::TestMangling(), and impala::TestManglingPrepareOrClose().

string SymbolsUtil::DemangleNameOnly ( const std::string &  symbol)
static

Returns the function name of the demangled symbol (i.e., it strips the arguments and any namespace/class qualifiers). Returns the empty string if the name is not valid.

Definition at line 66 of file symbols-util.cc.

References Demangle(), and gen_ir_descriptions::fn_name.

Referenced by impala::ScalarFnCall::GetCodegendComputeFn(), and impala::TestDemanglingNameOnly().

bool SymbolsUtil::IsMangled ( const std::string &  symbol)
static

Returns true if this symbol is mangled.

Definition at line 53 of file symbols-util.cc.

References MANGLE_PREFIX.

Referenced by ResolveSymbolLookup().

string SymbolsUtil::ManglePrepareOrCloseFunction ( const std::string &  fn_name)
static
string SymbolsUtil::MangleUserFunction ( const std::string &  fn_name,
const std::vector< ColumnType > &  arg_types,
bool  has_var_args = false,
ColumnType ret_argument = NULL 
)
static

Mangles fn_name with 'arg_types' to the function signature for user functions. This maps types to AnyVal* and automatically adds the FunctionContext* as the first argument. The fn_name must be fully qualified. i.e namespace::class::fn. if 'has_var_args' is true, the last argument in arg_types can be variable. if 'ret_argument' is non-null, it is added as a last return argument. TODO: this is not a general mangling function and that is more difficult to do. Find a library to do this. There is no place we require this to be perfect, if we can't do this right, the user will need to specify the full mangled string.

Definition at line 154 of file symbols-util.cc.

References AppendAnyValType(), AppendMangledToken(), AppendSeqId(), MANGLE_PREFIX, and impala::ColumnType::type.

Referenced by ResolveSymbolLookup(), and impala::TestMangling().


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