本文整理汇总了C++中llvm::SmallVector::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ SmallVector::empty方法的具体用法?C++ SmallVector::empty怎么用?C++ SmallVector::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::SmallVector
的用法示例。
在下文中一共展示了SmallVector::empty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setFileStream
void MetaProcessor::setFileStream(llvm::StringRef file, bool append, int fd,
llvm::SmallVector<llvm::SmallString<128>, 2>& prevFileStack) {
// If we have a fileName to redirect to store it.
if (!file.empty()) {
prevFileStack.push_back(file);
// pop and push a null terminating 0.
// SmallVectorImpl<T> does not have a c_str(), thus instead of casting to
// a SmallString<T> we null terminate the data that we have and pop the
// 0 char back.
prevFileStack.back().push_back(0);
prevFileStack.back().pop_back();
if (!append) {
FILE * f;
if (!(f = fopen(file.data(), "w"))) {
llvm::errs() << "cling::MetaProcessor::setFileStream:"
" The file path " << file.data() << "is not valid.";
} else {
fclose(f);
}
}
// Else unredirection, so switch to the previous file.
} else {
// If there is no previous file on the stack we pop the file
if (!prevFileStack.empty()) {
prevFileStack.pop_back();
}
}
}
示例2: alloc
void* alloc() {
if (free_chunks.empty()) {
int protection = PROT_READ | PROT_WRITE | PROT_EXEC;
int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT;
char* addr = (char*)mmap(NULL, region_size, protection, flags, -1, 0);
for (int i = 0; i < region_size / chunk_size; ++i) {
free_chunks.push_back(&addr[i * chunk_size]);
}
}
return free_chunks.pop_back_val();
}
示例3: empty
bool empty() const { return ToHandle.empty(); }