MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / SLaddMLErrorContext

Function SLaddMLErrorContext

src/API/SLAPI.cpp:175–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175void SLaddMLErrorContext(SV3_1aPythonListener* prog,
176 antlr4::ParserRuleContext* context1,
177 antlr4::ParserRuleContext* context2,
178 const char* messageId, const char* objectName1,
179 const char* objectName2, bool printColumn) {
180#ifdef SURELOG_WITH_PYTHON
181 SV3_1aPythonListener* listener = prog;
182 antlr4::ParserRuleContext* ctx1 = context1;
183 antlr4::ParserRuleContext* ctx2 = context2;
184 ErrorContainer* errors =
185 listener->getPythonListen()->getCompileSourceFile()->getErrorContainer();
186 ParseUtils::LineColumn lineCol1 =
187 ParseUtils::getLineColumn(listener->getTokenStream(), ctx1);
188 ParseUtils::LineColumn lineCol2 =
189 ParseUtils::getLineColumn(listener->getTokenStream(), ctx2);
190 ErrorDefinition::ErrorType type = ErrorDefinition::getErrorType(messageId);
191
192 Location loc1(
193 listener->getPythonListen()->getParseFile()->getFileId(lineCol1.first),
194 listener->getPythonListen()->getParseFile()->getLineNb(lineCol1.first),
195 printColumn ? lineCol1.second : 0,
196 listener->getPythonListen()
197 ->getCompileSourceFile()
198 ->getSymbolTable()
199 ->registerSymbol(objectName1));
200
201 Location loc2(
202 listener->getPythonListen()->getParseFile()->getFileId(lineCol2.first),
203 listener->getPythonListen()->getParseFile()->getLineNb(lineCol2.first),
204 printColumn ? lineCol2.second : 0,
205 listener->getPythonListen()
206 ->getCompileSourceFile()
207 ->getSymbolTable()
208 ->registerSymbol(objectName2));
209 Error err(type, loc1, loc2);
210 errors->addError(err, false, false);
211#else
212 std::cerr << "SLaddMLErrorContext(): Python support not compiled in\n";
213#endif
214}
215
216std::string SLgetFile(SV3_1aPythonListener* prog,
217 antlr4::ParserRuleContext* context) {

Callers

nothing calls this directly

Calls 9

getParseFileMethod · 0.80
getErrorContainerMethod · 0.45
getCompileSourceFileMethod · 0.45
getTokenStreamMethod · 0.45
getFileIdMethod · 0.45
getLineNbMethod · 0.45
registerSymbolMethod · 0.45
getSymbolTableMethod · 0.45
addErrorMethod · 0.45

Tested by

no test coverage detected