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

    MyDeclVisitor(out, _astinfo).Visit(translationUnit);
  }
예제 #2
0
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());
 }