]> git.tdb.fi Git - libs/gl.git/commitdiff
Debug output tweaks
authorMikko Rasa <tdb@tdb.fi>
Sun, 28 Feb 2021 14:10:09 +0000 (16:10 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 28 Feb 2021 19:41:54 +0000 (21:41 +0200)
source/glsl/debug.cpp

index b913f5b493a2b2ad550d5f83903abe74ab68affb..50d2b985604ccfa4f5a4c1c2afe0d667d02be01c 100644 (file)
@@ -174,9 +174,7 @@ void DumpTree::visit(Assignment &assign)
        append(format("Assignment: %s%s", assign.oper, (assign.self_referencing ? " (self-referencing)" : "")));
        begin_sub();
        if(assign.target_declaration)
-       {
                append(format("Target: %%%d %s %s", get_label(*assign.target_declaration), assign.target_declaration->type, assign.target_declaration->name));
-       }
        assign.left->visit(*this);
        last_branch();
        assign.right->visit(*this);
@@ -299,14 +297,18 @@ void DumpTree::visit(InterfaceBlock &block)
 
 void DumpTree::visit(FunctionDeclaration &func)
 {
-       append(format("%%%d %s %s()", get_label(func), func.return_type, func.name));
+       string text = format("%%%d %s %s", get_label(func), func.return_type, func.name);
+       if(!func.definition)
+               text += " (undefined)";
+       append(text);
        begin_sub();
        for(NodeArray<VariableDeclaration>::const_iterator i=func.parameters.begin(); i!=func.parameters.end(); ++i)
                (*i)->visit(*this);
-       if(func.definition)
-               append(format("Definition: %%%d", get_label(*func.definition)));
        last_branch();
-       func.body.visit(*this);
+       if(func.definition!=&func)
+               append(format("Definition: %%%d", get_label(*func.definition)));
+       else
+               func.body.visit(*this);
        end_sub();
 }