]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/debug.cpp
Use emplace_back when a new object is being constructed
[libs/gl.git] / source / glsl / debug.cpp
index 5b142019150441f3fd7291f03db30473e401631b..60ac76f252594f79b823f30cc8c1f015766e4d92 100644 (file)
@@ -305,11 +305,11 @@ void DumpTree::visit(BasicTypeDeclaration &type)
 
        vector<Branch> branches;
        if(type.base_type)
-               branches.push_back(format("%s: %%%d %s", (type.kind==BasicTypeDeclaration::ALIAS ? "Alias of" : "Base"), get_label(*type.base_type), type.base_type->name));
+               branches.emplace_back(format("%s: %%%d %s", (type.kind==BasicTypeDeclaration::ALIAS ? "Alias of" : "Base"), get_label(*type.base_type), type.base_type->name));
        if(type.kind==BasicTypeDeclaration::VECTOR)
-               branches.push_back(format("Vector: %d", type.size));
+               branches.emplace_back(format("Vector: %d", type.size));
        else if(type.kind==BasicTypeDeclaration::MATRIX)
-               branches.push_back(format("Matrix: %dx%d", type.size&0xFFFF, type.size>>16));
+               branches.emplace_back(format("Matrix: %dx%d", type.size&0xFFFF, type.size>>16));
        append_subtree(branches);
 }
 
@@ -320,11 +320,11 @@ void DumpTree::visit(ImageTypeDeclaration &type)
        append(type, format("%%%d typedef %s", get_label(type), type.name));
 
        vector<Branch> branches;
-       branches.push_back(format("Dimensions: %s%s", dims[type.dimensions-1], (type.array ? " array" : "")));
+       branches.emplace_back(format("Dimensions: %s%s", dims[type.dimensions-1], (type.array ? " array" : "")));
        if(type.base_type)
-               branches.push_back(format("Element type: %%%d %s", get_label(*type.base_type), type.base_type->name));
+               branches.emplace_back(format("Element type: %%%d %s", get_label(*type.base_type), type.base_type->name));
        if(type.shadow)
-               branches.push_back("Shadow");
+               branches.emplace_back("Shadow");
        append_subtree(branches);
 }
 
@@ -362,7 +362,7 @@ void DumpTree::visit(VariableDeclaration &var)
        if(var.array)
        {
                if(var.array_size)
-                       branches.push_back(Branch("Array []", var.array_size.get()));
+                       branches.emplace_back("Array []", var.array_size.get());
                else
                        branches.push_back("Array []");
        }
@@ -421,10 +421,10 @@ void DumpTree::visit(Conditional &cond)
        append(cond, "if()");
 
        vector<Branch> branches;
-       branches.push_back(cond.condition.get());
-       branches.push_back(Branch("then", &cond.body));
+       branches.emplace_back(cond.condition.get());
+       branches.emplace_back("then", &cond.body);
        if(!cond.else_body.body.empty())
-               branches.push_back(Branch("else", &cond.else_body));
+               branches.emplace_back("else", &cond.else_body);
        append_subtree(branches);
 }
 
@@ -434,12 +434,12 @@ void DumpTree::visit(Iteration &iter)
 
        vector<Branch> branches;
        if(iter.init_statement)
-               branches.push_back(Branch("Initialization", iter.init_statement.get()));
+               branches.emplace_back("Initialization", iter.init_statement.get());
        if(iter.condition)
-               branches.push_back(Branch("Condition", iter.condition.get()));
+               branches.emplace_back("Condition", iter.condition.get());
        if(iter.loop_expression)
-               branches.push_back(Branch("Loop", iter.loop_expression.get()));
-       branches.push_back(&iter.body);
+               branches.emplace_back("Loop", iter.loop_expression.get());
+       branches.emplace_back(&iter.body);
        append_subtree(branches);
 }