Skip to content

Commit c0f9e99

Browse files
committed
moc: Add an error overload taking a Symbol and a message
This allows deferring warnigs about a certain error until later, by storing the symbol (while still allowing to print a custom message). Change-Id: Id434eec9b344b1f8b18c504dfda8fed90167cf12 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
1 parent fd88f44 commit c0f9e99

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/tools/moc/parser.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ void Parser::error(const char *msg)
6969
exit(EXIT_FAILURE);
7070
}
7171

72+
void Parser::error(const Symbol& symbol, const char *msg)
73+
{
74+
printMsg("error: %s\n", msg, symbol);
75+
exit(EXIT_FAILURE);
76+
}
77+
7278
void Parser::warning(const Symbol &sym, QByteArrayView msg)
7379
{
7480
if (displayWarnings)

src/tools/moc/parser.h

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class Parser
4848

4949
Q_NORETURN void error(const Symbol &symbol);
5050
Q_NORETURN void error(const char *msg = nullptr);
51+
Q_NORETURN void error(const Symbol &symbol, const char *msg);
5152
void warning(const char * = nullptr);
5253
void warning(const Symbol &sym, QByteArrayView msg);
5354
void note(const char * = nullptr);

0 commit comments

Comments
 (0)