]>
git.proxmox.com Git - rustc.git/blob - src/llvm/tools/clang/include/clang/Sema/ExternalSemaSource.h
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"
17 #include "clang/Sema/Weak.h"
22 class CXXConstructorDecl
;
26 struct ObjCMethodList
;
29 class TypedefNameDecl
;
33 /// \brief A simple structure that captures a vtable use for the purposes of
34 /// the \c ExternalSemaSource.
35 struct ExternalVTableUse
{
36 CXXRecordDecl
*Record
;
37 SourceLocation Location
;
38 bool DefinitionRequired
;
41 /// \brief An abstract interface that should be implemented by
42 /// external AST sources that also provide information for semantic
44 class ExternalSemaSource
: public ExternalASTSource
{
46 ExternalSemaSource() {
47 ExternalASTSource::SemaSource
= true;
50 ~ExternalSemaSource();
52 /// \brief Initialize the semantic source with the Sema instance
53 /// being used to perform semantic analysis on the abstract syntax
55 virtual void InitializeSema(Sema
&S
) {}
57 /// \brief Inform the semantic consumer that Sema is no longer available.
58 virtual void ForgetSema() {}
60 /// \brief Load the contents of the global method pool for a given
62 virtual void ReadMethodPool(Selector Sel
);
64 /// \brief Load the set of namespaces that are known to the external source,
65 /// which will be used during typo correction.
66 virtual void ReadKnownNamespaces(
67 SmallVectorImpl
<NamespaceDecl
*> &Namespaces
);
69 /// \brief Do last resort, unqualified lookup on a LookupResult that
72 /// \param R a LookupResult that is being recovered.
74 /// \param S the Scope of the identifier occurrence.
76 /// \return true to tell Sema to recover using the LookupResult.
77 virtual bool LookupUnqualified(LookupResult
&R
, Scope
*S
) { return false; }
79 /// \brief Read the set of tentative definitions known to the external Sema
82 /// The external source should append its own tentative definitions to the
83 /// given vector of tentative definitions. Note that this routine may be
84 /// invoked multiple times; the external source should take care not to
85 /// introduce the same declarations repeatedly.
86 virtual void ReadTentativeDefinitions(
87 SmallVectorImpl
<VarDecl
*> &TentativeDefs
) {}
89 /// \brief Read the set of unused file-scope declarations known to the
90 /// external Sema source.
92 /// The external source should append its own unused, filed-scope to the
93 /// given vector of declarations. Note that this routine may be
94 /// invoked multiple times; the external source should take care not to
95 /// introduce the same declarations repeatedly.
96 virtual void ReadUnusedFileScopedDecls(
97 SmallVectorImpl
<const DeclaratorDecl
*> &Decls
) {}
99 /// \brief Read the set of delegating constructors known to the
100 /// external Sema source.
102 /// The external source should append its own delegating constructors to the
103 /// given vector of declarations. Note that this routine may be
104 /// invoked multiple times; the external source should take care not to
105 /// introduce the same declarations repeatedly.
106 virtual void ReadDelegatingConstructors(
107 SmallVectorImpl
<CXXConstructorDecl
*> &Decls
) {}
109 /// \brief Read the set of ext_vector type declarations known to the
110 /// external Sema source.
112 /// The external source should append its own ext_vector type declarations to
113 /// the given vector of declarations. Note that this routine may be
114 /// invoked multiple times; the external source should take care not to
115 /// introduce the same declarations repeatedly.
116 virtual void ReadExtVectorDecls(SmallVectorImpl
<TypedefNameDecl
*> &Decls
) {}
118 /// \brief Read the set of dynamic classes known to the external Sema source.
120 /// The external source should append its own dynamic classes to
121 /// the given vector of declarations. Note that this routine may be
122 /// invoked multiple times; the external source should take care not to
123 /// introduce the same declarations repeatedly.
124 virtual void ReadDynamicClasses(SmallVectorImpl
<CXXRecordDecl
*> &Decls
) {}
126 /// \brief Read the set of locally-scoped external declarations known to the
127 /// external Sema source.
129 /// The external source should append its own locally-scoped external
130 /// declarations to the given vector of declarations. Note that this routine
131 /// may be invoked multiple times; the external source should take care not
132 /// to introduce the same declarations repeatedly.
133 virtual void ReadLocallyScopedExternalDecls(
134 SmallVectorImpl
<NamedDecl
*> &Decls
) {}
136 /// \brief Read the set of referenced selectors known to the
137 /// external Sema source.
139 /// The external source should append its own referenced selectors to the
140 /// given vector of selectors. Note that this routine
141 /// may be invoked multiple times; the external source should take care not
142 /// to introduce the same selectors repeatedly.
143 virtual void ReadReferencedSelectors(
144 SmallVectorImpl
<std::pair
<Selector
, SourceLocation
> > &Sels
) {}
146 /// \brief Read the set of weak, undeclared identifiers known to the
147 /// external Sema source.
149 /// The external source should append its own weak, undeclared identifiers to
150 /// the given vector. Note that this routine may be invoked multiple times;
151 /// the external source should take care not to introduce the same identifiers
153 virtual void ReadWeakUndeclaredIdentifiers(
154 SmallVectorImpl
<std::pair
<IdentifierInfo
*, WeakInfo
> > &WI
) {}
156 /// \brief Read the set of used vtables known to the external Sema source.
158 /// The external source should append its own used vtables to the given
159 /// vector. Note that this routine may be invoked multiple times; the external
160 /// source should take care not to introduce the same vtables repeatedly.
161 virtual void ReadUsedVTables(SmallVectorImpl
<ExternalVTableUse
> &VTables
) {}
163 /// \brief Read the set of pending instantiations known to the external
166 /// The external source should append its own pending instantiations to the
167 /// given vector. Note that this routine may be invoked multiple times; the
168 /// external source should take care not to introduce the same instantiations
170 virtual void ReadPendingInstantiations(
171 SmallVectorImpl
<std::pair
<ValueDecl
*,
172 SourceLocation
> > &Pending
) {}
174 // isa/cast/dyn_cast support
175 static bool classof(const ExternalASTSource
*Source
) {
176 return Source
->SemaSource
;
178 static bool classof(const ExternalSemaSource
*) { return true; }
181 } // end namespace clang