当前位置: 首页>>代码示例>>C++>>正文


C++ SgProject::set_file方法代码示例

本文整理汇总了C++中SgProject::set_file方法的典型用法代码示例。如果您正苦于以下问题:C++ SgProject::set_file方法的具体用法?C++ SgProject::set_file怎么用?C++ SgProject::set_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SgProject的用法示例。


在下文中一共展示了SgProject::set_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: printf

SgSourceFile*
FortranModuleInfo::createSgSourceFile(string modName)
   {
     int errorCode = 0;
     vector<string> argv;

  // DQ (11/12/2008): Modified to force filename to lower case.
#if 0
     printf ("In FortranModuleInfo::createSgSourceFile(): generating a module file %s using module name = %s \n",StringUtility::convertToLowerCase(modName).c_str(),modName.c_str());
#endif
  // modName = StringUtility::convertToLowerCase(modName);

  // current directory
     string rmodFileName = modName + MOD_FILE_SUFFIX;

#if 0
     printf ("In FortranModuleInfo::createSgSourceFile(): Searching for file rmodFileName = %s \n",rmodFileName.c_str());
     printf ("In FortranModuleInfo::createSgSourceFile(): boost::filesystem::exists(rmodFileName.c_str()) = %s \n",boost::filesystem::exists(rmodFileName.c_str()) ? "true" : "false");
#endif

     if (boost::filesystem::exists(rmodFileName.c_str()) == false)
        {
          printf ("File rmodFileName = %s NOT FOUND (expected to be present) \n",rmodFileName.c_str());
          return NULL;
        }

     argv.push_back(SKIP_SYNTAX_CHECK);
     argv.push_back(rmodFileName);

     nestedSgFile++;

     if (SgProject::get_verbose() > 1)
          printf ("START FortranModuleInfo::createSgSourceFile(%s): nestedSgFile = %d \n",rmodFileName.c_str(),nestedSgFile);

     SgProject*  project = getCurrentProject();

     SgSourceFile* newFile = isSgSourceFile(determineFileType(argv,errorCode,project));
  // SgSourceFile* newFile =  new SgSourceFile (argv, errorCode, 0, project);
     ROSE_ASSERT(newFile != NULL);

#if 0
     printf ("In FortranModuleInfo::createSgSourceFile(): Calling the fronend explicitly! \n");
#endif

   // DQ (6/13/2013): Since we seperated the construction of the SgFile IR nodes from the invocation of the frontend, we have to call the frontend explicitly.
     newFile->runFrontend(errorCode);

  // DQ (6/13/2013): At least report that the error code is not checked, this is just something that I noticed but don't want to modify just now.
  // I guess that the point is that it should compile since the module compiled previously, but it should still be enforced to be zero.
     if (errorCode != 0)
        {
          printf ("In FortranModuleInfo::createSgSourceFile(): errorCode != 0 is not checked \n");
          ROSE_ASSERT(errorCode == 0);
        }

     ROSE_ASSERT (newFile != NULL);
     ROSE_ASSERT (newFile->get_startOfConstruct() != NULL);

  // Set the project as the  parent 
     newFile->set_parent(project);

  // DQ (11/12/2008): This rmod file should be explicitly marked to not be compiled.
  // printf ("Marking the new module file to not be compiled \n");
     newFile->set_skipfinalCompileStep(true);
     newFile->set_skip_unparse(true);

     project->set_file(*newFile);

     if (SgProject::get_verbose() > 1)
          printf ("END FortranModuleInfo::createSgSourceFile(%s): nestedSgFile = %d \n",rmodFileName.c_str(),nestedSgFile);

     nestedSgFile--;

     return newFile;
   }
开发者ID:KurSh,项目名称:rose,代码行数:75,代码来源:FortranModuleInfo.C

示例2: printf


//.........这里部分代码省略.........
          SgProject* temp_project = ast->getRootOfAst();
       // ROSE_ASSERT(temp_project->numberOfFiles() == 1);
          ROSE_ASSERT(temp_project->numberOfDirectories() == 0);
          SgFile* temp_file = (*temp_project)[0];
          printf ("temp_file->get_filename() = %s \n",temp_file->getFileName().c_str());

       // DQ (6/5/2010): Turn on to support debugging...
       // DQ (2/24/2010): This is a significant bottleneck to the performance on large codes since it is n^2 in the size of the AST.
       // AstTests::runAllTests(ast->getRootOfAst());

          printf ("DONE with call to AstTests::runAllTests() \n");
#endif
#if 0
       // To read and merge the separate AST files, we don't have to call the backend.
          backend(ast->getRootOfAst());
#endif

       // printf ("globalProject = %p \n",globalProject);

          if (globalProject == NULL)
             {
               globalProject = ast->getRootOfAst();
               ROSE_ASSERT(globalProject->get_freepointer() == AST_FileIO::IS_VALID_POINTER());
             }
            else
             {
               SgProject* localProject = ast->getRootOfAst();
               SgFile*    localFile    = (*localProject)[0];

            // DQ (3/1/2010): Merged files that are reread will have more than one SgFile object.
            // ROSE_ASSERT(localProject->numberOfFiles() == 1);

            // Add the file to the global project. This also sets the parent of the input file. Is this a side-effect that we want?
               globalProject->set_file(*localFile);
#if 0
               printf ("globalProject = %p numberOfFiles() = %d \n",globalProject,globalProject->numberOfFiles());
#endif
               ROSE_ASSERT(globalProject->get_freepointer() == AST_FileIO::IS_VALID_POINTER());
//             delete localProject;
             }
        }

     printf ("Size of AST = %zu (globalProject = %p)\n",numberOfNodes(),globalProject);

#if 0
     for (int i= 0; i < numFiles; ++i)
        {
          AstFileInfoArray[i]->display("static AST file information");
        }
#endif

#if 0
  // DQ (3/7/2010): It may be that we have to process the merged static data before we can expect 
  // to pass this test.
  // DQ (2/24/2010): Better to run this once at the end to avoid a significant bottleneck to the 
  // performance on large codes (it is n^2 in the size of the AST if run for each file separately).
     //AstTests::runAllTests(ast->getRootOfAst());
#endif

  // Merge the function tables from each AST.
  // SgFunctionTypeTable* globalFunctionTypeTable = mergeFunctionTypeSymbolTables (functionTableArray);
  // ROSE_ASSERT(globalFunctionTypeTable != NULL);

  // It is required to merge the static information in the AST, to get a valid AST, even if no other merging is done.
     printf ("\n\nCalling mergeStaticASTFileInformation() \n");
     mergeStaticASTFileInformation(AstFileInfoArray);
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:67,代码来源:testAstFileRead.C


注:本文中的SgProject::set_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。