[Kde-bindings] [PATCH 2/2] add a -dumpAST argument to smokegen for debugging
Sylvain Joyeux
sylvain.joyeux at m4x.org
Mon Nov 10 18:04:09 UTC 2014
---
main.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/main.cpp b/main.cpp
index d0a4793..7b8a71b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -38,6 +38,7 @@
#include "generatorvisitor.h"
#include "options.h"
#include "config.h"
+#include "dumptree.h"
typedef int (*GenerateFn)();
@@ -72,6 +73,7 @@ int main(int argc, char **argv)
QString generator;
bool addHeaders = false;
bool hasCommandLineGenerator = false;
+ bool dumpAST = false;
QStringList classes;
ParserOptions::notToBeResolved << "FILE";
@@ -101,6 +103,8 @@ int main(int argc, char **argv)
ParserOptions::resolveTypedefs = true;
} else if (args[i] == "-qt") {
ParserOptions::qtMode = true;
+ } else if (args[i] == "-dump-ast") {
+ dumpAST = true;
} else if (args[i] == "--") {
addHeaders = true;
} else if (addHeaders) {
@@ -224,6 +228,10 @@ int main(int argc, char **argv)
ParseSession session;
session.setContentsAndGenerateLocationTable(pp.preprocess());
TranslationUnitAST* ast = parser.parse(&session);
+ if (dumpAST) {
+ DumpTree dumpVisitor;
+ dumpVisitor.dump(ast, session.token_stream);
+ }
// TODO: improve 'header => class' association
GeneratorVisitor visitor(&session, file.fileName());
visitor.visit(ast);
--
2.1.3
More information about the Kde-bindings
mailing list