本文整理汇总了C++中StructType::get_group_symbol_table方法的典型用法代码示例。如果您正苦于以下问题:C++ StructType::get_group_symbol_table方法的具体用法?C++ StructType::get_group_symbol_table怎么用?C++ StructType::get_group_symbol_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StructType
的用法示例。
在下文中一共展示了StructType::get_group_symbol_table方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConstructModuleSymbols
void ExportPass::ConstructModuleSymbols()
{
CProcedureType* originalType = dynamic_cast<CProcedureType*>(originalProcedure->get_procedure_symbol()->get_type()) ;
assert(originalType != NULL) ;
// The original type takes and returns a struct. We need to change this
// to a list of arguments.
VoidType* newReturnType = create_void_type(theEnv, IInteger(0), 0) ;
constructedType = create_c_procedure_type(theEnv,
newReturnType,
false, // has varargs
true, // arguments_known
0, // bit alignment
LString("ConstructedType")) ;
StructType* returnType =
dynamic_cast<StructType*>(originalType->get_result_type()) ;
assert(returnType != NULL) ;
SymbolTable* structSymTab = returnType->get_group_symbol_table() ;
assert(structSymTab != NULL) ;
for (int i = 0 ; i < structSymTab->get_symbol_table_object_count() ; ++i)
{
VariableSymbol* nextVariable =
dynamic_cast<VariableSymbol*>(structSymTab->get_symbol_table_object(i));
if (nextVariable != NULL)
{
// Check to see if this is an output or not
QualifiedType* cloneType ;
DataType* cloneBase =
dynamic_cast<DataType*>(nextVariable->get_type()->get_base_type()->deep_clone()) ;
assert(cloneBase != NULL) ;
cloneType = create_qualified_type(theEnv, cloneBase) ;
if (nextVariable->lookup_annote_by_name("Output") != NULL)
{
cloneType->append_annote(create_brick_annote(theEnv, "Output")) ;
// Why doesn't this stick around?
}
constructedType->append_argument(cloneType) ;
}
}
constructedSymbol = create_procedure_symbol(theEnv,
constructedType,
originalProcedure->get_procedure_symbol()->get_name()) ;
constructedSymbol->set_definition(NULL) ;
}
示例2: if
void CopyPropagationPass2::CollectVariables()
{
assert(procDef != NULL) ;
if (killMap.empty() == false)
{
ClearMap() ;
}
assert(killMap.empty() == true) ;
assert(procDef != NULL) ;
SymbolTable* symTab = procDef->get_symbol_table() ;
Iter<SymbolTableObject*> symIter =
symTab->get_symbol_table_object_iterator() ;
while (symIter.is_valid())
{
if (is_a<VariableSymbol>(symIter.current()))
{
// For each variable symbol, create a new list of statement/int pairs
// and add that to the kill map
list<std::pair<Statement*, int> >* assocList =
new list<std::pair<Statement*, int> > ;
killMap[to<VariableSymbol>(symIter.current())] = assocList ;
}
else if (is_a<ParameterSymbol>(symIter.current()))
{
// If we are compiling a module, we also have to find the argument
// (which should be a struct) and collect all of those variable
// symbols..
ParameterSymbol* nextParm =
dynamic_cast<ParameterSymbol*>(symIter.current()) ;
assert(nextParm != NULL) ;
// Now check that we have a struct type
DataType* parmType = nextParm->get_type()->get_base_type() ;
StructType* parmStructType =
dynamic_cast<StructType*>(parmType) ;
if (parmStructType == NULL)
{
list<std::pair<Statement*, int> >* assocList =
new list<std::pair<Statement*, int> > ;
killMap[dynamic_cast<VariableSymbol*>(symIter.current())] = assocList ;
symIter.next() ;
continue ;
}
// Go through this symbol table, just like the parent table...
SymbolTable* structSymTab = parmStructType->get_group_symbol_table() ;
Iter<SymbolTableObject*> structSymIter =
structSymTab->get_symbol_table_object_iterator() ;
while (structSymIter.is_valid())
{
// These should all be variable symbols!
if (is_a<FieldSymbol>(structSymIter.current()))
{
// For each variable symbol, create a new list of statement/int pairs
// and add that to the killMap.
list<std::pair<Statement*, int> >* assocList =
new list<std::pair<Statement*, int> > ;
killMap[to<VariableSymbol>(structSymIter.current())] = assocList ;
}
else
{
std::cerr << "Non variable symbol inside a struct!" << std::endl ;
assert(0) ;
}
structSymIter.next() ;
}
}
symIter.next() ;
}
}