コード例 #1
0
ファイル: CompileSession.cpp プロジェクト: eval1749/evm
// [R]
void CompileSession::RecordErrorInfo(const ErrorInfo& templ) {
  DEBUG_FORMAT("%s", templ);

  static bool fContinue = false;
  if (!fContinue && ::IsDebuggerPresent()) {
    __debugbreak();
    fContinue = true;
  }

  if (error_set_.Contains(&templ)) {
    return;
  }

  auto& error_info = templ.Clone();

  error_set_.Add(&error_info);

  auto ref = errors_.GetLast();
  while (ref) {
    if (error_info.source_info() > ref->source_info()) {
      break;
    }
    ref = ref->GetPrev();
  }
  if (ref) {
    errors_.InsertAfter(&error_info, ref);
  } else {
    errors_.Prepend(&error_info);
  }
}
コード例 #2
0
ファイル: Builder.cpp プロジェクト: eval1749/evm
/// <summary>
///   <list type="number">
///     <item>Set output type of PrologueI.</item>
///     <item>Load parameters</item>
///   </list>
/// </summary>
void Builder::SetUpMethodBody(Function& fun, MethodDef& method_def) {
  auto const pPrologueI = fun.GetStartBB()->GetFirstI();
  auto const pRefI = pPrologueI->GetNext();
  auto const pBB = pPrologueI->GetBBlock();
  auto& v1 = *pPrologueI->GetVd();

  ValuesTypeBuilder tybuilder(
      method_def.IsStatic()
          ? method_def.CountParams()
          : method_def.CountParams() + 1);

  auto nth = 0;

  // "this" parameter.
  if (!method_def.IsStatic()) {
    tybuilder.Append(method_def.owner_class_def().GetClass());
    nth++;
  }

  foreach (MethodDef::EnumParam, oEnum, method_def) {
    auto const pParamDef = oEnum.Get();
    auto& var = pParamDef->GetVariable();
    auto& varty = var.GetTy();
    tybuilder.Append(varty);
    DEBUG_FORMAT("%s %s", varty, var);

    auto& cell_class = Ty_ClosedCell->Construct(varty);
    //auto& r2 = *NewOutput(varty).StaticCast<Register>();
    auto& r2 = *NewOutput(varty).StaticCast<Register>();
    r2.SetVariable(var);

    auto const pSelectI = new(zone()) SelectI(varty, r2, v1, nth);
    pSelectI->SetSourceInfo(pParamDef->GetSourceInfo());
    pBB->InsertBeforeI(*pSelectI, pRefI);

    auto& r3 = NewRegister();
    auto& vardef_inst = *new(zone()) VarDefI(cell_class, r3, var, r2);
    vardef_inst.set_source_info(pParamDef->source_info());
    pBB->InsertBeforeI(vardef_inst, pRefI);

    ++nth;
  }
コード例 #3
0
ファイル: gl_check.cpp プロジェクト: Mistobaan/CasparCG
void SMFL_GLCheckError(const std::string&, const std::string& file, unsigned int line)
{
	// Get the last error
	GLenum LastErrorCode = GL_NO_ERROR;

	for(GLenum ErrorCode = glGetError(); ErrorCode != GL_NO_ERROR; ErrorCode = glGetError())
	{
		CASPAR_LOG(error) << "OpenGL Error: " << ErrorCode << L" " << glewGetErrorString(ErrorCode);
		LastErrorCode = ErrorCode;
	}

	if (LastErrorCode != GL_NO_ERROR)
	{
		// Decode the error code
		switch (LastErrorCode)
		{
			case GL_INVALID_ENUM :
				CASPAR_THROW_EXCEPTION(ogl_invalid_enum()
					<< msg_info("an unacceptable value has been specified for an enumerated argument")
					<< error_info("GL_INVALID_ENUM")
					<< line_info(line)
					<< source_info(file));

			case GL_INVALID_VALUE :
				CASPAR_THROW_EXCEPTION(ogl_invalid_value()
					<< msg_info("a numeric argument is out of range")
					<< error_info("GL_INVALID_VALUE")
					<< line_info(line)
					<< source_info(file));

			case GL_INVALID_OPERATION :
				CASPAR_THROW_EXCEPTION(ogl_invalid_operation()
					<< msg_info("the specified operation is not allowed in the current state")
					<< error_info("GL_INVALID_OPERATION")
					<< line_info(line)
					<< source_info(file));

			case GL_STACK_OVERFLOW :
				CASPAR_THROW_EXCEPTION(ogl_stack_overflow()
					<< msg_info("this command would cause a stack overflow")
					<< error_info("GL_STACK_OVERFLOW")
					<< line_info(line)
					<< source_info(file));

			case GL_STACK_UNDERFLOW :
				CASPAR_THROW_EXCEPTION(ogl_stack_underflow()
					<< msg_info("this command would cause a stack underflow")
					<< error_info("GL_STACK_UNDERFLOW")
					<< line_info(line)
					<< source_info(file));

			case GL_OUT_OF_MEMORY :
				CASPAR_THROW_EXCEPTION(ogl_out_of_memory()
					<< msg_info("there is not enough memory left to execute the command")
					<< error_info("GL_OUT_OF_MEMORY")
					<< line_info(line)
					<< source_info(file));

			case GL_INVALID_FRAMEBUFFER_OPERATION_EXT :
				CASPAR_THROW_EXCEPTION(ogl_stack_underflow()
					<< msg_info("the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\"")
					<< error_info("GL_INVALID_FRAMEBUFFER_OPERATION_EXT")
					<< line_info(line)
					<< source_info(file));
		}
	}
}
コード例 #4
0
ファイル: ffmpeg_error.cpp プロジェクト: Mistobaan/CasparCG
void throw_on_ffmpeg_error(int ret, const char* source, const char* func, const char* local_func, const char* file, int line)
{
	if(ret >= 0)
		return;

	switch(ret)
	{
	case AVERROR_BSF_NOT_FOUND:
		::boost::exception_detail::throw_exception_(averror_bsf_not_found()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);	
	case AVERROR_DECODER_NOT_FOUND:
		::boost::exception_detail::throw_exception_(averror_decoder_not_found()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);
	case AVERROR_DEMUXER_NOT_FOUND:
		::boost::exception_detail::throw_exception_(averror_demuxer_not_found()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);
	case AVERROR_ENCODER_NOT_FOUND:
		::boost::exception_detail::throw_exception_(averror_encoder_not_found()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);	
	case AVERROR_EOF:	
		::boost::exception_detail::throw_exception_(averror_eof()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);
	case AVERROR_EXIT:				
		::boost::exception_detail::throw_exception_(averror_exit()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);
	case AVERROR_FILTER_NOT_FOUND:				
		::boost::exception_detail::throw_exception_(averror_filter_not_found()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);
	case AVERROR_MUXER_NOT_FOUND:	
		::boost::exception_detail::throw_exception_(averror_muxer_not_found()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);
	case AVERROR_OPTION_NOT_FOUND:	
		::boost::exception_detail::throw_exception_(averror_option_not_found()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);
	case AVERROR_PATCHWELCOME:	
		::boost::exception_detail::throw_exception_(averror_patchwelcome()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);
	case AVERROR_PROTOCOL_NOT_FOUND:	
		::boost::exception_detail::throw_exception_(averror_protocol_not_found()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);
	case AVERROR_STREAM_NOT_FOUND:
		::boost::exception_detail::throw_exception_(averror_stream_not_found()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);
	default:
		::boost::exception_detail::throw_exception_(ffmpeg_error()<<										
			msg_info(av_error_str(ret)) <<							
			source_info(source) << 						
			boost::errinfo_api_function(func) <<					
			boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);
	}
}