ExternalSemaSource.h revision 218893
1193326Sed//===--- ExternalSemaSource.h - External Sema Interface ---------*- 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 ExternalSemaSource interface.
11193326Sed//
12193326Sed//===----------------------------------------------------------------------===//
13193326Sed#ifndef LLVM_CLANG_SEMA_EXTERNAL_SEMA_SOURCE_H
14193326Sed#define LLVM_CLANG_SEMA_EXTERNAL_SEMA_SOURCE_H
15193326Sed
16193326Sed#include "clang/AST/ExternalASTSource.h"
17218893Sdim#include <utility>
18193326Sed
19193326Sednamespace clang {
20193326Sed
21218893Sdimstruct ObjCMethodList;
22193326Sedclass Sema;
23193326Sed
24193326Sed/// \brief An abstract interface that should be implemented by
25193326Sed/// external AST sources that also provide information for semantic
26193326Sed/// analysis.
27193326Sedclass ExternalSemaSource : public ExternalASTSource {
28193326Sedpublic:
29193326Sed  ExternalSemaSource() {
30193326Sed    ExternalASTSource::SemaSource = true;
31193326Sed  }
32193326Sed
33210299Sed  ~ExternalSemaSource();
34210299Sed
35193326Sed  /// \brief Initialize the semantic source with the Sema instance
36193326Sed  /// being used to perform semantic analysis on the abstract syntax
37193326Sed  /// tree.
38193326Sed  virtual void InitializeSema(Sema &S) {}
39193326Sed
40200583Srdivacky  /// \brief Inform the semantic consumer that Sema is no longer available.
41200583Srdivacky  virtual void ForgetSema() {}
42200583Srdivacky
43193326Sed  /// \brief Load the contents of the global method pool for a given
44193326Sed  /// selector.
45193326Sed  ///
46193326Sed  /// \returns a pair of Objective-C methods lists containing the
47193326Sed  /// instance and factory methods, respectively, with this selector.
48218893Sdim  virtual std::pair<ObjCMethodList,ObjCMethodList> ReadMethodPool(Selector Sel);
49198092Srdivacky
50193326Sed  // isa/cast/dyn_cast support
51198092Srdivacky  static bool classof(const ExternalASTSource *Source) {
52193326Sed    return Source->SemaSource;
53193326Sed  }
54193326Sed  static bool classof(const ExternalSemaSource *) { return true; }
55193326Sed};
56193326Sed
57193326Sed} // end namespace clang
58193326Sed
59193326Sed#endif
60