本文整理汇总了C++中ConstString::GetStringRef方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstString::GetStringRef方法的具体用法?C++ ConstString::GetStringRef怎么用?C++ ConstString::GetStringRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstString
的用法示例。
在下文中一共展示了ConstString::GetStringRef方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lookup_result
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;
}
示例2: AppendProperty
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();
}
示例3: GetPropertyAtIndex
// 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;
}
示例4: RegularExpressionSP
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);
}
示例5: 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);
}
示例6: format_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);
}
示例7: GoInterpreter
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);
}
}
}
示例8: FindExactMatches
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;
}
示例9: synth_sp
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);
}
示例10: filter_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);
}
示例11: FindPartialMatches
// 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;
}
示例12:
uint32_t
OptionValueProperties::GetPropertyIndex(const ConstString &name) const {
return m_name_to_index.Find(name.GetStringRef(), SIZE_MAX);
}
示例13: Add
void Add(ConstString &type_name, ConstString &type_equivalent) {
m_impl.Insert(type_name.GetStringRef(), type_equivalent);
}