1 //===--- ExternalSemaSource.h - External Sema Interface ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the ExternalSemaSource interface.
12 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_SEMA_EXTERNAL_SEMA_SOURCE_H
14 #define LLVM_CLANG_SEMA_EXTERNAL_SEMA_SOURCE_H
16 #include "clang/AST/ExternalASTSource.h"
21 struct ObjCMethodList;
26 /// \brief An abstract interface that should be implemented by
27 /// external AST sources that also provide information for semantic
29 class ExternalSemaSource : public ExternalASTSource {
31 ExternalSemaSource() {
32 ExternalASTSource::SemaSource = true;
35 ~ExternalSemaSource();
37 /// \brief Initialize the semantic source with the Sema instance
38 /// being used to perform semantic analysis on the abstract syntax
40 virtual void InitializeSema(Sema &S) {}
42 /// \brief Inform the semantic consumer that Sema is no longer available.
43 virtual void ForgetSema() {}
45 /// \brief Load the contents of the global method pool for a given
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);
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);
57 /// \brief Do last resort, unqualified lookup on a LookupResult that
60 /// \param R a LookupResult that is being recovered.
62 /// \param S the Scope of the identifier occurrence.
64 /// \return true to tell Sema to recover using the LookupResult.
65 virtual bool LookupUnqualified(LookupResult &R, Scope *S) { return false; }
67 // isa/cast/dyn_cast support
68 static bool classof(const ExternalASTSource *Source) {
69 return Source->SemaSource;
71 static bool classof(const ExternalSemaSource *) { return true; }
74 } // end namespace clang