本文整理汇总了C++中llvm::APSInt::getZExtValue方法的典型用法代码示例。如果您正苦于以下问题:C++ APSInt::getZExtValue方法的具体用法?C++ APSInt::getZExtValue怎么用?C++ APSInt::getZExtValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::APSInt
的用法示例。
在下文中一共展示了APSInt::getZExtValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extractor
DWARFExpression lldb_private::npdb::MakeConstantLocationExpression(
TypeIndex underlying_ti, TpiStream &tpi, const llvm::APSInt &constant,
ModuleSP module) {
const ArchSpec &architecture = module->GetArchitecture();
uint32_t address_size = architecture.GetAddressByteSize();
size_t size = 0;
bool is_signed = false;
std::tie(size, is_signed) = GetIntegralTypeInfo(underlying_ti, tpi);
union {
llvm::support::little64_t I;
llvm::support::ulittle64_t U;
} Value;
std::shared_ptr<DataBufferHeap> buffer = std::make_shared<DataBufferHeap>();
buffer->SetByteSize(size);
llvm::ArrayRef<uint8_t> bytes;
if (is_signed) {
Value.I = constant.getSExtValue();
} else {
Value.U = constant.getZExtValue();
}
bytes = llvm::makeArrayRef(reinterpret_cast<const uint8_t *>(&Value), 8)
.take_front(size);
buffer->CopyData(bytes.data(), size);
DataExtractor extractor(buffer, lldb::eByteOrderLittle, address_size);
DWARFExpression result(nullptr, extractor, nullptr, 0, size);
return result;
}
示例2: sizeof
TemplateArgument::TemplateArgument(ASTContext &Ctx, const llvm::APSInt &Value,
QualType Type) {
Integer.Kind = Integral;
// Copy the APSInt value into our decomposed form.
Integer.BitWidth = Value.getBitWidth();
Integer.IsUnsigned = Value.isUnsigned();
// If the value is large, we have to get additional memory from the ASTContext
unsigned NumWords = Value.getNumWords();
if (NumWords > 1) {
void *Mem = Ctx.Allocate(NumWords * sizeof(uint64_t));
std::memcpy(Mem, Value.getRawData(), NumWords * sizeof(uint64_t));
Integer.pVal = static_cast<uint64_t *>(Mem);
} else {
Integer.VAL = Value.getZExtValue();
}
Integer.Type = Type.getAsOpaquePtr();
}