Changeset c68f6e6 for src/AST/Create.cpp


Ignore:
Timestamp:
Jul 31, 2023, 4:38:35 PM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
07b59ec
Parents:
2e94f3e7 (diff), 17c13b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Create.cpp

    r2e94f3e7 rc68f6e6  
    4242                return nullptr;
    4343        }
    44         return new ast::FunctionDecl( decl->location,
    45                 decl->name,
    46                 vectorCopy( decl->type_params ),
    47                 vectorCopy( decl->assertions ),
    48                 vectorCopy( decl->params ),
    49                 vectorCopy( decl->returns ),
    50                 nullptr,
    51                 decl->storage,
    52                 decl->linkage,
    53                 vectorCopy( decl->attributes ),
    54                 decl->funcSpec,
    55                 decl->type->isVarArgs
    56         );
     44        // The cast and changing the original should be safe as long as the
     45        // change is reverted before anything else sees it. It's also faster.
     46        FunctionDecl * mutDecl = const_cast<FunctionDecl *>( decl );
     47        CompoundStmt const * stmts = mutDecl->stmts.release();
     48        FunctionDecl * copy = deepCopy( mutDecl );
     49        mutDecl->stmts = stmts;
     50        return copy;
    5751}
    5852
Note: See TracChangeset for help on using the changeset viewer.