本文整理汇总了C++中llvm::DenseMap::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ DenseMap::clear方法的具体用法?C++ DenseMap::clear怎么用?C++ DenseMap::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::DenseMap
的用法示例。
在下文中一共展示了DenseMap::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LayoutRecordType
bool ClangASTImporter::LayoutRecordType(
const clang::RecordDecl *record_decl, uint64_t &bit_size,
uint64_t &alignment,
llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
&base_offsets,
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
&vbase_offsets) {
RecordDeclToLayoutMap::iterator pos =
m_record_decl_to_layout_map.find(record_decl);
bool success = false;
base_offsets.clear();
vbase_offsets.clear();
if (pos != m_record_decl_to_layout_map.end()) {
bit_size = pos->second.bit_size;
alignment = pos->second.alignment;
field_offsets.swap(pos->second.field_offsets);
base_offsets.swap(pos->second.base_offsets);
vbase_offsets.swap(pos->second.vbase_offsets);
m_record_decl_to_layout_map.erase(pos);
success = true;
} else {
bit_size = 0;
alignment = 0;
field_offsets.clear();
}
return success;
}
示例2: AddMethodsToClass
void CGObjCJit::AddMethodsToClass(void *theClass) {
// Methods need to be added at runtime. Method function pointers (IMP)
// are not available until then.
CGBuilderTy Builder(JitInitBlock);
CodeGen::CodeGenFunction CGF(CGM);
void *theMetaclass = _object_getClass(theClass);
llvm::DenseMap<const ObjCMethodDecl*, llvm::Function*>::iterator I =
MethodDefinitions.begin();
while (I != MethodDefinitions.end()) {
const ObjCMethodDecl *D = I->first;
std::string TypeStr;
CGM.getContext().getObjCEncodingForMethodDecl(const_cast<ObjCMethodDecl*>(D),
TypeStr);
const char* TypeCStr = // keep in a set
MethodTypeStrings.insert(MethodTypeStrings.begin(), TypeStr)->c_str();
void *ClassObject = D->isClassMethod() ? theMetaclass : theClass;
llvm::Value *ClassArg =
llvm::Constant::getIntegerValue(ObjCTypes.ClassPtrTy,
llvm::APInt(sizeof(void*) * 8,
(uint64_t)ClassObject));
llvm::Value *SelectorArg = GetSelector(CGF, D->getSelector());
llvm::Value *TypeArg =
llvm::Constant::getIntegerValue(ObjCTypes.Int8PtrTy,
llvm::APInt(sizeof(void*) * 8,
(uint64_t)TypeCStr));
llvm::Value *MethodArg = Builder.CreateBitCast(I->second, ImpPtrTy);
Builder.CreateCall4(fn_class_addMethod,
ClassArg,
SelectorArg,
MethodArg,
TypeArg);
I++;
}
// Done with list for this implementation, so clear it
MethodDefinitions.clear();
}
示例3: reset
void reset() {
indexedScopes.clear();
scopeToIndexMap.clear();
closureToScopesMap.clear();
}