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