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

    MyDeclVisitor(out, _astinfo).Visit(translationUnit);
  }
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);
        }
    }
}
示例#3
0
    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);
    }
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;
}
示例#5
0
    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;
    }
示例#6
0
 virtual void HandleTranslationUnit(clang::ASTContext &Context)
 {
    Visitor.TraverseDecl(Context.getTranslationUnitDecl());
 }
示例#7
0
 void HandleTranslationUnit(clang::ASTContext& ctx) {
    MyASTVisitor visitor(ctx.getSourceManager(), _db);
    visitor.TraverseDecl(ctx.getTranslationUnitDecl());
 }
示例#8
0
void ClangToSageTranslator::HandleTranslationUnit(clang::ASTContext & ast_context) {
    Traverse(ast_context.getTranslationUnitDecl());
}
 /**
  * Method called only when the entire file is parsed.
  */
   void HandleTranslationUnit( clang::ASTContext & context ) override
   {
     // Recursively visit the AST.
     myrecvisitor.TraverseDecl( context.getTranslationUnitDecl() );
   }
示例#10
0
		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());
		}
示例#11
0
文件: ast.cpp 项目: jpleau/vim-cpphl
void MyConsumer::HandleTranslationUnit(clang::ASTContext &Context) {
	visitor->manager = &Context.getSourceManager();
	visitor->TraverseDecl(Context.getTranslationUnitDecl());
	visitor->print_types();
}
示例#12
0
 virtual void HandleTranslationUnit (clang::ASTContext &Context) override
 {
   assert(0 == Context.getDiagnostics().hasFatalErrorOccurred());
   _visitor.TraverseDecl(Context.getTranslationUnitDecl());
 }