本文整理汇总了C++中llvm::StringMap::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ StringMap::insert方法的具体用法?C++ StringMap::insert怎么用?C++ StringMap::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::StringMap
的用法示例。
在下文中一共展示了StringMap::insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: declare_variable
int declare_variable(ast::Variable& it) {
if(variables.find(it.identifier) != variables.end()) {
std::cout << "Variable shadowing of "
<< it.identifier;
print_id(it.id);
std::cout << std::endl;
}
variables.insert(std::pair<llvm::StringRef, ast::Variable>(it.identifier,
it));
return EXIT_SUCCESS;
}
示例2: declare_extern
int declare_extern(ast::Extern* extrn) {
assert(extrn != nullptr);
if(functions.find(extrn->identifier) != functions.end()) {
std::cout << "Double declaration of "
<< extrn->identifier;
print_id(extrn->id);
std::cout << std::endl;
}
functions.insert(std::pair<llvm::StringRef, ast::Extern>(extrn->identifier,
*extrn));
return EXIT_SUCCESS;
}
示例3: addMarker
// Register a marker.
void addMarker(StringRef MarkerName, SourceLocation Pos) {
auto InsertResult = Markers.insert(
{MarkerName, Marker{Pos, SourceLocation(), SourceLocation()}});
Marker &M = InsertResult.first->second;
if (!InsertResult.second) {
// Marker was redefined.
M.RedefLoc = Pos;
} else {
// First definition: build any deferred directives.
auto Deferred = DeferredDirectives.find(MarkerName);
if (Deferred != DeferredDirectives.end()) {
for (auto &UD : Deferred->second) {
if (M.UseLoc.isInvalid())
M.UseLoc = UD.DirectivePos;
attachDirective(Diags, UD, Pos);
}
DeferredDirectives.erase(Deferred);
}
}
}