本文整理汇总了C++中llvm::StringMap::count方法的典型用法代码示例。如果您正苦于以下问题:C++ StringMap::count方法的具体用法?C++ StringMap::count怎么用?C++ StringMap::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::StringMap
的用法示例。
在下文中一共展示了StringMap::count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check
void DeprecatedIosBaseAliasesCheck::check(
const MatchFinder::MatchResult &Result) {
SourceManager &SM = *Result.SourceManager;
const auto *Typedef = Result.Nodes.getNodeAs<TypedefDecl>("TypeDecl");
StringRef TypeName = Typedef->getName();
bool HasReplacement = ReplacementTypes.count(TypeName);
const auto *TL = Result.Nodes.getNodeAs<TypeLoc>("TypeLoc");
SourceLocation IoStateLoc = TL->getBeginLoc();
// Do not generate fixits for matches depending on template arguments and
// macro expansions.
bool Fix = HasReplacement && !TL->getType()->isDependentType();
if (IoStateLoc.isMacroID()) {
IoStateLoc = SM.getSpellingLoc(IoStateLoc);
Fix = false;
}
SourceLocation EndLoc = IoStateLoc.getLocWithOffset(TypeName.size() - 1);
if (HasReplacement) {
auto FixName = ReplacementTypes.lookup(TypeName);
auto Builder = diag(IoStateLoc, "'std::ios_base::%0' is deprecated; use "
"'std::ios_base::%1' instead")
<< TypeName << FixName;
if (Fix)
Builder << FixItHint::CreateReplacement(SourceRange(IoStateLoc, EndLoc),
FixName);
} else
diag(IoStateLoc, "'std::ios_base::%0' is deprecated") << TypeName;
}
示例2: hide
static void hide(llvm::StringMap<cl::Option *> &map, const char *name) {
// Check if option exists first for resilience against LLVM changes
// between versions.
if (map.count(name)) {
map[name]->setHiddenFlag(cl::Hidden);
}
}
示例3: embedRelocatablePtr
llvm::Constant* embedRelocatablePtr(const void* addr, llvm::Type* type, llvm::StringRef shared_name) {
assert(addr);
if (!ENABLE_JIT_OBJECT_CACHE)
return embedConstantPtr(addr, type);
std::string name;
if (!shared_name.empty()) {
llvm::GlobalVariable* gv = g.cur_module->getGlobalVariable(shared_name, true);
if (gv)
return gv;
assert(!relocatable_syms.count(name));
name = shared_name;
} else {
name = (llvm::Twine("c") + llvm::Twine(relocatable_syms.size())).str();
}
relocatable_syms[name] = addr;
llvm::Type* var_type = type->getPointerElementType();
return new llvm::GlobalVariable(*g.cur_module, var_type, true, llvm::GlobalVariable::ExternalLinkage, 0, name);
}