本文整理汇总了C++中QualifiedType::append_annote方法的典型用法代码示例。如果您正苦于以下问题:C++ QualifiedType::append_annote方法的具体用法?C++ QualifiedType::append_annote怎么用?C++ QualifiedType::append_annote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QualifiedType
的用法示例。
在下文中一共展示了QualifiedType::append_annote方法的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: ConstructSystemSymbols
void ExportPass::ConstructSystemSymbols()
{
ProcedureSymbol* originalSymbol = originalProcedure->get_procedure_symbol() ;
assert(originalSymbol != NULL) ;
CProcedureType* originalType =
dynamic_cast<CProcedureType*>(originalSymbol->get_type()) ;
assert(originalType != NULL) ;
constructedType = create_c_procedure_type(theEnv,
dynamic_cast<DataType*>(originalType->get_result_type()->deep_clone()),
false, // has variable arguments
false, // arguments known
0) ; // bit alignment
// The system has been written in one of two ways, either the old
// way where there are no arguments, or the new way where everything
// is put into the arguments.
if (originalType->get_argument_count() > 0)
{
for (int i = 0 ; i < originalType->get_argument_count() ; ++i)
{
QualifiedType* originalArgument = originalType->get_argument(i) ;
DataType* originalBase = originalArgument->get_base_type() ;
DataType* constructedBase = CloneDataType(originalBase) ;
QualifiedType* constructedArgument =
create_qualified_type(theEnv, constructedBase) ;
constructedType->append_argument(constructedArgument) ;
// Go through the symbol table and find the parameter symbol
// that matches the parameter number, and check to see if it
// is an output or not...
SymbolTable* symTab = originalProcedure->get_symbol_table() ;
ParameterSymbol* correspondingSymbol = NULL ;
for (int j = 0 ; j < symTab->get_symbol_table_object_count() ; ++j)
{
ParameterSymbol* currentSym =
dynamic_cast<ParameterSymbol*>(symTab->get_symbol_table_object(j)) ;
if (currentSym != NULL)
{
BrickAnnote* orderAnnote = dynamic_cast<BrickAnnote*>(currentSym->lookup_annote_by_name("ParameterOrder")) ;
assert(orderAnnote != NULL) ;
IntegerBrick* orderBrick =
dynamic_cast<IntegerBrick*>(orderAnnote->get_brick(0)) ;
assert(orderBrick != NULL) ;
if (orderBrick->get_value().c_int() == i)
{
correspondingSymbol = currentSym ;
break ;
}
}
}
if (correspondingSymbol != NULL)
{
if (correspondingSymbol->lookup_annote_by_name("OutputScalar") != NULL ||
correspondingSymbol->lookup_annote_by_name("OutputVariable") != NULL ||
correspondingSymbol->lookup_annote_by_name("OutputFifo") != NULL)
{
constructedArgument->append_annote(create_brick_annote(theEnv,
"Output")) ;
}
}
// if (dynamic_cast<ReferenceType*>(originalBase) != NULL)
//{
// constructedArgument->append_annote(create_brick_annote(theEnv,
// "Output")) ;
// }
}
}
else
{
SymbolTable* symTab = originalProcedure->get_symbol_table() ;
assert(symTab != NULL) ;
list<VariableSymbol*> inputScalars ;
list<VariableSymbol*> inputFifos ;
list<VariableSymbol*> outputScalars ;
list<VariableSymbol*> outputFifos ;
for (int i = 0 ; i < symTab->get_symbol_table_object_count() ; ++i)
{
VariableSymbol* currentVar =
dynamic_cast<VariableSymbol*>(symTab->get_symbol_table_object(i)) ;
if (currentVar != NULL &&
currentVar->lookup_annote_by_name("InputScalar") != NULL &&
currentVar->lookup_annote_by_name("TemporalFeedback") == NULL &&
currentVar->lookup_annote_by_name("NormalFeedback") == NULL &&
currentVar->lookup_annote_by_name("DebugRegister") == NULL)
{
inputScalars.push_back(currentVar) ;
}
if (currentVar != NULL &&
currentVar->lookup_annote_by_name("InputFifo") != NULL)
{
inputFifos.push_back(currentVar) ;
}
if (currentVar != NULL &&
currentVar->lookup_annote_by_name("OutputVariable") != NULL &&
currentVar->lookup_annote_by_name("Dummy") == NULL &&
currentVar->lookup_annote_by_name("FeedbackSource") == NULL)
{
//.........这里部分代码省略.........