Esempio n. 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);
        }
    }
}
Esempio n. 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;
}
Esempio n. 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;
    }
Esempio n. 6
0
 virtual void HandleTranslationUnit(clang::ASTContext &Context)
 {
    Visitor.TraverseDecl(Context.getTranslationUnitDecl());
 }
Esempio n. 7
0
 void HandleTranslationUnit(clang::ASTContext& ctx) {
    MyASTVisitor visitor(ctx.getSourceManager(), _db);
    visitor.TraverseDecl(ctx.getTranslationUnitDecl());
 }
Esempio n. 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() );
   }
Esempio n. 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());
		}
Esempio n. 11
0
void MyConsumer::HandleTranslationUnit(clang::ASTContext &Context) {
	visitor->manager = &Context.getSourceManager();
	visitor->TraverseDecl(Context.getTranslationUnitDecl());
	visitor->print_types();
}
Esempio n. 12
0
 virtual void HandleTranslationUnit (clang::ASTContext &Context) override
 {
   assert(0 == Context.getDiagnostics().hasFatalErrorOccurred());
   _visitor.TraverseDecl(Context.getTranslationUnitDecl());
 }