uint32_t ClangModulesDeclVendorImpl::FindDecls (const ConstString &name, bool append, uint32_t max_matches, std::vector <clang::NamedDecl*> &decls) { if (!append) decls.clear(); clang::IdentifierInfo &ident = m_compiler_instance->getASTContext().Idents.get(name.GetStringRef()); clang::LookupResult lookup_result(m_compiler_instance->getSema(), clang::DeclarationName(&ident), clang::SourceLocation(), clang::Sema::LookupOrdinaryName); m_compiler_instance->getSema().LookupName(lookup_result, m_compiler_instance->getSema().getScopeForContext(m_compiler_instance->getASTContext().getTranslationUnitDecl())); uint32_t num_matches = 0; for (clang::NamedDecl *named_decl : lookup_result) { if (num_matches >= max_matches) return num_matches; decls.push_back(named_decl); ++num_matches; } return num_matches; }
void OptionValueProperties::AppendProperty(const ConstString &name, const ConstString &desc, bool is_global, const OptionValueSP &value_sp) { Property property(name, desc, is_global, value_sp); m_name_to_index.Append(name.GetStringRef(), m_properties.size()); m_properties.push_back(property); value_sp->SetParent(shared_from_this()); m_name_to_index.Sort(); }
// bool // OptionValueProperties::GetQualifiedName (Stream &strm) //{ // bool dumped_something = false; //// lldb::OptionValuePropertiesSP parent_sp(GetParent ()); //// if (parent_sp) //// { //// parent_sp->GetQualifiedName (strm); //// strm.PutChar('.'); //// dumped_something = true; //// } // if (m_name) // { // strm << m_name; // dumped_something = true; // } // return dumped_something; //} // lldb::OptionValueSP OptionValueProperties::GetValueForKey(const ExecutionContext *exe_ctx, const ConstString &key, bool will_modify) const { lldb::OptionValueSP value_sp; size_t idx = m_name_to_index.Find(key.GetStringRef(), SIZE_MAX); if (idx < m_properties.size()) value_sp = GetPropertyAtIndex(exe_ctx, will_modify, idx)->GetValue(); return value_sp; }
void lldb_private::formatters::AddSummary( TypeCategoryImpl::SharedPointer category_sp, TypeSummaryImplSP summary_sp, ConstString type_name, bool regex) { if (regex) category_sp->GetRegexTypeSummariesContainer()->Add( RegularExpressionSP(new RegularExpression(type_name.GetStringRef())), summary_sp); else category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp); }
void lldb_private::formatters::AddStringSummary( TypeCategoryImpl::SharedPointer category_sp, const char *string, ConstString type_name, TypeSummaryImpl::Flags flags, bool regex) { lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags, string)); if (regex) category_sp->GetRegexTypeSummariesContainer()->Add( RegularExpressionSP(new RegularExpression(type_name.GetStringRef())), summary_sp); else category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp); }
void lldb_private::formatters::AddFormat( TypeCategoryImpl::SharedPointer category_sp, lldb::Format format, ConstString type_name, TypeFormatImpl::Flags flags, bool regex) { lldb::TypeFormatImplSP format_sp(new TypeFormatImpl_Format(format, flags)); if (regex) category_sp->GetRegexTypeFormatsContainer()->Add( RegularExpressionSP(new RegularExpression(type_name.GetStringRef())), format_sp); else category_sp->GetTypeFormatsContainer()->Add(type_name, format_sp); }
void lldb_private::formatters::AddCXXSummary( TypeCategoryImpl::SharedPointer category_sp, CXXFunctionSummaryFormat::Callback funct, const char *description, ConstString type_name, TypeSummaryImpl::Flags flags, bool regex) { lldb::TypeSummaryImplSP summary_sp( new CXXFunctionSummaryFormat(flags, funct, description)); if (regex) category_sp->GetRegexTypeSummariesContainer()->Add( RegularExpressionSP(new RegularExpression(type_name.GetStringRef())), summary_sp); else category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp); }
void lldb_private::formatters::AddOneLineSummary( TypeCategoryImpl::SharedPointer category_sp, ConstString type_name, TypeSummaryImpl::Flags flags, bool regex) { flags.SetShowMembersOneLiner(true); lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags, "")); if (regex) category_sp->GetRegexTypeSummariesContainer()->Add( RegularExpressionSP(new RegularExpression(type_name.GetStringRef())), summary_sp); else category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp); }
GoInterpreter(ExecutionContext &exe_ctx, const char *expr) : m_exe_ctx(exe_ctx), m_frame(exe_ctx.GetFrameSP()), m_parser(expr) { if (m_frame) { const SymbolContext &ctx = m_frame->GetSymbolContext(eSymbolContextFunction); ConstString fname = ctx.GetFunctionName(); if (fname.GetLength() > 0) { size_t dot = fname.GetStringRef().find('.'); if (dot != llvm::StringRef::npos) m_package = llvm::StringRef(fname.AsCString(), dot); } } }
uint32_t FindExactMatches(ConstString &type_name, std::vector<ConstString> &equivalents) { uint32_t count = 0; for (ImplData match = m_impl.FindFirstValueForName(type_name.GetStringRef()); match != nullptr; match = m_impl.FindNextValueForName(match)) { equivalents.push_back(match->value); count++; } return count; }
void lldb_private::formatters::AddCXXSynthetic( TypeCategoryImpl::SharedPointer category_sp, CXXSyntheticChildren::CreateFrontEndCallback generator, const char *description, ConstString type_name, ScriptedSyntheticChildren::Flags flags, bool regex) { lldb::SyntheticChildrenSP synth_sp( new CXXSyntheticChildren(flags, description, generator)); if (regex) category_sp->GetRegexTypeSyntheticsContainer()->Add( RegularExpressionSP(new RegularExpression(type_name.GetStringRef())), synth_sp); else category_sp->GetTypeSyntheticsContainer()->Add(type_name, synth_sp); }
void lldb_private::formatters::AddFilter( TypeCategoryImpl::SharedPointer category_sp, std::vector<std::string> children, const char *description, ConstString type_name, ScriptedSyntheticChildren::Flags flags, bool regex) { TypeFilterImplSP filter_sp(new TypeFilterImpl(flags)); for (auto child : children) filter_sp->AddExpressionPath(child); if (regex) category_sp->GetRegexTypeFiltersContainer()->Add( RegularExpressionSP(new RegularExpression(type_name.GetStringRef())), filter_sp); else category_sp->GetTypeFiltersContainer()->Add(type_name, filter_sp); }
// partial matches can occur when a name with equivalents is a template // argument. // e.g. we may have "class Foo" be a match for "struct Bar". if we have a // typename // such as "class Templatized<class Foo, Anything>" we want this to be // replaced with // "class Templatized<struct Bar, Anything>". Since partial matching is time // consuming // once we get a partial match, we add it to the exact matches list for faster // retrieval uint32_t FindPartialMatches(ConstString &type_name, std::vector<ConstString> &equivalents) { uint32_t count = 0; llvm::StringRef type_name_cstr = type_name.GetStringRef(); size_t items_count = m_impl.GetSize(); for (size_t item = 0; item < items_count; item++) { llvm::StringRef key_cstr = m_impl.GetCStringAtIndex(item); if (type_name_cstr.contains(key_cstr)) { count += AppendReplacements(type_name_cstr, key_cstr, equivalents); } } return count; }
uint32_t OptionValueProperties::GetPropertyIndex(const ConstString &name) const { return m_name_to_index.Find(name.GetStringRef(), SIZE_MAX); }
void Add(ConstString &type_name, ConstString &type_equivalent) { m_impl.Insert(type_name.GetStringRef(), type_equivalent); }