10b57cec5SDimitry Andric //===--- MultiplexExternalSemaSource.h - External Sema Interface-*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric //  This file defines ExternalSemaSource interface, dispatching to all clients
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric #ifndef LLVM_CLANG_SEMA_MULTIPLEXEXTERNALSEMASOURCE_H
130b57cec5SDimitry Andric #define LLVM_CLANG_SEMA_MULTIPLEXEXTERNALSEMASOURCE_H
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric #include "clang/Sema/ExternalSemaSource.h"
160b57cec5SDimitry Andric #include "clang/Sema/Weak.h"
170b57cec5SDimitry Andric #include "llvm/ADT/SmallVector.h"
180b57cec5SDimitry Andric #include <utility>
190b57cec5SDimitry Andric 
200b57cec5SDimitry Andric namespace clang {
210b57cec5SDimitry Andric 
220b57cec5SDimitry Andric   class CXXConstructorDecl;
230b57cec5SDimitry Andric   class CXXRecordDecl;
240b57cec5SDimitry Andric   class DeclaratorDecl;
250b57cec5SDimitry Andric   struct ExternalVTableUse;
260b57cec5SDimitry Andric   class LookupResult;
270b57cec5SDimitry Andric   class NamespaceDecl;
280b57cec5SDimitry Andric   class Scope;
290b57cec5SDimitry Andric   class Sema;
300b57cec5SDimitry Andric   class TypedefNameDecl;
310b57cec5SDimitry Andric   class ValueDecl;
320b57cec5SDimitry Andric   class VarDecl;
330b57cec5SDimitry Andric 
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric /// An abstract interface that should be implemented by
360b57cec5SDimitry Andric /// external AST sources that also provide information for semantic
370b57cec5SDimitry Andric /// analysis.
380b57cec5SDimitry Andric class MultiplexExternalSemaSource : public ExternalSemaSource {
39480093f4SDimitry Andric   /// LLVM-style RTTI.
40480093f4SDimitry Andric   static char ID;
410b57cec5SDimitry Andric 
420b57cec5SDimitry Andric private:
43bdd1243dSDimitry Andric   SmallVector<ExternalSemaSource *, 2> Sources;
440b57cec5SDimitry Andric 
450b57cec5SDimitry Andric public:
460b57cec5SDimitry Andric   /// Constructs a new multiplexing external sema source and appends the
470b57cec5SDimitry Andric   /// given element to it.
480b57cec5SDimitry Andric   ///
49bdd1243dSDimitry Andric   ///\param[in] S1 - A non-null (old) ExternalSemaSource.
50bdd1243dSDimitry Andric   ///\param[in] S2 - A non-null (new) ExternalSemaSource.
510b57cec5SDimitry Andric   ///
52bdd1243dSDimitry Andric   MultiplexExternalSemaSource(ExternalSemaSource *S1, ExternalSemaSource *S2);
530b57cec5SDimitry Andric 
540b57cec5SDimitry Andric   ~MultiplexExternalSemaSource() override;
550b57cec5SDimitry Andric 
560b57cec5SDimitry Andric   /// Appends new source to the source list.
570b57cec5SDimitry Andric   ///
58bdd1243dSDimitry Andric   ///\param[in] Source - An ExternalSemaSource.
590b57cec5SDimitry Andric   ///
60bdd1243dSDimitry Andric   void AddSource(ExternalSemaSource *Source);
610b57cec5SDimitry Andric 
620b57cec5SDimitry Andric   //===--------------------------------------------------------------------===//
630b57cec5SDimitry Andric   // ExternalASTSource.
640b57cec5SDimitry Andric   //===--------------------------------------------------------------------===//
650b57cec5SDimitry Andric 
660b57cec5SDimitry Andric   /// Resolve a declaration ID into a declaration, potentially
670b57cec5SDimitry Andric   /// building a new declaration.
680b57cec5SDimitry Andric   Decl *GetExternalDecl(uint32_t ID) override;
690b57cec5SDimitry Andric 
700b57cec5SDimitry Andric   /// Complete the redeclaration chain if it's been extended since the
710b57cec5SDimitry Andric   /// previous generation of the AST source.
720b57cec5SDimitry Andric   void CompleteRedeclChain(const Decl *D) override;
730b57cec5SDimitry Andric 
740b57cec5SDimitry Andric   /// Resolve a selector ID into a selector.
750b57cec5SDimitry Andric   Selector GetExternalSelector(uint32_t ID) override;
760b57cec5SDimitry Andric 
770b57cec5SDimitry Andric   /// Returns the number of selectors known to the external AST
780b57cec5SDimitry Andric   /// source.
790b57cec5SDimitry Andric   uint32_t GetNumExternalSelectors() override;
800b57cec5SDimitry Andric 
810b57cec5SDimitry Andric   /// Resolve the offset of a statement in the decl stream into
820b57cec5SDimitry Andric   /// a statement.
830b57cec5SDimitry Andric   Stmt *GetExternalDeclStmt(uint64_t Offset) override;
840b57cec5SDimitry Andric 
850b57cec5SDimitry Andric   /// Resolve the offset of a set of C++ base specifiers in the decl
860b57cec5SDimitry Andric   /// stream into an array of specifiers.
870b57cec5SDimitry Andric   CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset) override;
880b57cec5SDimitry Andric 
890b57cec5SDimitry Andric   /// Resolve a handle to a list of ctor initializers into the list of
900b57cec5SDimitry Andric   /// initializers themselves.
910b57cec5SDimitry Andric   CXXCtorInitializer **GetExternalCXXCtorInitializers(uint64_t Offset) override;
920b57cec5SDimitry Andric 
930b57cec5SDimitry Andric   ExtKind hasExternalDefinitions(const Decl *D) override;
940b57cec5SDimitry Andric 
950b57cec5SDimitry Andric   /// Find all declarations with the given name in the
960b57cec5SDimitry Andric   /// given context.
970b57cec5SDimitry Andric   bool FindExternalVisibleDeclsByName(const DeclContext *DC,
980b57cec5SDimitry Andric                                       DeclarationName Name) override;
990b57cec5SDimitry Andric 
1000b57cec5SDimitry Andric   /// Ensures that the table of all visible declarations inside this
1010b57cec5SDimitry Andric   /// context is up to date.
1020b57cec5SDimitry Andric   void completeVisibleDeclsMap(const DeclContext *DC) override;
1030b57cec5SDimitry Andric 
1040b57cec5SDimitry Andric   /// Finds all declarations lexically contained within the given
1050b57cec5SDimitry Andric   /// DeclContext, after applying an optional filter predicate.
1060b57cec5SDimitry Andric   ///
1070b57cec5SDimitry Andric   /// \param IsKindWeWant a predicate function that returns true if the passed
1080b57cec5SDimitry Andric   /// declaration kind is one we are looking for.
1090b57cec5SDimitry Andric   void
1100b57cec5SDimitry Andric   FindExternalLexicalDecls(const DeclContext *DC,
1110b57cec5SDimitry Andric                            llvm::function_ref<bool(Decl::Kind)> IsKindWeWant,
1120b57cec5SDimitry Andric                            SmallVectorImpl<Decl *> &Result) override;
1130b57cec5SDimitry Andric 
1140b57cec5SDimitry Andric   /// Get the decls that are contained in a file in the Offset/Length
1150b57cec5SDimitry Andric   /// range. \p Length can be 0 to indicate a point at \p Offset instead of
1160b57cec5SDimitry Andric   /// a range.
1170b57cec5SDimitry Andric   void FindFileRegionDecls(FileID File, unsigned Offset,unsigned Length,
1180b57cec5SDimitry Andric                            SmallVectorImpl<Decl *> &Decls) override;
1190b57cec5SDimitry Andric 
1200b57cec5SDimitry Andric   /// Gives the external AST source an opportunity to complete
1210b57cec5SDimitry Andric   /// an incomplete type.
1220b57cec5SDimitry Andric   void CompleteType(TagDecl *Tag) override;
1230b57cec5SDimitry Andric 
1240b57cec5SDimitry Andric   /// Gives the external AST source an opportunity to complete an
1250b57cec5SDimitry Andric   /// incomplete Objective-C class.
1260b57cec5SDimitry Andric   ///
1270b57cec5SDimitry Andric   /// This routine will only be invoked if the "externally completed" bit is
1280b57cec5SDimitry Andric   /// set on the ObjCInterfaceDecl via the function
1290b57cec5SDimitry Andric   /// \c ObjCInterfaceDecl::setExternallyCompleted().
1300b57cec5SDimitry Andric   void CompleteType(ObjCInterfaceDecl *Class) override;
1310b57cec5SDimitry Andric 
1320b57cec5SDimitry Andric   /// Loads comment ranges.
1330b57cec5SDimitry Andric   void ReadComments() override;
1340b57cec5SDimitry Andric 
1350b57cec5SDimitry Andric   /// Notify ExternalASTSource that we started deserialization of
1360b57cec5SDimitry Andric   /// a decl or type so until FinishedDeserializing is called there may be
1370b57cec5SDimitry Andric   /// decls that are initializing. Must be paired with FinishedDeserializing.
1380b57cec5SDimitry Andric   void StartedDeserializing() override;
1390b57cec5SDimitry Andric 
1400b57cec5SDimitry Andric   /// Notify ExternalASTSource that we finished the deserialization of
1410b57cec5SDimitry Andric   /// a decl or type. Must be paired with StartedDeserializing.
1420b57cec5SDimitry Andric   void FinishedDeserializing() override;
1430b57cec5SDimitry Andric 
1440b57cec5SDimitry Andric   /// Function that will be invoked when we begin parsing a new
1450b57cec5SDimitry Andric   /// translation unit involving this external AST source.
1460b57cec5SDimitry Andric   void StartTranslationUnit(ASTConsumer *Consumer) override;
1470b57cec5SDimitry Andric 
1480b57cec5SDimitry Andric   /// Print any statistics that have been gathered regarding
1490b57cec5SDimitry Andric   /// the external AST source.
1500b57cec5SDimitry Andric   void PrintStats() override;
1510b57cec5SDimitry Andric 
1520b57cec5SDimitry Andric   /// Retrieve the module that corresponds to the given module ID.
1530b57cec5SDimitry Andric   Module *getModule(unsigned ID) override;
1540b57cec5SDimitry Andric 
1550b57cec5SDimitry Andric   /// Perform layout on the given record.
1560b57cec5SDimitry Andric   ///
1570b57cec5SDimitry Andric   /// This routine allows the external AST source to provide an specific
1580b57cec5SDimitry Andric   /// layout for a record, overriding the layout that would normally be
1590b57cec5SDimitry Andric   /// constructed. It is intended for clients who receive specific layout
1600b57cec5SDimitry Andric   /// details rather than source code (such as LLDB). The client is expected
1610b57cec5SDimitry Andric   /// to fill in the field offsets, base offsets, virtual base offsets, and
1620b57cec5SDimitry Andric   /// complete object size.
1630b57cec5SDimitry Andric   ///
1640b57cec5SDimitry Andric   /// \param Record The record whose layout is being requested.
1650b57cec5SDimitry Andric   ///
1660b57cec5SDimitry Andric   /// \param Size The final size of the record, in bits.
1670b57cec5SDimitry Andric   ///
1680b57cec5SDimitry Andric   /// \param Alignment The final alignment of the record, in bits.
1690b57cec5SDimitry Andric   ///
1700b57cec5SDimitry Andric   /// \param FieldOffsets The offset of each of the fields within the record,
1710b57cec5SDimitry Andric   /// expressed in bits. All of the fields must be provided with offsets.
1720b57cec5SDimitry Andric   ///
1730b57cec5SDimitry Andric   /// \param BaseOffsets The offset of each of the direct, non-virtual base
1740b57cec5SDimitry Andric   /// classes. If any bases are not given offsets, the bases will be laid
1750b57cec5SDimitry Andric   /// out according to the ABI.
1760b57cec5SDimitry Andric   ///
1770b57cec5SDimitry Andric   /// \param VirtualBaseOffsets The offset of each of the virtual base classes
1780b57cec5SDimitry Andric   /// (either direct or not). If any bases are not given offsets, the bases will
1790b57cec5SDimitry Andric   /// be laid out according to the ABI.
1800b57cec5SDimitry Andric   ///
1810b57cec5SDimitry Andric   /// \returns true if the record layout was provided, false otherwise.
1820b57cec5SDimitry Andric   bool
1830b57cec5SDimitry Andric   layoutRecordType(const RecordDecl *Record,
1840b57cec5SDimitry Andric                    uint64_t &Size, uint64_t &Alignment,
1850b57cec5SDimitry Andric                    llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets,
1860b57cec5SDimitry Andric                  llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets,
1870b57cec5SDimitry Andric                  llvm::DenseMap<const CXXRecordDecl *,
1880b57cec5SDimitry Andric                                 CharUnits> &VirtualBaseOffsets) override;
1890b57cec5SDimitry Andric 
1900b57cec5SDimitry Andric   /// Return the amount of memory used by memory buffers, breaking down
1910b57cec5SDimitry Andric   /// by heap-backed versus mmap'ed memory.
1920b57cec5SDimitry Andric   void getMemoryBufferSizes(MemoryBufferSizes &sizes) const override;
1930b57cec5SDimitry Andric 
1940b57cec5SDimitry Andric   //===--------------------------------------------------------------------===//
1950b57cec5SDimitry Andric   // ExternalSemaSource.
1960b57cec5SDimitry Andric   //===--------------------------------------------------------------------===//
1970b57cec5SDimitry Andric 
1980b57cec5SDimitry Andric   /// Initialize the semantic source with the Sema instance
1990b57cec5SDimitry Andric   /// being used to perform semantic analysis on the abstract syntax
2000b57cec5SDimitry Andric   /// tree.
2010b57cec5SDimitry Andric   void InitializeSema(Sema &S) override;
2020b57cec5SDimitry Andric 
2030b57cec5SDimitry Andric   /// Inform the semantic consumer that Sema is no longer available.
2040b57cec5SDimitry Andric   void ForgetSema() override;
2050b57cec5SDimitry Andric 
2060b57cec5SDimitry Andric   /// Load the contents of the global method pool for a given
2070b57cec5SDimitry Andric   /// selector.
2080b57cec5SDimitry Andric   void ReadMethodPool(Selector Sel) override;
2090b57cec5SDimitry Andric 
2100b57cec5SDimitry Andric   /// Load the contents of the global method pool for a given
2110b57cec5SDimitry Andric   /// selector if necessary.
2120b57cec5SDimitry Andric   void updateOutOfDateSelector(Selector Sel) override;
2130b57cec5SDimitry Andric 
2140b57cec5SDimitry Andric   /// Load the set of namespaces that are known to the external source,
2150b57cec5SDimitry Andric   /// which will be used during typo correction.
2160b57cec5SDimitry Andric   void
2170b57cec5SDimitry Andric   ReadKnownNamespaces(SmallVectorImpl<NamespaceDecl*> &Namespaces) override;
2180b57cec5SDimitry Andric 
2190b57cec5SDimitry Andric   /// Load the set of used but not defined functions or variables with
2200b57cec5SDimitry Andric   /// internal linkage, or used but not defined inline functions.
2210b57cec5SDimitry Andric   void ReadUndefinedButUsed(
2220b57cec5SDimitry Andric       llvm::MapVector<NamedDecl *, SourceLocation> &Undefined) override;
2230b57cec5SDimitry Andric 
2240b57cec5SDimitry Andric   void ReadMismatchingDeleteExpressions(llvm::MapVector<
2250b57cec5SDimitry Andric       FieldDecl *, llvm::SmallVector<std::pair<SourceLocation, bool>, 4>> &
2260b57cec5SDimitry Andric                                             Exprs) override;
2270b57cec5SDimitry Andric 
2280b57cec5SDimitry Andric   /// Do last resort, unqualified lookup on a LookupResult that
2290b57cec5SDimitry Andric   /// Sema cannot find.
2300b57cec5SDimitry Andric   ///
2310b57cec5SDimitry Andric   /// \param R a LookupResult that is being recovered.
2320b57cec5SDimitry Andric   ///
2330b57cec5SDimitry Andric   /// \param S the Scope of the identifier occurrence.
2340b57cec5SDimitry Andric   ///
2350b57cec5SDimitry Andric   /// \return true to tell Sema to recover using the LookupResult.
2360b57cec5SDimitry Andric   bool LookupUnqualified(LookupResult &R, Scope *S) override;
2370b57cec5SDimitry Andric 
2380b57cec5SDimitry Andric   /// Read the set of tentative definitions known to the external Sema
2390b57cec5SDimitry Andric   /// source.
2400b57cec5SDimitry Andric   ///
2410b57cec5SDimitry Andric   /// The external source should append its own tentative definitions to the
2420b57cec5SDimitry Andric   /// given vector of tentative definitions. Note that this routine may be
2430b57cec5SDimitry Andric   /// invoked multiple times; the external source should take care not to
2440b57cec5SDimitry Andric   /// introduce the same declarations repeatedly.
2450b57cec5SDimitry Andric   void ReadTentativeDefinitions(SmallVectorImpl<VarDecl*> &Defs) override;
2460b57cec5SDimitry Andric 
2470b57cec5SDimitry Andric   /// Read the set of unused file-scope declarations known to the
2480b57cec5SDimitry Andric   /// external Sema source.
2490b57cec5SDimitry Andric   ///
2500b57cec5SDimitry Andric   /// The external source should append its own unused, filed-scope to the
2510b57cec5SDimitry Andric   /// given vector of declarations. Note that this routine may be
2520b57cec5SDimitry Andric   /// invoked multiple times; the external source should take care not to
2530b57cec5SDimitry Andric   /// introduce the same declarations repeatedly.
2540b57cec5SDimitry Andric   void ReadUnusedFileScopedDecls(
2550b57cec5SDimitry Andric                         SmallVectorImpl<const DeclaratorDecl*> &Decls) override;
2560b57cec5SDimitry Andric 
2570b57cec5SDimitry Andric   /// Read the set of delegating constructors known to the
2580b57cec5SDimitry Andric   /// external Sema source.
2590b57cec5SDimitry Andric   ///
2600b57cec5SDimitry Andric   /// The external source should append its own delegating constructors to the
2610b57cec5SDimitry Andric   /// given vector of declarations. Note that this routine may be
2620b57cec5SDimitry Andric   /// invoked multiple times; the external source should take care not to
2630b57cec5SDimitry Andric   /// introduce the same declarations repeatedly.
2640b57cec5SDimitry Andric   void ReadDelegatingConstructors(
2650b57cec5SDimitry Andric                           SmallVectorImpl<CXXConstructorDecl*> &Decls) override;
2660b57cec5SDimitry Andric 
2670b57cec5SDimitry Andric   /// Read the set of ext_vector type declarations known to the
2680b57cec5SDimitry Andric   /// external Sema source.
2690b57cec5SDimitry Andric   ///
2700b57cec5SDimitry Andric   /// The external source should append its own ext_vector type declarations to
2710b57cec5SDimitry Andric   /// the given vector of declarations. Note that this routine may be
2720b57cec5SDimitry Andric   /// invoked multiple times; the external source should take care not to
2730b57cec5SDimitry Andric   /// introduce the same declarations repeatedly.
2740b57cec5SDimitry Andric   void ReadExtVectorDecls(SmallVectorImpl<TypedefNameDecl*> &Decls) override;
2750b57cec5SDimitry Andric 
2760b57cec5SDimitry Andric   /// Read the set of potentially unused typedefs known to the source.
2770b57cec5SDimitry Andric   ///
2780b57cec5SDimitry Andric   /// The external source should append its own potentially unused local
2790b57cec5SDimitry Andric   /// typedefs to the given vector of declarations. Note that this routine may
2800b57cec5SDimitry Andric   /// be invoked multiple times; the external source should take care not to
2810b57cec5SDimitry Andric   /// introduce the same declarations repeatedly.
2820b57cec5SDimitry Andric   void ReadUnusedLocalTypedefNameCandidates(
2830b57cec5SDimitry Andric       llvm::SmallSetVector<const TypedefNameDecl *, 4> &Decls) override;
2840b57cec5SDimitry Andric 
2850b57cec5SDimitry Andric   /// Read the set of referenced selectors known to the
2860b57cec5SDimitry Andric   /// external Sema source.
2870b57cec5SDimitry Andric   ///
2880b57cec5SDimitry Andric   /// The external source should append its own referenced selectors to the
2890b57cec5SDimitry Andric   /// given vector of selectors. Note that this routine
2900b57cec5SDimitry Andric   /// may be invoked multiple times; the external source should take care not
2910b57cec5SDimitry Andric   /// to introduce the same selectors repeatedly.
2920b57cec5SDimitry Andric   void ReadReferencedSelectors(SmallVectorImpl<std::pair<Selector,
2930b57cec5SDimitry Andric                                               SourceLocation> > &Sels) override;
2940b57cec5SDimitry Andric 
2950b57cec5SDimitry Andric   /// Read the set of weak, undeclared identifiers known to the
2960b57cec5SDimitry Andric   /// external Sema source.
2970b57cec5SDimitry Andric   ///
2980b57cec5SDimitry Andric   /// The external source should append its own weak, undeclared identifiers to
2990b57cec5SDimitry Andric   /// the given vector. Note that this routine may be invoked multiple times;
3000b57cec5SDimitry Andric   /// the external source should take care not to introduce the same identifiers
3010b57cec5SDimitry Andric   /// repeatedly.
3020b57cec5SDimitry Andric   void ReadWeakUndeclaredIdentifiers(
3030b57cec5SDimitry Andric            SmallVectorImpl<std::pair<IdentifierInfo*, WeakInfo> > &WI) override;
3040b57cec5SDimitry Andric 
3050b57cec5SDimitry Andric   /// Read the set of used vtables known to the external Sema source.
3060b57cec5SDimitry Andric   ///
3070b57cec5SDimitry Andric   /// The external source should append its own used vtables to the given
3080b57cec5SDimitry Andric   /// vector. Note that this routine may be invoked multiple times; the external
3090b57cec5SDimitry Andric   /// source should take care not to introduce the same vtables repeatedly.
3100b57cec5SDimitry Andric   void ReadUsedVTables(SmallVectorImpl<ExternalVTableUse> &VTables) override;
3110b57cec5SDimitry Andric 
3120b57cec5SDimitry Andric   /// Read the set of pending instantiations known to the external
3130b57cec5SDimitry Andric   /// Sema source.
3140b57cec5SDimitry Andric   ///
3150b57cec5SDimitry Andric   /// The external source should append its own pending instantiations to the
3160b57cec5SDimitry Andric   /// given vector. Note that this routine may be invoked multiple times; the
3170b57cec5SDimitry Andric   /// external source should take care not to introduce the same instantiations
3180b57cec5SDimitry Andric   /// repeatedly.
3190b57cec5SDimitry Andric   void ReadPendingInstantiations(
3200b57cec5SDimitry Andric      SmallVectorImpl<std::pair<ValueDecl*, SourceLocation> >& Pending) override;
3210b57cec5SDimitry Andric 
3220b57cec5SDimitry Andric   /// Read the set of late parsed template functions for this source.
3230b57cec5SDimitry Andric   ///
3240b57cec5SDimitry Andric   /// The external source should insert its own late parsed template functions
3250b57cec5SDimitry Andric   /// into the map. Note that this routine may be invoked multiple times; the
3260b57cec5SDimitry Andric   /// external source should take care not to introduce the same map entries
3270b57cec5SDimitry Andric   /// repeatedly.
3280b57cec5SDimitry Andric   void ReadLateParsedTemplates(
3290b57cec5SDimitry Andric       llvm::MapVector<const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
3300b57cec5SDimitry Andric           &LPTMap) override;
3310b57cec5SDimitry Andric 
3325ffd83dbSDimitry Andric   /// Read the set of decls to be checked for deferred diags.
3335ffd83dbSDimitry Andric   ///
3345ffd83dbSDimitry Andric   /// The external source should append its own potentially emitted function
3355ffd83dbSDimitry Andric   /// and variable decls which may cause deferred diags. Note that this routine
3365ffd83dbSDimitry Andric   /// may be invoked multiple times; the external source should take care not to
3375ffd83dbSDimitry Andric   /// introduce the same declarations repeatedly.
3385ffd83dbSDimitry Andric   void ReadDeclsToCheckForDeferredDiags(
339fe6060f1SDimitry Andric       llvm::SmallSetVector<Decl *, 4> &Decls) override;
3405ffd83dbSDimitry Andric 
3410b57cec5SDimitry Andric   /// \copydoc ExternalSemaSource::CorrectTypo
3420b57cec5SDimitry Andric   /// \note Returns the first nonempty correction.
3430b57cec5SDimitry Andric   TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo,
3440b57cec5SDimitry Andric                              int LookupKind, Scope *S, CXXScopeSpec *SS,
3450b57cec5SDimitry Andric                              CorrectionCandidateCallback &CCC,
3460b57cec5SDimitry Andric                              DeclContext *MemberContext,
3470b57cec5SDimitry Andric                              bool EnteringContext,
3480b57cec5SDimitry Andric                              const ObjCObjectPointerType *OPT) override;
3490b57cec5SDimitry Andric 
3500b57cec5SDimitry Andric   /// Produces a diagnostic note if one of the attached sources
3510b57cec5SDimitry Andric   /// contains a complete definition for \p T. Queries the sources in list
3520b57cec5SDimitry Andric   /// order until the first one claims that a diagnostic was produced.
3530b57cec5SDimitry Andric   ///
3540b57cec5SDimitry Andric   /// \param Loc the location at which a complete type was required but not
3550b57cec5SDimitry Andric   /// provided
3560b57cec5SDimitry Andric   ///
3570b57cec5SDimitry Andric   /// \param T the \c QualType that should have been complete at \p Loc
3580b57cec5SDimitry Andric   ///
3590b57cec5SDimitry Andric   /// \return true if a diagnostic was produced, false otherwise.
3600b57cec5SDimitry Andric   bool MaybeDiagnoseMissingCompleteType(SourceLocation Loc,
3610b57cec5SDimitry Andric                                         QualType T) override;
3620b57cec5SDimitry Andric 
36306c3fb27SDimitry Andric   // Inform all attached sources that a mangling number was assigned.
36406c3fb27SDimitry Andric   void AssignedLambdaNumbering(const CXXRecordDecl *Lambda) override;
36506c3fb27SDimitry Andric 
366480093f4SDimitry Andric   /// LLVM-style RTTI.
367480093f4SDimitry Andric   /// \{
isA(const void * ClassID)368480093f4SDimitry Andric   bool isA(const void *ClassID) const override {
369480093f4SDimitry Andric     return ClassID == &ID || ExternalSemaSource::isA(ClassID);
370480093f4SDimitry Andric   }
classof(const ExternalASTSource * S)371480093f4SDimitry Andric   static bool classof(const ExternalASTSource *S) { return S->isA(&ID); }
372480093f4SDimitry Andric   /// \}
3730b57cec5SDimitry Andric };
3740b57cec5SDimitry Andric 
3750b57cec5SDimitry Andric } // end namespace clang
3760b57cec5SDimitry Andric 
3770b57cec5SDimitry Andric #endif
378