]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/llvm/tools/clang/include/clang/Sema/ExternalSemaSource.h
Copy head to stable/9 as part of 9.0-RELEASE release cycle.
[FreeBSD/stable/9.git] / contrib / llvm / tools / clang / include / clang / Sema / ExternalSemaSource.h
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
19 namespace clang {
20
21 struct ObjCMethodList;
22 class Sema;
23 class Scope;
24 class LookupResult;
25
26 /// \brief An abstract interface that should be implemented by
27 /// external AST sources that also provide information for semantic
28 /// analysis.
29 class ExternalSemaSource : public ExternalASTSource {
30 public:
31   ExternalSemaSource() {
32     ExternalASTSource::SemaSource = true;
33   }
34
35   ~ExternalSemaSource();
36
37   /// \brief Initialize the semantic source with the Sema instance
38   /// being used to perform semantic analysis on the abstract syntax
39   /// tree.
40   virtual void InitializeSema(Sema &S) {}
41
42   /// \brief Inform the semantic consumer that Sema is no longer available.
43   virtual void ForgetSema() {}
44
45   /// \brief Load the contents of the global method pool for a given
46   /// selector.
47   ///
48   /// \returns a pair of Objective-C methods lists containing the
49   /// instance and factory methods, respectively, with this selector.
50   virtual std::pair<ObjCMethodList,ObjCMethodList> ReadMethodPool(Selector Sel);
51
52   /// \brief Load the set of namespaces that are known to the external source,
53   /// which will be used during typo correction.
54   virtual void ReadKnownNamespaces(
55                            llvm::SmallVectorImpl<NamespaceDecl *> &Namespaces);
56   
57   /// \brief Do last resort, unqualified lookup on a LookupResult that
58   /// Sema cannot find.
59   ///
60   /// \param R a LookupResult that is being recovered.
61   ///
62   /// \param S the Scope of the identifier occurrence.
63   ///
64   /// \return true to tell Sema to recover using the LookupResult.
65   virtual bool LookupUnqualified(LookupResult &R, Scope *S) { return false; }
66
67   // isa/cast/dyn_cast support
68   static bool classof(const ExternalASTSource *Source) {
69     return Source->SemaSource;
70   }
71   static bool classof(const ExternalSemaSource *) { return true; }
72 };
73
74 } // end namespace clang
75
76 #endif