ExternalSemaSource.h revision 212904
1//===--- ExternalSemaSource.h - External Sema Interface ---------*- 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// 10// This file defines the ExternalSemaSource interface. 11// 12//===----------------------------------------------------------------------===// 13#ifndef LLVM_CLANG_SEMA_EXTERNAL_SEMA_SOURCE_H 14#define LLVM_CLANG_SEMA_EXTERNAL_SEMA_SOURCE_H 15 16#include "clang/AST/ExternalASTSource.h" 17#include "clang/Sema/ObjCMethodList.h" 18 19namespace clang { 20 21class Sema; 22 23/// \brief An abstract interface that should be implemented by 24/// external AST sources that also provide information for semantic 25/// analysis. 26class ExternalSemaSource : public ExternalASTSource { 27public: 28 ExternalSemaSource() { 29 ExternalASTSource::SemaSource = true; 30 } 31 32 ~ExternalSemaSource(); 33 34 /// \brief Initialize the semantic source with the Sema instance 35 /// being used to perform semantic analysis on the abstract syntax 36 /// tree. 37 virtual void InitializeSema(Sema &S) {} 38 39 /// \brief Inform the semantic consumer that Sema is no longer available. 40 virtual void ForgetSema() {} 41 42 /// \brief Load the contents of the global method pool for a given 43 /// selector. 44 /// 45 /// \returns a pair of Objective-C methods lists containing the 46 /// instance and factory methods, respectively, with this selector. 47 virtual std::pair<ObjCMethodList, ObjCMethodList> 48 ReadMethodPool(Selector Sel) { 49 return std::pair<ObjCMethodList, ObjCMethodList>(); 50 } 51 52 // isa/cast/dyn_cast support 53 static bool classof(const ExternalASTSource *Source) { 54 return Source->SemaSource; 55 } 56 static bool classof(const ExternalSemaSource *) { return true; } 57}; 58 59} // end namespace clang 60 61#endif 62