ClangASTSource.h revision 254729
11541Srgrimes//===-- ClangASTSource.h ----------------------------------------*- C++ -*-===// 21541Srgrimes// 31541Srgrimes// The LLVM Compiler Infrastructure 41541Srgrimes// 51541Srgrimes// This file is distributed under the University of Illinois Open Source 61541Srgrimes// License. See LICENSE.TXT for details. 71541Srgrimes// 81541Srgrimes//===----------------------------------------------------------------------===// 91541Srgrimes 101541Srgrimes#ifndef liblldb_ClangASTSource_h_ 111541Srgrimes#define liblldb_ClangASTSource_h_ 121541Srgrimes 131541Srgrimes#include <set> 141541Srgrimes 151541Srgrimes#include "clang/Basic/IdentifierTable.h" 161541Srgrimes#include "lldb/Symbol/ClangExternalASTSourceCommon.h" 171541Srgrimes#include "lldb/Symbol/ClangASTImporter.h" 181541Srgrimes#include "lldb/Target/Target.h" 191541Srgrimes 201541Srgrimes#include "llvm/ADT/SmallSet.h" 211541Srgrimes 221541Srgrimesnamespace lldb_private { 231541Srgrimes 241541Srgrimes//---------------------------------------------------------------------- 251541Srgrimes/// @class ClangASTSource ClangASTSource.h "lldb/Expression/ClangASTSource.h" 261541Srgrimes/// @brief Provider for named objects defined in the debug info for Clang 271541Srgrimes/// 281541Srgrimes/// As Clang parses an expression, it may encounter names that are not 291541Srgrimes/// defined inside the expression, including variables, functions, and 301541Srgrimes/// types. Clang knows the name it is looking for, but nothing else. 311541Srgrimes/// The ExternalSemaSource class provides Decls (VarDecl, FunDecl, TypeDecl) 321541Srgrimes/// to Clang for these names, consulting the ClangExpressionDeclMap to do 331541Srgrimes/// the actual lookups. 341541Srgrimes//---------------------------------------------------------------------- 351541Srgrimesclass ClangASTSource : 361541Srgrimes public ClangExternalASTSourceCommon, 371541Srgrimes public ClangASTImporter::MapCompleter 381541Srgrimes{ 3950477Speterpublic: 401541Srgrimes //------------------------------------------------------------------ 411541Srgrimes /// Constructor 4213203Swollman /// 4313203Swollman /// Initializes class variables. 441541Srgrimes /// 452112Swollman /// @param[in] declMap 4669664Speter /// A reference to the LLDB object that handles entity lookup. 4776166Smarkm //------------------------------------------------------------------ 481541Srgrimes ClangASTSource (const lldb::TargetSP &target) : 491541Srgrimes m_import_in_progress (false), 501541Srgrimes m_lookups_enabled (false), 511541Srgrimes m_target (target), 521541Srgrimes m_ast_context (NULL), 531541Srgrimes m_active_lookups () 541541Srgrimes { 551541Srgrimes m_ast_importer = m_target->GetClangASTImporter(); 561541Srgrimes } 5732011Sbde 5832011Sbde //------------------------------------------------------------------ 591541Srgrimes /// Destructor 6069664Speter //------------------------------------------------------------------ 6169664Speter ~ClangASTSource(); 6269664Speter 6369664Speter //------------------------------------------------------------------ 6469664Speter /// Interface stubs. 6569664Speter //------------------------------------------------------------------ 6669664Speter clang::Decl *GetExternalDecl (uint32_t) { return NULL; } 6769664Speter clang::Stmt *GetExternalDeclStmt (uint64_t) { return NULL; } 6869664Speter clang::Selector GetExternalSelector (uint32_t) { return clang::Selector(); } 6969664Speter uint32_t GetNumExternalSelectors () { return 0; } 7069664Speter clang::CXXBaseSpecifier *GetExternalCXXBaseSpecifiers (uint64_t Offset) 7169664Speter { return NULL; } 7269664Speter void MaterializeVisibleDecls (const clang::DeclContext *DC) 731541Srgrimes { return; } 741541Srgrimes 751541Srgrimes void InstallASTContext (clang::ASTContext *ast_context) 761541Srgrimes { 771541Srgrimes m_ast_context = ast_context; 781541Srgrimes m_ast_importer->InstallMapCompleter(ast_context, *this); 791541Srgrimes } 801541Srgrimes 811541Srgrimes // 821541Srgrimes // APIs for ExternalASTSource 831541Srgrimes // 841541Srgrimes 851541Srgrimes //------------------------------------------------------------------ 861541Srgrimes /// Look up all Decls that match a particular name. Only handles 871541Srgrimes /// Identifiers and DeclContexts that are either NamespaceDecls or 881541Srgrimes /// TranslationUnitDecls. Calls SetExternalVisibleDeclsForName with 891541Srgrimes /// the result. 901541Srgrimes /// 911541Srgrimes /// The work for this function is done by 921541Srgrimes /// void FindExternalVisibleDecls (NameSearchContext &); 931541Srgrimes /// 941541Srgrimes /// @param[in] DC 951541Srgrimes /// The DeclContext to register the found Decls in. 961541Srgrimes /// 971541Srgrimes /// @param[in] Name 981541Srgrimes /// The name to find entries for. 991541Srgrimes /// 1001541Srgrimes /// @return 1011541Srgrimes /// Whatever SetExternalVisibleDeclsForName returns. 1021541Srgrimes //------------------------------------------------------------------ 10383366Sjulian bool 10483366Sjulian FindExternalVisibleDeclsByName (const clang::DeclContext *DC, 1051541Srgrimes clang::DeclarationName Name); 10683366Sjulian 10783366Sjulian //------------------------------------------------------------------ 10842408Seivind /// Enumerate all Decls in a given lexical context. 10942453Seivind /// 11042408Seivind /// @param[in] DC 11142453Seivind /// The DeclContext being searched. 11283366Sjulian /// 1131541Srgrimes /// @param[in] isKindWeWant 1141541Srgrimes /// If non-NULL, a callback function that returns true given the 1151541Srgrimes /// DeclKinds of desired Decls, and false otherwise. 1161541Srgrimes /// 1171541Srgrimes /// @param[in] Decls 1181541Srgrimes /// A vector that is filled in with matching Decls. 11929653Sdyson //------------------------------------------------------------------ 1201541Srgrimes clang::ExternalLoadResult 1211541Srgrimes FindExternalLexicalDecls (const clang::DeclContext *DC, 12236735Sdfr bool (*isKindWeWant)(clang::Decl::Kind), 1231541Srgrimes llvm::SmallVectorImpl<clang::Decl*> &Decls); 1241541Srgrimes 12536735Sdfr //------------------------------------------------------------------ 12620069Sbde /// Specify the layout of the contents of a RecordDecl. 12720069Sbde /// 12820069Sbde /// @param[in] Record 12920069Sbde /// The record (in the parser's AST context) that needs to be 13020069Sbde /// laid out. 13120069Sbde /// 13220069Sbde /// @param[out] Size 1331541Srgrimes /// The total size of the record in bits. 13429653Sdyson /// 1351541Srgrimes /// @param[out] Alignment 1361541Srgrimes /// The alignment of the record in bits. 1371541Srgrimes /// 1381541Srgrimes /// @param[in] FieldOffsets 1391541Srgrimes /// A map that must be populated with pairs of the record's 14083366Sjulian /// fields (in the parser's AST context) and their offsets 14183366Sjulian /// (measured in bits). 1421541Srgrimes /// 1431541Srgrimes /// @param[in] BaseOffsets 1441541Srgrimes /// A map that must be populated with pairs of the record's 1451541Srgrimes /// C++ concrete base classes (in the parser's AST context, 1461541Srgrimes /// and only if the record is a CXXRecordDecl and has base 14733360Sdyson /// classes) and their offsets (measured in bytes). 14851649Sphk /// 14933360Sdyson /// @param[in] VirtualBaseOffsets 1501541Srgrimes /// A map that must be populated with pairs of the record's 1511541Srgrimes /// C++ virtual base classes (in the parser's AST context, 1521541Srgrimes /// and only if the record is a CXXRecordDecl and has base 1531541Srgrimes /// classes) and their offsets (measured in bytes). 1541541Srgrimes /// 1551541Srgrimes /// @return 1561541Srgrimes /// True <=> the layout is valid. 1571541Srgrimes //----------------------------------------------------------------- 1581541Srgrimes bool 1591541Srgrimes layoutRecordType(const clang::RecordDecl *Record, 1601541Srgrimes uint64_t &Size, 1611541Srgrimes uint64_t &Alignment, 1621541Srgrimes llvm::DenseMap <const clang::FieldDecl *, uint64_t> &FieldOffsets, 1631541Srgrimes llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets, 1641541Srgrimes llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets); 1651541Srgrimes 1661541Srgrimes //------------------------------------------------------------------ 1671541Srgrimes /// Complete a TagDecl. 1683148Sphk /// 1693148Sphk /// @param[in] Tag 17029653Sdyson /// The Decl to be completed in place. 1711541Srgrimes //------------------------------------------------------------------ 1721541Srgrimes virtual void 1731541Srgrimes CompleteType (clang::TagDecl *Tag); 1741541Srgrimes 1751541Srgrimes //------------------------------------------------------------------ 1761541Srgrimes /// Complete an ObjCInterfaceDecl. 1771541Srgrimes /// 17829653Sdyson /// @param[in] Class 1791541Srgrimes /// The Decl to be completed in place. 1801541Srgrimes //------------------------------------------------------------------ 18132286Sdyson virtual void 18249101Salc CompleteType (clang::ObjCInterfaceDecl *Class); 18332286Sdyson 18442315Seivind //------------------------------------------------------------------ 18542315Seivind /// Called on entering a translation unit. Tells Clang by calling 18683366Sjulian /// setHasExternalVisibleStorage() and setHasExternalLexicalStorage() 18742315Seivind /// that this object has something to say about undefined names. 18832286Sdyson /// 1891541Srgrimes /// @param[in] ASTConsumer 1901541Srgrimes /// Unused. 1911541Srgrimes //------------------------------------------------------------------ 19283366Sjulian void StartTranslationUnit (clang::ASTConsumer *Consumer); 1931541Srgrimes 1941541Srgrimes // 1951541Srgrimes // APIs for NamespaceMapCompleter 1961541Srgrimes // 1971541Srgrimes 19829653Sdyson //------------------------------------------------------------------ 1991541Srgrimes /// Look up the modules containing a given namespace and put the 2001541Srgrimes /// appropriate entries in the namespace map. 2011541Srgrimes /// 2021541Srgrimes /// @param[in] namespace_map 2031541Srgrimes /// The map to be completed. 2041541Srgrimes /// 2051541Srgrimes /// @param[in] name 2061541Srgrimes /// The name of the namespace to be found. 2071541Srgrimes /// 20883366Sjulian /// @param[in] parent_map 2091541Srgrimes /// The map for the namespace's parent namespace, if there is 2103148Sphk /// one. 2113148Sphk //------------------------------------------------------------------ 2121541Srgrimes void CompleteNamespaceMap (ClangASTImporter::NamespaceMapSP &namespace_map, 21329653Sdyson const ConstString &name, 2141541Srgrimes ClangASTImporter::NamespaceMapSP &parent_map) const; 2151541Srgrimes 2161541Srgrimes // 21778692Sdillon // Helper APIs 21878692Sdillon // 21978692Sdillon 22078692Sdillon clang::NamespaceDecl * 22178692Sdillon AddNamespace (NameSearchContext &context, 22278692Sdillon ClangASTImporter::NamespaceMapSP &namespace_decls); 2231541Srgrimes 2241541Srgrimes //------------------------------------------------------------------ 22529653Sdyson /// The worker function for FindExternalVisibleDeclsByName. 2261541Srgrimes /// 2271541Srgrimes /// @param[in] context 2281541Srgrimes /// The NameSearchContext to use when filing results. 2291541Srgrimes //------------------------------------------------------------------ 2301541Srgrimes virtual void FindExternalVisibleDecls (NameSearchContext &context); 23129653Sdyson 2321541Srgrimes void SetImportInProgress (bool import_in_progress) { m_import_in_progress = import_in_progress; } 2331541Srgrimes bool GetImportInProgress () { return m_import_in_progress; } 2341541Srgrimes 2351541Srgrimes void SetLookupsEnabled (bool lookups_enabled) { m_lookups_enabled = lookups_enabled; } 2361541Srgrimes bool GetLookupsEnabled () { return m_lookups_enabled; } 2371541Srgrimes 2381541Srgrimes //---------------------------------------------------------------------- 23929653Sdyson /// @class ClangASTSourceProxy ClangASTSource.h "lldb/Expression/ClangASTSource.h" 2401541Srgrimes /// @brief Proxy for ClangASTSource 2411541Srgrimes /// 2421541Srgrimes /// Clang AST contexts like to own their AST sources, so this is a 2431541Srgrimes /// state-free proxy object. 2441541Srgrimes //---------------------------------------------------------------------- 2451541Srgrimes class ClangASTSourceProxy : public ClangExternalASTSourceCommon 2461541Srgrimes { 2471541Srgrimes public: 2481541Srgrimes ClangASTSourceProxy (ClangASTSource &original) : 2491541Srgrimes m_original(original) 2501541Srgrimes { 2511541Srgrimes } 2521541Srgrimes 2531541Srgrimes bool 2541541Srgrimes FindExternalVisibleDeclsByName (const clang::DeclContext *DC, 2551541Srgrimes clang::DeclarationName Name) 2561541Srgrimes { 2571541Srgrimes return m_original.FindExternalVisibleDeclsByName(DC, Name); 2581541Srgrimes } 2591541Srgrimes 2601541Srgrimes clang::ExternalLoadResult 2611541Srgrimes FindExternalLexicalDecls (const clang::DeclContext *DC, 2621541Srgrimes bool (*isKindWeWant)(clang::Decl::Kind), 2631541Srgrimes llvm::SmallVectorImpl<clang::Decl*> &Decls) 2641541Srgrimes { 2651541Srgrimes return m_original.FindExternalLexicalDecls(DC, isKindWeWant, Decls); 2661541Srgrimes } 2678876Srgrimes 2681541Srgrimes void 2691541Srgrimes CompleteType (clang::TagDecl *Tag) 2701541Srgrimes { 2711541Srgrimes return m_original.CompleteType(Tag); 2721541Srgrimes } 2731541Srgrimes 2741541Srgrimes void 2751541Srgrimes CompleteType (clang::ObjCInterfaceDecl *Class) 2761541Srgrimes { 2771541Srgrimes return m_original.CompleteType(Class); 2781541Srgrimes } 2791541Srgrimes 2801541Srgrimes bool 2811541Srgrimes layoutRecordType(const clang::RecordDecl *Record, 2821541Srgrimes uint64_t &Size, 2831541Srgrimes uint64_t &Alignment, 2841541Srgrimes llvm::DenseMap <const clang::FieldDecl *, uint64_t> &FieldOffsets, 2851541Srgrimes llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets, 2861541Srgrimes llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) 2871541Srgrimes { 2881541Srgrimes return m_original.layoutRecordType(Record, 2891541Srgrimes Size, 2901541Srgrimes Alignment, 2911541Srgrimes FieldOffsets, 2921541Srgrimes BaseOffsets, 2931541Srgrimes VirtualBaseOffsets); 2941541Srgrimes } 2959804Sbde 2961541Srgrimes void StartTranslationUnit (clang::ASTConsumer *Consumer) 29765805Sbp { 2981541Srgrimes return m_original.StartTranslationUnit(Consumer); 29983366Sjulian } 3001541Srgrimes 3011541Srgrimes ClangASTMetadata * 3021541Srgrimes GetMetadata(const void * object) 3031541Srgrimes { 3041541Srgrimes return m_original.GetMetadata(object); 3051541Srgrimes } 3061541Srgrimes 30722874Sbde void 30822874Sbde SetMetadata(const void * object, ClangASTMetadata &metadata) 3091541Srgrimes { 3101541Srgrimes return m_original.SetMetadata(object, metadata); 3111541Srgrimes } 3121541Srgrimes 3131541Srgrimes bool 3141541Srgrimes HasMetadata(const void * object) 31583366Sjulian { 3161541Srgrimes return m_original.HasMetadata(object); 3171541Srgrimes } 3181541Srgrimes private: 3191541Srgrimes ClangASTSource &m_original; 3201541Srgrimes }; 3211541Srgrimes 3221541Srgrimes clang::ExternalASTSource *CreateProxy() 3231541Srgrimes { 3241541Srgrimes return new ClangASTSourceProxy(*this); 3251541Srgrimes } 3261541Srgrimes 3271541Srgrimesprotected: 32851906Sphk //------------------------------------------------------------------ 3291541Srgrimes /// Look for the complete version of an Objective-C interface, and 3301541Srgrimes /// return it if found. 3311541Srgrimes /// 3321541Srgrimes /// @param[in] interface_decl 3331541Srgrimes /// An ObjCInterfaceDecl that may not be the complete one. 3341541Srgrimes /// 3351541Srgrimes /// @return 3361541Srgrimes /// NULL if the complete interface couldn't be found; 3371541Srgrimes /// the complete interface otherwise. 3381541Srgrimes //------------------------------------------------------------------ 3391541Srgrimes clang::ObjCInterfaceDecl * 3401541Srgrimes GetCompleteObjCInterface (clang::ObjCInterfaceDecl *interface_decl); 3411541Srgrimes 3429804Sbde //------------------------------------------------------------------ 3439804Sbde /// Find all entities matching a given name in a given module, 3449804Sbde /// using a NameSearchContext to make Decls for them. 3459804Sbde /// 3469804Sbde /// @param[in] context 3479804Sbde /// The NameSearchContext that can construct Decls for this name. 3489804Sbde /// 3499804Sbde /// @param[in] module 3509804Sbde /// If non-NULL, the module to query. 3519804Sbde /// 3529804Sbde /// @param[in] namespace_decl 3539804Sbde /// If valid and module is non-NULL, the parent namespace. 3549804Sbde /// 3559804Sbde /// @param[in] current_id 3569804Sbde /// The ID for the current FindExternalVisibleDecls invocation, 3579804Sbde /// for logging purposes. 3589804Sbde /// 3599804Sbde /// @return 3609804Sbde /// True on success; false otherwise. 3611541Srgrimes //------------------------------------------------------------------ 3621541Srgrimes void 3631541Srgrimes FindExternalVisibleDecls (NameSearchContext &context, 3641541Srgrimes lldb::ModuleSP module, 3651541Srgrimes ClangNamespaceDecl &namespace_decl, 3661541Srgrimes unsigned int current_id); 3671541Srgrimes 3681541Srgrimes //------------------------------------------------------------------ 3691541Srgrimes /// Find all Objective-C methods matching a given selector. 3701541Srgrimes /// 3711541Srgrimes /// @param[in] context 3721541Srgrimes /// The NameSearchContext that can construct Decls for this name. 3731541Srgrimes /// Its m_decl_name contains the selector and its m_decl_context 3741541Srgrimes /// is the containing object. 3751541Srgrimes //------------------------------------------------------------------ 3761541Srgrimes void 3771541Srgrimes FindObjCMethodDecls (NameSearchContext &context); 3781541Srgrimes 3791541Srgrimes //------------------------------------------------------------------ 3801541Srgrimes /// Find all Objective-C properties and ivars with a given name. 38122521Sdyson /// 38222521Sdyson /// @param[in] context 38322521Sdyson /// The NameSearchContext that can construct Decls for this name. 38422521Sdyson /// Its m_decl_name contains the name and its m_decl_context 3851541Srgrimes /// is the containing object. 3861541Srgrimes //------------------------------------------------------------------ 3871541Srgrimes void 3881541Srgrimes FindObjCPropertyAndIvarDecls (NameSearchContext &context); 3891541Srgrimes 3901541Srgrimes //------------------------------------------------------------------ 3911541Srgrimes /// A wrapper for ClangASTContext::CopyType that sets a flag that 3921541Srgrimes /// indicates that we should not respond to queries during import. 3931541Srgrimes /// 3941541Srgrimes /// @param[in] dest_context 39583366Sjulian /// The target AST context, typically the parser's AST context. 39654655Seivind /// 3971541Srgrimes /// @param[in] source_context 3981541Srgrimes /// The source AST context, typically the AST context of whatever 3991541Srgrimes /// symbol file the type was found in. 4001541Srgrimes /// 4011541Srgrimes /// @param[in] clang_type 4021541Srgrimes /// The source type. 4031541Srgrimes /// 4041541Srgrimes /// @return 4051541Srgrimes /// The imported type. 4061541Srgrimes //------------------------------------------------------------------ 4071541Srgrimes ClangASTType 4081541Srgrimes GuardedCopyType (const ClangASTType &src_type); 4091541Srgrimes 4101541Srgrimes friend struct NameSearchContext; 41151649Sphk 41251649Sphk bool m_import_in_progress; 4131541Srgrimes bool m_lookups_enabled; 4141541Srgrimes 4151541Srgrimes const lldb::TargetSP m_target; ///< The target to use in finding variables and types. 41651649Sphk clang::ASTContext *m_ast_context; ///< The AST context requests are coming in for. 41751649Sphk ClangASTImporter *m_ast_importer; ///< The target's AST importer. 41851649Sphk std::set<const char *> m_active_lookups; 4191541Srgrimes}; 4201541Srgrimes 4211541Srgrimes//---------------------------------------------------------------------- 4221541Srgrimes/// @class NameSearchContext ClangASTSource.h "lldb/Expression/ClangASTSource.h" 4231541Srgrimes/// @brief Container for all objects relevant to a single name lookup 4241541Srgrimes/// 4251541Srgrimes/// LLDB needs to create Decls for entities it finds. This class communicates 4261541Srgrimes/// what name is being searched for and provides helper functions to construct 42769405Salfred/// Decls given appropriate type information. 42869405Salfred//---------------------------------------------------------------------- 42969405Salfredstruct NameSearchContext { 43069405Salfred ClangASTSource &m_ast_source; ///< The AST source making the request 4311541Srgrimes llvm::SmallVectorImpl<clang::NamedDecl*> &m_decls; ///< The list of declarations already constructed 4321541Srgrimes ClangASTImporter::NamespaceMapSP m_namespace_map; ///< The mapping of all namespaces found for this request back to their modules 4331541Srgrimes const clang::DeclarationName &m_decl_name; ///< The name being looked for 4341541Srgrimes const clang::DeclContext *m_decl_context; ///< The DeclContext to put declarations into 43583366Sjulian llvm::SmallSet <ClangASTType, 5> m_function_types; ///< All the types of functions that have been reported, so we don't report conflicts 4361541Srgrimes 4371541Srgrimes struct { 4381541Srgrimes bool variable : 1; 4391541Srgrimes bool function_with_type_info : 1; 4401541Srgrimes bool function : 1; 4411541Srgrimes } m_found; 4421541Srgrimes 4431541Srgrimes //------------------------------------------------------------------ 44422521Sdyson /// Constructor 44565973Sbp /// 44624624Sdfr /// Initializes class variables. 44743301Sdillon /// 44842408Seivind /// @param[in] astSource 4491541Srgrimes /// A reference to the AST source making a request. 4501541Srgrimes /// 4511541Srgrimes /// @param[in] decls 4521541Srgrimes /// A reference to a list into which new Decls will be placed. This 45369405Salfred /// list is typically empty when the function is called. 4541541Srgrimes /// 4551541Srgrimes /// @param[in] name 4561541Srgrimes /// The name being searched for (always an Identifier). 45765973Sbp /// 45865973Sbp /// @param[in] dc 45965973Sbp /// The DeclContext to register Decls in. 46065973Sbp //------------------------------------------------------------------ 4611541Srgrimes NameSearchContext (ClangASTSource &astSource, 46283366Sjulian llvm::SmallVectorImpl<clang::NamedDecl*> &decls, 4631541Srgrimes clang::DeclarationName &name, 4641541Srgrimes const clang::DeclContext *dc) : 4651541Srgrimes m_ast_source(astSource), 4661541Srgrimes m_decls(decls), 4671541Srgrimes m_decl_name(name), 4681541Srgrimes m_decl_context(dc) 4691541Srgrimes { 4701541Srgrimes memset(&m_found, 0, sizeof(m_found)); 4711541Srgrimes } 47211644Sdg 4731541Srgrimes //------------------------------------------------------------------ 4741541Srgrimes /// Create a VarDecl with the name being searched for and the provided 4751541Srgrimes /// type and register it in the right places. 4769804Sbde /// 4779804Sbde /// @param[in] type 4789804Sbde /// The opaque QualType for the VarDecl being registered. 4799804Sbde //------------------------------------------------------------------ 4809804Sbde clang::NamedDecl *AddVarDecl(const ClangASTType &type); 4811541Srgrimes 4821541Srgrimes //------------------------------------------------------------------ 4831541Srgrimes /// Create a FunDecl with the name being searched for and the provided 4841541Srgrimes /// type and register it in the right places. 4851541Srgrimes /// 4861541Srgrimes /// @param[in] type 4871541Srgrimes /// The opaque QualType for the FunDecl being registered. 4881541Srgrimes //------------------------------------------------------------------ 4891541Srgrimes clang::NamedDecl *AddFunDecl(const ClangASTType &type); 4901541Srgrimes 4911541Srgrimes //------------------------------------------------------------------ 4921541Srgrimes /// Create a FunDecl with the name being searched for and generic 4931541Srgrimes /// type (i.e. intptr_t NAME_GOES_HERE(...)) and register it in the 4941541Srgrimes /// right places. 4951541Srgrimes //------------------------------------------------------------------ 49624624Sdfr clang::NamedDecl *AddGenericFunDecl(); 49724624Sdfr 4981541Srgrimes //------------------------------------------------------------------ 4991541Srgrimes /// Create a TypeDecl with the name being searched for and the provided 5001541Srgrimes /// type and register it in the right places. 5011541Srgrimes /// 5021541Srgrimes /// @param[in] type 5031541Srgrimes /// The opaque QualType for the TypeDecl being registered. 5041541Srgrimes //------------------------------------------------------------------ 5051541Srgrimes clang::NamedDecl *AddTypeDecl(const ClangASTType &clang_type); 5061541Srgrimes 5071541Srgrimes 5081541Srgrimes //------------------------------------------------------------------ 5091541Srgrimes /// Add Decls from the provided DeclContextLookupResult to the list 5101541Srgrimes /// of results. 5111541Srgrimes /// 5121541Srgrimes /// @param[in] result 5131541Srgrimes /// The DeclContextLookupResult, usually returned as the result 5141541Srgrimes /// of querying a DeclContext. 5151541Srgrimes //------------------------------------------------------------------ 5161541Srgrimes void AddLookupResult (clang::DeclContextLookupConstResult result); 51783366Sjulian 5181541Srgrimes //------------------------------------------------------------------ 51983366Sjulian /// Add a NamedDecl to the list of results. 52022521Sdyson /// 52183366Sjulian /// @param[in] decl 52265805Sbp /// The NamedDecl, usually returned as the result 52365805Sbp /// of querying a DeclContext. 5241541Srgrimes //------------------------------------------------------------------ 52565805Sbp void AddNamedDecl (clang::NamedDecl *decl); 52665805Sbp}; 5271541Srgrimes 5281541Srgrimes} 5291541Srgrimes 53010219Sdfr#endif 53110219Sdfr