本文整理汇总了C++中cg::BasicBlockBuilder::GetInsertBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ BasicBlockBuilder::GetInsertBlock方法的具体用法?C++ BasicBlockBuilder::GetInsertBlock怎么用?C++ BasicBlockBuilder::GetInsertBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cg::BasicBlockBuilder
的用法示例。
在下文中一共展示了BasicBlockBuilder::GetInsertBlock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: llvmCompileToBuilder
void ReturnStatement::llvmCompileToBuilder( CG::BasicBlockBuilder &basicBlockBuilder, CG::Diagnostics &diagnostics ) const
{
try
{
CG::ReturnInfo const &returnInfo = basicBlockBuilder.getFunctionBuilder().getScope().getReturnInfo();
if ( basicBlockBuilder->GetInsertBlock()->getTerminator() )
throw CG::Error( getLocation(), "unreachable code" );
CG::ExprValue returnExprValue( CG::ExprValue( basicBlockBuilder.getContext() ) );
if ( m_expr )
{
if ( !returnInfo )
throw CG::Error( getLocation(), "functions with no return types do not return values" );
returnExprValue = m_expr->buildExprValue( basicBlockBuilder, CG::USAGE_RVALUE, "cannot be assigned to" );
}
else
{
if ( returnInfo )
throw CG::Error( getLocation(), "function must return a value" );
}
basicBlockBuilder.getScope().llvmReturn( basicBlockBuilder, returnExprValue );
}
catch ( Exception e )
{
addError( diagnostics, e );
}
}