本文整理汇总了C++中SgVariableDeclaration::set_startOfConstruct方法的典型用法代码示例。如果您正苦于以下问题:C++ SgVariableDeclaration::set_startOfConstruct方法的具体用法?C++ SgVariableDeclaration::set_startOfConstruct怎么用?C++ SgVariableDeclaration::set_startOfConstruct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgVariableDeclaration
的用法示例。
在下文中一共展示了SgVariableDeclaration::set_startOfConstruct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rand
DoxygenFile::DoxygenFile(SgProject *prj, string filename)
{
Sg_File_Info *info = new Sg_File_Info(filename, 0, 0);
SgInitializedName *iname = new SgInitializedName;
stringstream sname;
sname << "SAGE_Doxygen_Dummy_" << rand();
iname->set_name(sname.str());
iname->set_type(new SgTypeInt);
iname->set_file_info(info);
iname->get_storageModifier().setExtern();
SgVariableDeclaration *decl = new SgVariableDeclaration;
decl->get_variables().push_back(iname);
decl->set_startOfConstruct(info);
decl->set_endOfConstruct(info);
decl->get_declarationModifier().get_storageModifier().setExtern();
iname->set_parent(decl);
iname->set_prev_decl_item(iname);
// SgGlobal *glob = prj->get_file(0).get_globalScope();
SgSourceFile* sourceFile = isSgSourceFile(prj->get_fileList()[0]);
ROSE_ASSERT(sourceFile != NULL);
SgGlobal *glob = sourceFile->get_globalScope();
// glob->insertStatementInScope(decl, true);
glob->get_declarations().insert(glob->get_declarations().begin(),decl);
decl->set_parent(glob);
SgVariableSymbol* variableSymbol = new SgVariableSymbol(iname);
glob->insert_symbol(sname.str(),variableSymbol);
decl->set_parent(glob);
std::cout << "Before complete string." << std::endl;
//glob->append_declaration(decl);
iname->set_scope(glob);
decl->unparseToCompleteString();
std::cout << "After complete string." << std::endl;
commentParent = decl;
printf("commentParent = %p\n", commentParent);
}