1193326Sed//===--- SemaConsumer.h - Abstract interface for AST semantics --*- C++ -*-===//
2193326Sed//
3193326Sed//                     The LLVM Compiler Infrastructure
4193326Sed//
5193326Sed// This file is distributed under the University of Illinois Open Source
6193326Sed// License. See LICENSE.TXT for details.
7193326Sed//
8193326Sed//===----------------------------------------------------------------------===//
9193326Sed//
10193326Sed//  This file defines the SemaConsumer class, a subclass of
11193326Sed//  ASTConsumer that is used by AST clients that also require
12193326Sed//  additional semantic analysis.
13193326Sed//
14193326Sed//===----------------------------------------------------------------------===//
15193326Sed#ifndef LLVM_CLANG_SEMA_SEMACONSUMER_H
16193326Sed#define LLVM_CLANG_SEMA_SEMACONSUMER_H
17193326Sed
18193326Sed#include "clang/AST/ASTConsumer.h"
19193326Sed
20193326Sednamespace clang {
21193326Sed  class Sema;
22193326Sed
23193326Sed  /// \brief An abstract interface that should be implemented by
24193326Sed  /// clients that read ASTs and then require further semantic
25193326Sed  /// analysis of the entities in those ASTs.
26193326Sed  class SemaConsumer : public ASTConsumer {
27234353Sdim    virtual void anchor();
28193326Sed  public:
29193326Sed    SemaConsumer() {
30193326Sed      ASTConsumer::SemaConsumer = true;
31193326Sed    }
32193326Sed
33193326Sed    /// \brief Initialize the semantic consumer with the Sema instance
34193326Sed    /// being used to perform semantic analysis on the abstract syntax
35193326Sed    /// tree.
36193326Sed    virtual void InitializeSema(Sema &S) {}
37193326Sed
38200583Srdivacky    /// \brief Inform the semantic consumer that Sema is no longer available.
39200583Srdivacky    virtual void ForgetSema() {}
40200583Srdivacky
41193326Sed    // isa/cast/dyn_cast support
42198092Srdivacky    static bool classof(const ASTConsumer *Consumer) {
43198092Srdivacky      return Consumer->SemaConsumer;
44193326Sed    }
45193326Sed  };
46193326Sed}
47193326Sed
48193326Sed#endif
49