1254721Semaste//===-- ClangASTSource.h ----------------------------------------*- C++ -*-===//
2254721Semaste//
3254721Semaste//                     The LLVM Compiler Infrastructure
4254721Semaste//
5254721Semaste// This file is distributed under the University of Illinois Open Source
6254721Semaste// License. See LICENSE.TXT for details.
7254721Semaste//
8254721Semaste//===----------------------------------------------------------------------===//
9254721Semaste
10254721Semaste#ifndef liblldb_ClangASTSource_h_
11254721Semaste#define liblldb_ClangASTSource_h_
12254721Semaste
13254721Semaste#include <set>
14254721Semaste
15254721Semaste#include "clang/Basic/IdentifierTable.h"
16254721Semaste#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
17254721Semaste#include "lldb/Symbol/ClangASTImporter.h"
18254721Semaste#include "lldb/Target/Target.h"
19254721Semaste
20254721Semaste#include "llvm/ADT/SmallSet.h"
21254721Semaste
22254721Semastenamespace lldb_private {
23254721Semaste
24254721Semaste//----------------------------------------------------------------------
25254721Semaste/// @class ClangASTSource ClangASTSource.h "lldb/Expression/ClangASTSource.h"
26254721Semaste/// @brief Provider for named objects defined in the debug info for Clang
27254721Semaste///
28254721Semaste/// As Clang parses an expression, it may encounter names that are not
29254721Semaste/// defined inside the expression, including variables, functions, and
30254721Semaste/// types.  Clang knows the name it is looking for, but nothing else.
31254721Semaste/// The ExternalSemaSource class provides Decls (VarDecl, FunDecl, TypeDecl)
32254721Semaste/// to Clang for these names, consulting the ClangExpressionDeclMap to do
33254721Semaste/// the actual lookups.
34254721Semaste//----------------------------------------------------------------------
35254721Semasteclass ClangASTSource :
36254721Semaste    public ClangExternalASTSourceCommon,
37254721Semaste    public ClangASTImporter::MapCompleter
38254721Semaste{
39254721Semastepublic:
40254721Semaste    //------------------------------------------------------------------
41254721Semaste    /// Constructor
42254721Semaste    ///
43254721Semaste    /// Initializes class variables.
44254721Semaste    ///
45254721Semaste    /// @param[in] declMap
46254721Semaste    ///     A reference to the LLDB object that handles entity lookup.
47254721Semaste    //------------------------------------------------------------------
48254721Semaste	ClangASTSource (const lldb::TargetSP &target) :
49254721Semaste        m_import_in_progress (false),
50254721Semaste        m_lookups_enabled (false),
51254721Semaste        m_target (target),
52254721Semaste        m_ast_context (NULL),
53254721Semaste        m_active_lookups ()
54254721Semaste    {
55254721Semaste        m_ast_importer = m_target->GetClangASTImporter();
56254721Semaste    }
57254721Semaste
58254721Semaste    //------------------------------------------------------------------
59254721Semaste    /// Destructor
60254721Semaste    //------------------------------------------------------------------
61254721Semaste	~ClangASTSource();
62254721Semaste
63254721Semaste    //------------------------------------------------------------------
64254721Semaste    /// Interface stubs.
65254721Semaste    //------------------------------------------------------------------
66254721Semaste    clang::Decl *GetExternalDecl (uint32_t)         {   return NULL;                }
67254721Semaste    clang::Stmt *GetExternalDeclStmt (uint64_t)     {   return NULL;                }
68254721Semaste	clang::Selector GetExternalSelector (uint32_t)  {   return clang::Selector();   }
69254721Semaste    uint32_t GetNumExternalSelectors ()             {   return 0;                   }
70254721Semaste    clang::CXXBaseSpecifier *GetExternalCXXBaseSpecifiers (uint64_t Offset)
71254721Semaste                                                    {   return NULL;                }
72254721Semaste    void MaterializeVisibleDecls (const clang::DeclContext *DC)
73254721Semaste                                                    {   return;                     }
74254721Semaste
75254721Semaste    void InstallASTContext (clang::ASTContext *ast_context)
76254721Semaste    {
77254721Semaste        m_ast_context = ast_context;
78254721Semaste        m_ast_importer->InstallMapCompleter(ast_context, *this);
79254721Semaste    }
80254721Semaste
81254721Semaste    //
82254721Semaste    // APIs for ExternalASTSource
83254721Semaste    //
84254721Semaste
85254721Semaste    //------------------------------------------------------------------
86254721Semaste    /// Look up all Decls that match a particular name.  Only handles
87254721Semaste    /// Identifiers and DeclContexts that are either NamespaceDecls or
88254721Semaste    /// TranslationUnitDecls.  Calls SetExternalVisibleDeclsForName with
89254721Semaste    /// the result.
90254721Semaste    ///
91254721Semaste    /// The work for this function is done by
92254721Semaste    /// void FindExternalVisibleDecls (NameSearchContext &);
93254721Semaste    ///
94254721Semaste    /// @param[in] DC
95254721Semaste    ///     The DeclContext to register the found Decls in.
96254721Semaste    ///
97254721Semaste    /// @param[in] Name
98254721Semaste    ///     The name to find entries for.
99254721Semaste    ///
100254721Semaste    /// @return
101254721Semaste    ///     Whatever SetExternalVisibleDeclsForName returns.
102254721Semaste    //------------------------------------------------------------------
103254721Semaste    bool
104254721Semaste    FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
105254721Semaste                                    clang::DeclarationName Name);
106254721Semaste
107254721Semaste    //------------------------------------------------------------------
108254721Semaste    /// Enumerate all Decls in a given lexical context.
109254721Semaste    ///
110254721Semaste    /// @param[in] DC
111254721Semaste    ///     The DeclContext being searched.
112254721Semaste    ///
113254721Semaste    /// @param[in] isKindWeWant
114254721Semaste    ///     If non-NULL, a callback function that returns true given the
115254721Semaste    ///     DeclKinds of desired Decls, and false otherwise.
116254721Semaste    ///
117254721Semaste    /// @param[in] Decls
118254721Semaste    ///     A vector that is filled in with matching Decls.
119254721Semaste    //------------------------------------------------------------------
120254721Semaste    clang::ExternalLoadResult
121254721Semaste    FindExternalLexicalDecls (const clang::DeclContext *DC,
122254721Semaste                              bool (*isKindWeWant)(clang::Decl::Kind),
123254721Semaste                              llvm::SmallVectorImpl<clang::Decl*> &Decls);
124254721Semaste
125254721Semaste    //------------------------------------------------------------------
126254721Semaste    /// Specify the layout of the contents of a RecordDecl.
127254721Semaste    ///
128254721Semaste    /// @param[in] Record
129254721Semaste    ///     The record (in the parser's AST context) that needs to be
130254721Semaste    ///     laid out.
131254721Semaste    ///
132254721Semaste    /// @param[out] Size
133254721Semaste    ///     The total size of the record in bits.
134254721Semaste    ///
135254721Semaste    /// @param[out] Alignment
136254721Semaste    ///     The alignment of the record in bits.
137254721Semaste    ///
138254721Semaste    /// @param[in] FieldOffsets
139254721Semaste    ///     A map that must be populated with pairs of the record's
140254721Semaste    ///     fields (in the parser's AST context) and their offsets
141254721Semaste    ///     (measured in bits).
142254721Semaste    ///
143254721Semaste    /// @param[in] BaseOffsets
144254721Semaste    ///     A map that must be populated with pairs of the record's
145254721Semaste    ///     C++ concrete base classes (in the parser's AST context,
146254721Semaste    ///     and only if the record is a CXXRecordDecl and has base
147254721Semaste    ///     classes) and their offsets (measured in bytes).
148254721Semaste    ///
149254721Semaste    /// @param[in] VirtualBaseOffsets
150254721Semaste    ///     A map that must be populated with pairs of the record's
151254721Semaste    ///     C++ virtual base classes (in the parser's AST context,
152254721Semaste    ///     and only if the record is a CXXRecordDecl and has base
153254721Semaste    ///     classes) and their offsets (measured in bytes).
154254721Semaste    ///
155254721Semaste    /// @return
156254721Semaste    ///     True <=> the layout is valid.
157254721Semaste    //-----------------------------------------------------------------
158254721Semaste    bool
159254721Semaste    layoutRecordType(const clang::RecordDecl *Record,
160254721Semaste                     uint64_t &Size,
161254721Semaste                     uint64_t &Alignment,
162254721Semaste                     llvm::DenseMap <const clang::FieldDecl *, uint64_t> &FieldOffsets,
163254721Semaste                     llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
164254721Semaste                     llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets);
165254721Semaste
166254721Semaste    //------------------------------------------------------------------
167254721Semaste    /// Complete a TagDecl.
168254721Semaste    ///
169254721Semaste    /// @param[in] Tag
170254721Semaste    ///     The Decl to be completed in place.
171254721Semaste    //------------------------------------------------------------------
172254721Semaste    virtual void
173254721Semaste    CompleteType (clang::TagDecl *Tag);
174254721Semaste
175254721Semaste    //------------------------------------------------------------------
176254721Semaste    /// Complete an ObjCInterfaceDecl.
177254721Semaste    ///
178254721Semaste    /// @param[in] Class
179254721Semaste    ///     The Decl to be completed in place.
180254721Semaste    //------------------------------------------------------------------
181254721Semaste    virtual void
182254721Semaste    CompleteType (clang::ObjCInterfaceDecl *Class);
183254721Semaste
184254721Semaste    //------------------------------------------------------------------
185254721Semaste    /// Called on entering a translation unit.  Tells Clang by calling
186254721Semaste    /// setHasExternalVisibleStorage() and setHasExternalLexicalStorage()
187254721Semaste    /// that this object has something to say about undefined names.
188254721Semaste    ///
189254721Semaste    /// @param[in] ASTConsumer
190254721Semaste    ///     Unused.
191254721Semaste    //------------------------------------------------------------------
192254721Semaste    void StartTranslationUnit (clang::ASTConsumer *Consumer);
193254721Semaste
194254721Semaste    //
195254721Semaste    // APIs for NamespaceMapCompleter
196254721Semaste    //
197254721Semaste
198254721Semaste    //------------------------------------------------------------------
199254721Semaste    /// Look up the modules containing a given namespace and put the
200254721Semaste    /// appropriate entries in the namespace map.
201254721Semaste    ///
202254721Semaste    /// @param[in] namespace_map
203254721Semaste    ///     The map to be completed.
204254721Semaste    ///
205254721Semaste    /// @param[in] name
206254721Semaste    ///     The name of the namespace to be found.
207254721Semaste    ///
208254721Semaste    /// @param[in] parent_map
209254721Semaste    ///     The map for the namespace's parent namespace, if there is
210254721Semaste    ///     one.
211254721Semaste    //------------------------------------------------------------------
212254721Semaste    void CompleteNamespaceMap (ClangASTImporter::NamespaceMapSP &namespace_map,
213254721Semaste                               const ConstString &name,
214254721Semaste                               ClangASTImporter::NamespaceMapSP &parent_map) const;
215254721Semaste
216254721Semaste    //
217254721Semaste    // Helper APIs
218254721Semaste    //
219254721Semaste
220254721Semaste    clang::NamespaceDecl *
221254721Semaste    AddNamespace (NameSearchContext &context,
222254721Semaste                  ClangASTImporter::NamespaceMapSP &namespace_decls);
223254721Semaste
224254721Semaste    //------------------------------------------------------------------
225254721Semaste    /// The worker function for FindExternalVisibleDeclsByName.
226254721Semaste    ///
227254721Semaste    /// @param[in] context
228254721Semaste    ///     The NameSearchContext to use when filing results.
229254721Semaste    //------------------------------------------------------------------
230254721Semaste    virtual void FindExternalVisibleDecls (NameSearchContext &context);
231254721Semaste
232254721Semaste    void SetImportInProgress (bool import_in_progress) { m_import_in_progress = import_in_progress; }
233254721Semaste    bool GetImportInProgress () { return m_import_in_progress; }
234254721Semaste
235254721Semaste    void SetLookupsEnabled (bool lookups_enabled) { m_lookups_enabled = lookups_enabled; }
236254721Semaste    bool GetLookupsEnabled () { return m_lookups_enabled; }
237254721Semaste
238254721Semaste    //----------------------------------------------------------------------
239254721Semaste    /// @class ClangASTSourceProxy ClangASTSource.h "lldb/Expression/ClangASTSource.h"
240254721Semaste    /// @brief Proxy for ClangASTSource
241254721Semaste    ///
242254721Semaste    /// Clang AST contexts like to own their AST sources, so this is a
243254721Semaste    /// state-free proxy object.
244254721Semaste    //----------------------------------------------------------------------
245254721Semaste    class ClangASTSourceProxy : public ClangExternalASTSourceCommon
246254721Semaste    {
247254721Semaste    public:
248254721Semaste        ClangASTSourceProxy (ClangASTSource &original) :
249254721Semaste            m_original(original)
250254721Semaste        {
251254721Semaste        }
252254721Semaste
253254721Semaste        bool
254254721Semaste        FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
255254721Semaste                                        clang::DeclarationName Name)
256254721Semaste        {
257254721Semaste            return m_original.FindExternalVisibleDeclsByName(DC, Name);
258254721Semaste        }
259254721Semaste
260254721Semaste        clang::ExternalLoadResult
261254721Semaste        FindExternalLexicalDecls (const clang::DeclContext *DC,
262254721Semaste                                  bool (*isKindWeWant)(clang::Decl::Kind),
263254721Semaste                                  llvm::SmallVectorImpl<clang::Decl*> &Decls)
264254721Semaste        {
265254721Semaste            return m_original.FindExternalLexicalDecls(DC, isKindWeWant, Decls);
266254721Semaste        }
267254721Semaste
268254721Semaste        void
269254721Semaste        CompleteType (clang::TagDecl *Tag)
270254721Semaste        {
271254721Semaste            return m_original.CompleteType(Tag);
272254721Semaste        }
273254721Semaste
274254721Semaste        void
275254721Semaste        CompleteType (clang::ObjCInterfaceDecl *Class)
276254721Semaste        {
277254721Semaste            return m_original.CompleteType(Class);
278254721Semaste        }
279254721Semaste
280254721Semaste        bool
281254721Semaste        layoutRecordType(const clang::RecordDecl *Record,
282254721Semaste                         uint64_t &Size,
283254721Semaste                         uint64_t &Alignment,
284254721Semaste                         llvm::DenseMap <const clang::FieldDecl *, uint64_t> &FieldOffsets,
285254721Semaste                         llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
286254721Semaste                         llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets)
287254721Semaste        {
288254721Semaste            return m_original.layoutRecordType(Record,
289254721Semaste                                               Size,
290254721Semaste                                               Alignment,
291254721Semaste                                               FieldOffsets,
292254721Semaste                                               BaseOffsets,
293254721Semaste                                               VirtualBaseOffsets);
294254721Semaste        }
295254721Semaste
296254721Semaste        void StartTranslationUnit (clang::ASTConsumer *Consumer)
297254721Semaste        {
298254721Semaste            return m_original.StartTranslationUnit(Consumer);
299254721Semaste        }
300254721Semaste
301254721Semaste        ClangASTMetadata *
302254721Semaste        GetMetadata(const void * object)
303254721Semaste        {
304254721Semaste            return m_original.GetMetadata(object);
305254721Semaste        }
306254721Semaste
307254721Semaste        void
308254721Semaste        SetMetadata(const void * object, ClangASTMetadata &metadata)
309254721Semaste        {
310254721Semaste            return m_original.SetMetadata(object, metadata);
311254721Semaste        }
312254721Semaste
313254721Semaste        bool
314254721Semaste        HasMetadata(const void * object)
315254721Semaste        {
316254721Semaste            return m_original.HasMetadata(object);
317254721Semaste        }
318254721Semaste    private:
319254721Semaste        ClangASTSource &m_original;
320254721Semaste    };
321254721Semaste
322254721Semaste    clang::ExternalASTSource *CreateProxy()
323254721Semaste    {
324254721Semaste        return new ClangASTSourceProxy(*this);
325254721Semaste    }
326254721Semaste
327254721Semasteprotected:
328254721Semaste    //------------------------------------------------------------------
329254721Semaste    /// Look for the complete version of an Objective-C interface, and
330254721Semaste    /// return it if found.
331254721Semaste    ///
332254721Semaste    /// @param[in] interface_decl
333254721Semaste    ///     An ObjCInterfaceDecl that may not be the complete one.
334254721Semaste    ///
335254721Semaste    /// @return
336254721Semaste    ///     NULL if the complete interface couldn't be found;
337254721Semaste    ///     the complete interface otherwise.
338254721Semaste    //------------------------------------------------------------------
339254721Semaste    clang::ObjCInterfaceDecl *
340254721Semaste    GetCompleteObjCInterface (clang::ObjCInterfaceDecl *interface_decl);
341254721Semaste
342254721Semaste    //------------------------------------------------------------------
343254721Semaste    /// Find all entities matching a given name in a given module,
344254721Semaste    /// using a NameSearchContext to make Decls for them.
345254721Semaste    ///
346254721Semaste    /// @param[in] context
347254721Semaste    ///     The NameSearchContext that can construct Decls for this name.
348254721Semaste    ///
349254721Semaste    /// @param[in] module
350254721Semaste    ///     If non-NULL, the module to query.
351254721Semaste    ///
352254721Semaste    /// @param[in] namespace_decl
353254721Semaste    ///     If valid and module is non-NULL, the parent namespace.
354254721Semaste    ///
355254721Semaste    /// @param[in] current_id
356254721Semaste    ///     The ID for the current FindExternalVisibleDecls invocation,
357254721Semaste    ///     for logging purposes.
358254721Semaste    ///
359254721Semaste    /// @return
360254721Semaste    ///     True on success; false otherwise.
361254721Semaste    //------------------------------------------------------------------
362254721Semaste    void
363254721Semaste    FindExternalVisibleDecls (NameSearchContext &context,
364254721Semaste                              lldb::ModuleSP module,
365254721Semaste                              ClangNamespaceDecl &namespace_decl,
366254721Semaste                              unsigned int current_id);
367254721Semaste
368254721Semaste    //------------------------------------------------------------------
369254721Semaste    /// Find all Objective-C methods matching a given selector.
370254721Semaste    ///
371254721Semaste    /// @param[in] context
372254721Semaste    ///     The NameSearchContext that can construct Decls for this name.
373254721Semaste    ///     Its m_decl_name contains the selector and its m_decl_context
374254721Semaste    ///     is the containing object.
375254721Semaste    //------------------------------------------------------------------
376254721Semaste    void
377254721Semaste    FindObjCMethodDecls (NameSearchContext &context);
378254721Semaste
379254721Semaste    //------------------------------------------------------------------
380254721Semaste    /// Find all Objective-C properties and ivars with a given name.
381254721Semaste    ///
382254721Semaste    /// @param[in] context
383254721Semaste    ///     The NameSearchContext that can construct Decls for this name.
384254721Semaste    ///     Its m_decl_name contains the name and its m_decl_context
385254721Semaste    ///     is the containing object.
386254721Semaste    //------------------------------------------------------------------
387254721Semaste    void
388254721Semaste    FindObjCPropertyAndIvarDecls (NameSearchContext &context);
389254721Semaste
390254721Semaste    //------------------------------------------------------------------
391254721Semaste    /// A wrapper for ClangASTContext::CopyType that sets a flag that
392254721Semaste    /// indicates that we should not respond to queries during import.
393254721Semaste    ///
394254721Semaste    /// @param[in] dest_context
395254721Semaste    ///     The target AST context, typically the parser's AST context.
396254721Semaste    ///
397254721Semaste    /// @param[in] source_context
398254721Semaste    ///     The source AST context, typically the AST context of whatever
399254721Semaste    ///     symbol file the type was found in.
400254721Semaste    ///
401254721Semaste    /// @param[in] clang_type
402254721Semaste    ///     The source type.
403254721Semaste    ///
404254721Semaste    /// @return
405254721Semaste    ///     The imported type.
406254721Semaste    //------------------------------------------------------------------
407254721Semaste    ClangASTType
408254721Semaste    GuardedCopyType (const ClangASTType &src_type);
409254721Semaste
410254721Semaste    friend struct NameSearchContext;
411254721Semaste
412254721Semaste    bool                    m_import_in_progress;
413254721Semaste    bool                    m_lookups_enabled;
414254721Semaste
415254721Semaste    const lldb::TargetSP                m_target;           ///< The target to use in finding variables and types.
416254721Semaste	clang::ASTContext                  *m_ast_context;      ///< The AST context requests are coming in for.
417254721Semaste    ClangASTImporter                   *m_ast_importer;     ///< The target's AST importer.
418254721Semaste    std::set<const char *>              m_active_lookups;
419254721Semaste};
420254721Semaste
421254721Semaste//----------------------------------------------------------------------
422254721Semaste/// @class NameSearchContext ClangASTSource.h "lldb/Expression/ClangASTSource.h"
423254721Semaste/// @brief Container for all objects relevant to a single name lookup
424254721Semaste///
425254721Semaste/// LLDB needs to create Decls for entities it finds.  This class communicates
426254721Semaste/// what name is being searched for and provides helper functions to construct
427254721Semaste/// Decls given appropriate type information.
428254721Semaste//----------------------------------------------------------------------
429254721Semastestruct NameSearchContext {
430254721Semaste    ClangASTSource &m_ast_source;                               ///< The AST source making the request
431254721Semaste    llvm::SmallVectorImpl<clang::NamedDecl*> &m_decls;          ///< The list of declarations already constructed
432254721Semaste    ClangASTImporter::NamespaceMapSP m_namespace_map;           ///< The mapping of all namespaces found for this request back to their modules
433254721Semaste    const clang::DeclarationName &m_decl_name;                  ///< The name being looked for
434254721Semaste    const clang::DeclContext *m_decl_context;                   ///< The DeclContext to put declarations into
435254721Semaste    llvm::SmallSet <ClangASTType, 5> m_function_types;    ///< All the types of functions that have been reported, so we don't report conflicts
436254721Semaste
437254721Semaste    struct {
438254721Semaste        bool variable                   : 1;
439254721Semaste        bool function_with_type_info    : 1;
440254721Semaste        bool function                   : 1;
441254721Semaste    } m_found;
442254721Semaste
443254721Semaste    //------------------------------------------------------------------
444254721Semaste    /// Constructor
445254721Semaste    ///
446254721Semaste    /// Initializes class variables.
447254721Semaste    ///
448254721Semaste    /// @param[in] astSource
449254721Semaste    ///     A reference to the AST source making a request.
450254721Semaste    ///
451254721Semaste    /// @param[in] decls
452254721Semaste    ///     A reference to a list into which new Decls will be placed.  This
453254721Semaste    ///     list is typically empty when the function is called.
454254721Semaste    ///
455254721Semaste    /// @param[in] name
456254721Semaste    ///     The name being searched for (always an Identifier).
457254721Semaste    ///
458254721Semaste    /// @param[in] dc
459254721Semaste    ///     The DeclContext to register Decls in.
460254721Semaste    //------------------------------------------------------------------
461254721Semaste    NameSearchContext (ClangASTSource &astSource,
462254721Semaste                       llvm::SmallVectorImpl<clang::NamedDecl*> &decls,
463254721Semaste                       clang::DeclarationName &name,
464254721Semaste                       const clang::DeclContext *dc) :
465254721Semaste        m_ast_source(astSource),
466254721Semaste        m_decls(decls),
467254721Semaste        m_decl_name(name),
468254721Semaste        m_decl_context(dc)
469254721Semaste    {
470254721Semaste        memset(&m_found, 0, sizeof(m_found));
471254721Semaste    }
472254721Semaste
473254721Semaste    //------------------------------------------------------------------
474254721Semaste    /// Create a VarDecl with the name being searched for and the provided
475254721Semaste    /// type and register it in the right places.
476254721Semaste    ///
477254721Semaste    /// @param[in] type
478254721Semaste    ///     The opaque QualType for the VarDecl being registered.
479254721Semaste    //------------------------------------------------------------------
480254721Semaste    clang::NamedDecl *AddVarDecl(const ClangASTType &type);
481254721Semaste
482254721Semaste    //------------------------------------------------------------------
483254721Semaste    /// Create a FunDecl with the name being searched for and the provided
484254721Semaste    /// type and register it in the right places.
485254721Semaste    ///
486254721Semaste    /// @param[in] type
487254721Semaste    ///     The opaque QualType for the FunDecl being registered.
488254721Semaste    //------------------------------------------------------------------
489254721Semaste    clang::NamedDecl *AddFunDecl(const ClangASTType &type);
490254721Semaste
491254721Semaste    //------------------------------------------------------------------
492254721Semaste    /// Create a FunDecl with the name being searched for and generic
493254721Semaste    /// type (i.e. intptr_t NAME_GOES_HERE(...)) and register it in the
494254721Semaste    /// right places.
495254721Semaste    //------------------------------------------------------------------
496254721Semaste    clang::NamedDecl *AddGenericFunDecl();
497254721Semaste
498254721Semaste    //------------------------------------------------------------------
499254721Semaste    /// Create a TypeDecl with the name being searched for and the provided
500254721Semaste    /// type and register it in the right places.
501254721Semaste    ///
502254721Semaste    /// @param[in] type
503254721Semaste    ///     The opaque QualType for the TypeDecl being registered.
504254721Semaste    //------------------------------------------------------------------
505254721Semaste    clang::NamedDecl *AddTypeDecl(const ClangASTType &clang_type);
506254721Semaste
507254721Semaste
508254721Semaste    //------------------------------------------------------------------
509254721Semaste    /// Add Decls from the provided DeclContextLookupResult to the list
510254721Semaste    /// of results.
511254721Semaste    ///
512254721Semaste    /// @param[in] result
513254721Semaste    ///     The DeclContextLookupResult, usually returned as the result
514254721Semaste    ///     of querying a DeclContext.
515254721Semaste    //------------------------------------------------------------------
516254721Semaste    void AddLookupResult (clang::DeclContextLookupConstResult result);
517254721Semaste
518254721Semaste    //------------------------------------------------------------------
519254721Semaste    /// Add a NamedDecl to the list of results.
520254721Semaste    ///
521254721Semaste    /// @param[in] decl
522254721Semaste    ///     The NamedDecl, usually returned as the result
523254721Semaste    ///     of querying a DeclContext.
524254721Semaste    //------------------------------------------------------------------
525254721Semaste    void AddNamedDecl (clang::NamedDecl *decl);
526254721Semaste};
527254721Semaste
528254721Semaste}
529254721Semaste
530254721Semaste#endif
531