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


C++ ASTContext::getTranslationUnitDecl方法代码示例

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


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

示例1: HandleTranslationUnit

  virtual void HandleTranslationUnit(clang::ASTContext &ctx)
  {
    llvm::raw_ostream &out = llvm::errs();
    clang::TranslationUnitDecl *translationUnit = ctx.getTranslationUnitDecl();

    MyDeclVisitor(out, _astinfo).Visit(translationUnit);
  }
开发者ID:wkia,项目名称:white-knight-is-alive,代码行数:7,代码来源:testclang.cpp

示例2: checkAndAnalyze

void WebCLConsumer::checkAndAnalyze(clang::ASTContext &context)
{
    clang::TranslationUnitDecl *decl = context.getTranslationUnitDecl();
    for (Visitors::iterator i = visitors_.begin(); i != visitors_.end(); ++i) {
        // There is no point to continue if an error has been reported.
        if (!hasErrors(context)) {
            WebCLVisitor *visitor = (*i);
            visitor->TraverseDecl(decl);
        }
    }
}
开发者ID:ChiahungTai,项目名称:webcl-validator,代码行数:11,代码来源:WebCLConsumer.cpp

示例3: HandleTranslationUnit

    virtual void HandleTranslationUnit(clang::ASTContext& Ctx) override {

       /* if (PP.getDiagnostics().hasErrorOccurred())
            return;*/
        ci.getPreprocessor().getDiagnostics().getClient();


        BrowserASTVisitor v(annotator);
        v.TraverseDecl(Ctx.getTranslationUnitDecl());


        annotator.generate(ci.getSema(), WasInDatabase);
    }
开发者ID:antmd,项目名称:woboq_codebrowser,代码行数:13,代码来源:main.cpp

示例4: HandleTranslationUnit

void ReplaceArrayAccessWithIndex::HandleTranslationUnit(clang::ASTContext &Ctx)
{
  TransAssert(Collector && "NULL Collector");
  Collector->TraverseDecl(Ctx.getTranslationUnitDecl());

  if (QueryInstanceOnly)
    return;

  if (TransformationCounter > ValidInstanceNum) {
    TransError = TransMaxInstanceError;
    return;
  }

  Ctx.getDiagnostics().setSuppressAllDiagnostics(false);
  doRewrite();

  if (Ctx.getDiagnostics().hasErrorOccurred() ||
      Ctx.getDiagnostics().hasFatalErrorOccurred())
    TransError = TransInternalError;
}
开发者ID:vgvassilev,项目名称:creduce,代码行数:20,代码来源:ReplaceArrayAccessWithIndex.cpp

示例5: collect

    RangeSet collect(clang::ASTContext &astContext, oclint::RuleBase *rule)
    {
        _rule = rule;
        _sourceManager = &astContext.getSourceManager();
        _range.clear();

        clang::DeclContext *decl = astContext.getTranslationUnitDecl();
        for (clang::DeclContext::decl_iterator declIt = decl->decls_begin(),
            declEnd = decl->decls_end(); declIt != declEnd; ++declIt)
        {
            clang::SourceLocation startLocation = (*declIt)->getLocStart();
            if (startLocation.isValid() &&
                _sourceManager->getMainFileID() == _sourceManager->getFileID(startLocation))
            {
                (void) /* explicitly ignore the return of this function */
                    clang::RecursiveASTVisitor<DeclAnnotationRangeCollector>::TraverseDecl(*declIt);
            }
        }

        return _range;
    }
开发者ID:GeekMin,项目名称:oclint,代码行数:21,代码来源:SuppressHelper.cpp

示例6: HandleTranslationUnit

 virtual void HandleTranslationUnit(clang::ASTContext &Context)
 {
    Visitor.TraverseDecl(Context.getTranslationUnitDecl());
 }
开发者ID:scraimer,项目名称:ast-dump-test1,代码行数:4,代码来源:LoopConvert.cpp

示例7: HandleTranslationUnit

 void HandleTranslationUnit(clang::ASTContext& ctx) {
    MyASTVisitor visitor(ctx.getSourceManager(), _db);
    visitor.TraverseDecl(ctx.getTranslationUnitDecl());
 }
开发者ID:lhh411291769,项目名称:clang_navigate,代码行数:4,代码来源:main.cpp

示例8: HandleTranslationUnit

void ClangToSageTranslator::HandleTranslationUnit(clang::ASTContext & ast_context) {
    Traverse(ast_context.getTranslationUnitDecl());
}
开发者ID:KurSh,项目名称:rose,代码行数:3,代码来源:clang-frontend.cpp

示例9: HandleTranslationUnit

 /**
  * Method called only when the entire file is parsed.
  */
   void HandleTranslationUnit( clang::ASTContext & context ) override
   {
     // Recursively visit the AST.
     myrecvisitor.TraverseDecl( context.getTranslationUnitDecl() );
   }
开发者ID:sjubertie,项目名称:metrics-calculator,代码行数:8,代码来源:MetricsCalculatorASTConsumer.hpp

示例10: HandleTranslationUnit

		virtual void HandleTranslationUnit(clang::ASTContext &Context){
			// Traversing the translation unit decl via a RecursiveASTVisitor
			// will visit all nodes in the AST.
			Visitor.TraverseDecl(Context.getTranslationUnitDecl());
		}
开发者ID:Submitty,项目名称:AnalysisTools,代码行数:5,代码来源:ASTMatcher.cpp

示例11: HandleTranslationUnit

void MyConsumer::HandleTranslationUnit(clang::ASTContext &Context) {
	visitor->manager = &Context.getSourceManager();
	visitor->TraverseDecl(Context.getTranslationUnitDecl());
	visitor->print_types();
}
开发者ID:jpleau,项目名称:vim-cpphl,代码行数:5,代码来源:ast.cpp


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