Skip to content

Commit 8e57588

Browse files
jbowlermrbean-bremen
authored andcommitted
generator: call Reporthandler::setContext more (#131)
This adds 'context' to ReportHandler warning messages; just a string saying what is being done.
1 parent 69635a0 commit 8e57588

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

generator/main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
**
4040
****************************************************************************/
4141

42+
#include <cstdio>
43+
4244
#include "main.h"
4345
#include "asttoxml.h"
4446
#include "reporthandler.h"
@@ -53,6 +55,8 @@ void displayHelp(GeneratorSet *generatorSet);
5355
#include <QDebug>
5456
int main(int argc, char *argv[])
5557
{
58+
ReportHandler::setContext("Arguments");
59+
5660
QScopedPointer<GeneratorSet> gs(GeneratorSet::getInstance());
5761

5862
QString default_file = ":/trolltech/generator/qtscript_masterinclude.h";
@@ -135,11 +139,13 @@ int main(int argc, char *argv[])
135139
printf("Please wait while source files are being generated...\n");
136140

137141
printf("Parsing typesystem file [%s]\n", qPrintable(typesystemFileName));
142+
ReportHandler::setContext("Typesystem");
138143
if (!TypeDatabase::instance()->parseFile(typesystemFileName))
139144
qFatal("Cannot parse file: '%s'", qPrintable(typesystemFileName));
140145

141146
printf("PreProcessing - Generate [%s] using [%s] and include-paths [%s]\n",
142147
qPrintable(pp_file), qPrintable(fileName), qPrintable(args.value("include-paths")));
148+
ReportHandler::setContext("Preprocess");
143149
if (!Preprocess::preprocess(fileName, pp_file, args.value("include-paths"))) {
144150
fprintf(stderr, "Preprocessor failed on file: '%s'\n", qPrintable(fileName));
145151
return 1;
@@ -148,16 +154,19 @@ int main(int argc, char *argv[])
148154
if (args.contains("ast-to-xml")) {
149155
printf("Running ast-to-xml on file [%s] using pp_file [%s] and include-paths [%s]\n",
150156
qPrintable(fileName), qPrintable(pp_file), qPrintable(args.value("include-paths")));
157+
ReportHandler::setContext(QString("AST-to-XML"));
151158
astToXML(pp_file);
152159
return 0;
153160
}
154161

155162
printf("Building model using [%s]\n", qPrintable(pp_file));
163+
ReportHandler::setContext("Build");
156164
gs->buildModel(pp_file);
157165
if (args.contains("dump-object-tree")) {
158166
gs->dumpObjectTree();
159167
return 0;
160168
}
169+
ReportHandler::setContext("Generate");
161170
printf("%s\n", qPrintable(gs->generate()));
162171

163172
printf("Done, %d warnings (%d known issues)\n", ReportHandler::warningCount(),

0 commit comments

Comments
 (0)