blob: 6995969fdf9709a74723d1a3f0c739a5f49079d1 [file] [log] [blame]
Douglas Gregorf78cc432010-05-07 15:41:56 +00001//===-- BoostConAction.cpp - BoostCon Workshop Action -----------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9#include "clang/Frontend/FrontendActions.h"
10#include "clang/AST/ASTConsumer.h"
Douglas Gregord30bf2e2010-05-07 22:11:34 +000011#include "clang/AST/RecursiveASTVisitor.h"
Douglas Gregorffb507a2010-05-07 15:59:09 +000012#include <cstdio>
Douglas Gregorf78cc432010-05-07 15:41:56 +000013using namespace clang;
14
15namespace {
Douglas Gregord30bf2e2010-05-07 22:11:34 +000016 class BoostConASTConsumer : public ASTConsumer,
17 public RecursiveASTVisitor<BoostConASTConsumer> {
Douglas Gregorf78cc432010-05-07 15:41:56 +000018 public:
19 /// HandleTranslationUnit - This method is called when the ASTs for entire
20 /// translation unit have been parsed.
21 virtual void HandleTranslationUnit(ASTContext &Ctx);
22 };
23}
24
25ASTConsumer *BoostConAction::CreateASTConsumer(CompilerInstance &CI,
26 llvm::StringRef InFile) {
27 return new BoostConASTConsumer();
28}
29
30void BoostConASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
31 fprintf(stderr, "Welcome to BoostCon!\n");
Douglas Gregord30bf2e2010-05-07 22:11:34 +000032 Visit(Ctx.getTranslationUnitDecl());
Douglas Gregorf78cc432010-05-07 15:41:56 +000033}