clang API Documentation

SemaConsumer.h
Go to the documentation of this file.
00001 //===--- SemaConsumer.h - Abstract interface for AST semantics --*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  This file defines the SemaConsumer class, a subclass of
00011 //  ASTConsumer that is used by AST clients that also require
00012 //  additional semantic analysis.
00013 //
00014 //===----------------------------------------------------------------------===//
00015 #ifndef LLVM_CLANG_SEMA_SEMACONSUMER_H
00016 #define LLVM_CLANG_SEMA_SEMACONSUMER_H
00017 
00018 #include "clang/AST/ASTConsumer.h"
00019 
00020 namespace clang {
00021   class Sema;
00022 
00023   /// \brief An abstract interface that should be implemented by
00024   /// clients that read ASTs and then require further semantic
00025   /// analysis of the entities in those ASTs.
00026   class SemaConsumer : public ASTConsumer {
00027     virtual void anchor();
00028   public:
00029     SemaConsumer() {
00030       ASTConsumer::SemaConsumer = true;
00031     }
00032 
00033     /// \brief Initialize the semantic consumer with the Sema instance
00034     /// being used to perform semantic analysis on the abstract syntax
00035     /// tree.
00036     virtual void InitializeSema(Sema &S) {}
00037 
00038     /// \brief Inform the semantic consumer that Sema is no longer available.
00039     virtual void ForgetSema() {}
00040 
00041     // isa/cast/dyn_cast support
00042     static bool classof(const ASTConsumer *Consumer) {
00043       return Consumer->SemaConsumer;
00044     }
00045   };
00046 }
00047 
00048 #endif