本文整理汇总了C++中VariableDeclaration::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ VariableDeclaration::getType方法的具体用法?C++ VariableDeclaration::getType怎么用?C++ VariableDeclaration::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VariableDeclaration
的用法示例。
在下文中一共展示了VariableDeclaration::getType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSize
size_t UnionDeclaration::getSize() const {
size_t sz = 0;
VariableDeclaration *vd;
for(int i = 0; i < members.size(); i++){
vd = members[i]->variableDeclaration();
if(vd->getType()->getSize() > sz)
sz = vd->getType()->getSize();
}
return sz;
}
示例2: getAlign
size_t UserTypeDeclaration::getAlign() const {
size_t align = 0;
VariableDeclaration *vd;
for(int i = 0; i < members.size(); i++){
vd = members[i]->variableDeclaration();
assert(vd && "expected variable decl, found something else");
if(vd->getType()->getAlign() > align)
align = vd->getType()->getAlign();
}
if(align == 0) return 1; // TODO: empty struct, bad!
return align; //TODO: handle packed
}
示例3: addAndInitializeVariable
void CompilerContext::addAndInitializeVariable(VariableDeclaration const& _declaration)
{
addVariable(_declaration);
unsigned const size = _declaration.getType()->getSizeOnStack();
for (unsigned i = 0; i < size; ++i)
*this << u256(0);
m_asm.adjustDeposit(-size);
}
示例4: addVariable
void CompilerContext::addVariable(VariableDeclaration const& _declaration)
{
m_localVariables[&_declaration] = m_localVariablesSize;
m_localVariablesSize += _declaration.getType()->getSizeOnStack();
}
示例5: addStateVariable
void CompilerContext::addStateVariable(VariableDeclaration const& _declaration)
{
m_stateVariables[&_declaration] = m_stateVariablesSize;
m_stateVariablesSize += _declaration.getType()->getStorageSize();
}
示例6: appendStackVariableInitialisation
void Compiler::appendStackVariableInitialisation(VariableDeclaration const& _variable)
{
CompilerContext::LocationSetter location(m_context, _variable);
m_context.addVariable(_variable);
CompilerUtils(m_context).pushZeroValue(*_variable.getType());
}