summaryrefslogtreecommitdiff
path: root/lib/Frontend/ASTConsumers.cpp
blob: b6a04e871bbc7c04824f3fe2374fafd7969081e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//===--- ASTConsumers.cpp - ASTConsumer implementations -------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// AST Consumer Implementations.
//
//===----------------------------------------------------------------------===//

#include <string>
#include "flang/Frontend/ASTConsumers.h"
#include "flang/AST/ASTContext.h"
#include "flang/AST/ASTConsumer.h"

using namespace flang;

namespace {

class ASTPrinter : public ASTConsumer {
public:
  std::string FilterString;

  ASTPrinter(StringRef Filter)
    : FilterString(Filter) {
  }

  void HandleTranslationUnit(ASTContext &Ctx) {
    Ctx.getTranslationUnitDecl()->dump();
  }
};

}

ASTConsumer *flang::CreateASTDumper(StringRef FilterString) {
  return new ASTPrinter(FilterString);
}