commit a4b3b284742d4f7f3cd2fd53a00acff7a8c6a0cf
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Wed Aug 17 09:36:04 2016 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Wed Aug 17 13:35:58 2016 +0200

    [cc2-qbe] Add support for NULL parameter in tmpnode()
    
    It is a very common case to call 'newnode(tmpnode(OTMP))'
    so it is a good idea to pack it into newnode().

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index 6db1123..57e0c68 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
@@ -97,6 +97,8 @@ tmpnode(Node *np, Type *tp)
 {
        Symbol *sym;
 
+       if (!np)
+               np = newnode(OTMP);
        sym = getsym(TMPSYM);
        sym->type = np->type = *tp;
        sym->kind = STMP;

Reply via email to