diff --git a/tests/manual/cplusplus-dump/main.cpp b/tests/manual/cplusplus-dump/main.cpp index dfd80b6b4038e3de0c7c924656d18d6562259933..273a741aee91ed5e2ec9270bac000a5df23abdd8 100644 --- a/tests/manual/cplusplus-dump/main.cpp +++ b/tests/manual/cplusplus-dump/main.cpp @@ -64,6 +64,7 @@ public: void operator()(AST *ast) { std::cout << "digraph AST {" << std::endl; + // std::cout << "rankdir = \"LR\";" << std::endl; accept(ast); std::cout << "}" << std::endl; } @@ -73,9 +74,12 @@ protected: QByteArray name = abi::__cxa_demangle(typeid(*ast).name(), 0, 0, 0) + 11; name.truncate(name.length() - 3); name = QByteArray::number(_id.value(ast)) + ". " + name; - const char *x = spell(ast->firstToken()); - name += ' '; - name += x; + + if (ast->lastToken() - ast->firstToken() == 1) { + const char *x = spell(ast->firstToken()); + name += ' '; + name += x; + } name.prepend('"'); name.append('"'); @@ -95,7 +99,7 @@ protected: return true; } - virtual void postVisit(AST *ast) { + virtual void postVisit(AST *) { _stack.removeLast(); }