MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / EmitErrorMessage

Method EmitErrorMessage

source/opt/ir_context.cpp:1075–1109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1073}
1074
1075void IRContext::EmitErrorMessage(std::string message, Instruction* inst) {
1076 if (!consumer()) {
1077 return;
1078 }
1079
1080 Instruction* line_inst = inst;
1081 while (line_inst != nullptr) { // Stop at the beginning of the basic block.
1082 if (!line_inst->dbg_line_insts().empty()) {
1083 line_inst = &line_inst->dbg_line_insts().back();
1084 if (line_inst->IsNoLine()) {
1085 line_inst = nullptr;
1086 }
1087 break;
1088 }
1089 line_inst = line_inst->PreviousNode();
1090 }
1091
1092 uint32_t line_number = 0;
1093 uint32_t col_number = 0;
1094 std::string source;
1095 if (line_inst != nullptr) {
1096 Instruction* file_name =
1097 get_def_use_mgr()->GetDef(line_inst->GetSingleWordInOperand(0));
1098 source = file_name->GetInOperand(0).AsString();
1099
1100 // Get the line number and column number.
1101 line_number = line_inst->GetSingleWordInOperand(1);
1102 col_number = line_inst->GetSingleWordInOperand(2);
1103 }
1104
1105 message +=
1106 "\n " + inst->PrettyPrint(SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES);
1107 consumer()(SPV_MSG_ERROR, source.c_str(), {line_number, col_number, 0},
1108 message.c_str());
1109}
1110
1111// Gets the dominator analysis for function |f|.
1112DominatorAnalysis* IRContext::GetDominatorAnalysis(const Function* f) {

Callers 7

ReplaceCandidateMethod · 0.80
ReplaceAccessChainMethod · 0.80
ReplaceEntryPointMethod · 0.80
ReplaceLoadedValueMethod · 0.80
ProcessMethod · 0.80

Calls 9

backMethod · 0.80
IsNoLineMethod · 0.80
PreviousNodeMethod · 0.80
c_strMethod · 0.80
emptyMethod · 0.45
GetDefMethod · 0.45
AsStringMethod · 0.45
PrettyPrintMethod · 0.45

Tested by

no test coverage detected