本文整理汇总了C++中TypeMap类的典型用法代码示例。如果您正苦于以下问题:C++ TypeMap类的具体用法?C++ TypeMap怎么用?C++ TypeMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TypeMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_F
TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestTypedefs)) {
FileSpec fspec(m_types_test_exe.c_str(), false);
ArchSpec aspec("i686-pc-windows");
lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
SymbolVendor *plugin = module->GetSymbolVendor();
SymbolFilePDB *symfile =
static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
SymbolContext sc;
llvm::DenseSet<SymbolFile *> searched_files;
TypeMap results;
const char *TypedefsToCheck[] = {"ClassTypedef", "NSClassTypedef"};
for (auto Typedef : TypedefsToCheck) {
TypeMap results;
EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString(Typedef), nullptr, false,
0, searched_files, results));
EXPECT_EQ(1u, results.GetSize());
lldb::TypeSP typedef_type = results.GetTypeAtIndex(0);
EXPECT_EQ(ConstString(Typedef), typedef_type->GetName());
CompilerType compiler_type = typedef_type->GetFullCompilerType();
ClangASTContext *clang_type_system =
llvm::dyn_cast_or_null<ClangASTContext>(compiler_type.GetTypeSystem());
EXPECT_TRUE(
clang_type_system->IsTypedefType(compiler_type.GetOpaqueQualType()));
std::string sizeof_var = "sizeof_";
sizeof_var.append(Typedef);
EXPECT_EQ(GetGlobalConstantInteger(session, sizeof_var.c_str()),
typedef_type->GetByteSize());
}
}
示例2: main
int main()
{
TypeMap bin;
fillBin("Trash.dat", bin); // Sorting happens
TypeMap::iterator it;
for (it = bin.begin(); it != bin.end(); it++)
sumValue((*it).second);
} ///:~
示例3: GetType
Type* Protobuf::GetType(const Descriptor* descriptor) {
TypeMap::iterator it = mTypeMap.find(descriptor);
if (it != mTypeMap.end())
return it->second;
Type* result = mTypeMap[descriptor] =
new Type(this,
factory.GetPrototype(descriptor)->New(),
TypeTemplate->GetFunction()->NewInstance(),
handles.size());
handles.push_back(result);
Handle<Array> types = handle_->GetInternalField(1).As<Array>();
types->Set(types->Length(), result->handle_);
return result;
}
示例4:
size_t
SymbolFile::FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types)
{
if (!append)
types.Clear();
return 0;
}
示例5: getOverlappingTypeInfos
static
std::pair<typename ContainerTraits<TypeMap>::Iterator, typename ContainerTraits<TypeMap>::Iterator>
getOverlappingTypeInfos(TypeMap& tmap, size_t from, size_t len)
{
typedef typename ContainerTraits<TypeMap>::Iterator Iterator;
Iterator first = tmap.begin();
Iterator last = tmap.end();
Iterator ub = tmap.lower_bound(from + len);
// the same for the beginning, but there we need the previous map entry
Iterator lb = tmap.lower_bound(from);
lb = adjustPosOnOverlap(first, lb, from);
return std::make_pair(lb, ub);
}
示例6: FindTypes
uint32_t SymbolFile::FindTypes(
const SymbolContext &sc, const ConstString &name,
const CompilerDeclContext *parent_decl_ctx, bool append,
uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeMap &types) {
if (!append)
types.Clear();
return 0;
}
示例7: FindTypes
size_t SymbolVendor::FindTypes(const std::vector<CompilerContext> &context,
bool append, TypeMap &types) {
ModuleSP module_sp(GetModule());
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
if (m_sym_file_ap.get())
return m_sym_file_ap->FindTypes(context, append, types);
}
if (!append)
types.Clear();
return 0;
}
示例8: mapWithCommonTypes
TypeMap mapWithCommonTypes() {
TypeMap m;
m.emplace(typeid(short), MPI_SHORT);
m.emplace(typeid(unsigned short), MPI_UNSIGNED_SHORT);
m.emplace(typeid(int), MPI_INT);
m.emplace(typeid(unsigned int), MPI_UNSIGNED);
m.emplace(typeid(long long), MPI_LONG_LONG_INT);
m.emplace(typeid(unsigned long long), MPI_UNSIGNED_LONG_LONG);
return m;
}
示例9: module_sp
size_t
SymbolVendor::FindTypes (const SymbolContext& sc, const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches, TypeMap& types)
{
ModuleSP module_sp(GetModule());
if (module_sp)
{
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
if (m_sym_file_ap.get())
return m_sym_file_ap->FindTypes(sc, name, parent_decl_ctx, append, max_matches, types);
}
if (!append)
types.Clear();
return 0;
}
示例10: typeMap
DataTypeFactory::TypeMap DataTypeFactory::typeMap()
{
static TypeMap typeMap;
if (typeMap.isEmpty()) {
typeMap.insert(Type::Integer, "Integer");
typeMap.insert(Type::Gauge32, "Gauge32");
typeMap.insert(Type::Counter32, "Counter32");
typeMap.insert(Type::OctetString, "String");
typeMap.insert(Type::IpAddress, "IpAddress");
typeMap.insert(Type::NullObject, "Unknown type");
}
return typeMap;
}
示例11: has_task_or_graph_type
static bool has_task_or_graph_type(TypeMap<bool>& cache, const Type* type) {
if (cache.emplace(type, false).second) {
if (is_task_type(type) || is_graph_type(type))
return cache[type] = true;
bool contains = false;
for (auto op : type->ops()) {
if (has_task_or_graph_type(cache, op)) {
contains = true;
break;
}
}
return cache[type] = contains;
}
return cache[type];
}
示例12: while
void
SymbolContext::SortTypeList(TypeMap &type_map, TypeList &type_list ) const
{
Block * curr_block = block;
bool isInlinedblock = false;
if (curr_block != nullptr && curr_block->GetContainingInlinedBlock() != nullptr)
isInlinedblock = true;
while (curr_block != nullptr && !isInlinedblock)
{
TypeMoveMatchingBlock callbackBlock (curr_block, type_map, type_list);
type_map.ForEach(callbackBlock);
curr_block = curr_block->GetParent();
}
if(function != nullptr && type_map.GetSize() > 0)
{
TypeMoveMatchingFunction callbackFunction (function, type_map, type_list);
type_map.ForEach(callbackFunction);
}
if(comp_unit != nullptr && type_map.GetSize() > 0)
{
TypeMoveMatchingCompileUnit callbackCompileUnit (comp_unit, type_map, type_list);
type_map.ForEach(callbackCompileUnit);
}
if(module_sp && type_map.GetSize() > 0)
{
TypeMoveMatchingModule callbackModule (module_sp, type_map, type_list);
type_map.ForEach(callbackModule);
}
if(type_map.GetSize() > 0)
{
TypeMaptoList callbackM2L (type_map, type_list);
type_map.ForEach(callbackM2L);
}
return ;
}
示例13: begin
// forech-able necessary methods.
typename TypeMap::iterator begin() {
return bindings.begin();
}
示例14: get
typename TypeMap::iterator get( TypeInfoP interface){
return bindings.find( std::type_index(*interface));
}
示例15: found
bool found(typename TypeMap::iterator it){
return it != bindings.end();
}