本文整理汇总了C++中llvm::ArrayRef::drop_front方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayRef::drop_front方法的具体用法?C++ ArrayRef::drop_front怎么用?C++ ArrayRef::drop_front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::ArrayRef
的用法示例。
在下文中一共展示了ArrayRef::drop_front方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// Linux Proc Status
// it's stored as an ascii string in the file
llvm::Optional<LinuxProcStatus>
LinuxProcStatus::Parse(llvm::ArrayRef<uint8_t> &data) {
LinuxProcStatus result;
result.proc_status =
llvm::StringRef(reinterpret_cast<const char *>(data.data()), data.size());
data = data.drop_front(data.size());
llvm::SmallVector<llvm::StringRef, 0> lines;
result.proc_status.split(lines, '\n', 42);
// /proc/$pid/status has 41 lines, but why not use 42?
for (auto line : lines) {
if (line.consume_front("Pid:")) {
line = line.trim();
if (!line.getAsInteger(10, result.pid))
return result;
}
}
return llvm::None;
}
示例2: while
static Variable::RangeList
MakeRangeList(const PdbIndex &index, const LocalVariableAddrRange &range,
llvm::ArrayRef<LocalVariableAddrGap> gaps) {
lldb::addr_t start =
index.MakeVirtualAddress(range.ISectStart, range.OffsetStart);
lldb::addr_t end = start + range.Range;
Variable::RangeList result;
while (!gaps.empty()) {
const LocalVariableAddrGap &gap = gaps.front();
lldb::addr_t size = gap.GapStartOffset - start;
result.Append(start, size);
start += gap.Range;
gaps = gaps.drop_front();
}
result.Append(start, end - start);
return result;
}
示例3: consumeObject
std::vector<const MinidumpMemoryInfo *>
MinidumpMemoryInfo::ParseMemoryInfoList(llvm::ArrayRef<uint8_t> &data) {
const MinidumpMemoryInfoListHeader *header;
Status error = consumeObject(data, header);
if (error.Fail() ||
header->size_of_header < sizeof(MinidumpMemoryInfoListHeader) ||
header->size_of_entry < sizeof(MinidumpMemoryInfo))
return {};
data = data.drop_front(header->size_of_header -
sizeof(MinidumpMemoryInfoListHeader));
if (header->size_of_entry * header->num_of_entries > data.size())
return {};
std::vector<const MinidumpMemoryInfo *> result;
for (uint64_t i = 0; i < header->num_of_entries; ++i) {
result.push_back(reinterpret_cast<const MinidumpMemoryInfo *>(
data.data() + i * header->size_of_entry));
}
return result;
}