Changeset 20737104 for src/AST


Ignore:
Timestamp:
Sep 21, 2022, 9:38:34 AM (20 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
0bd46fd
Parents:
e9e9f56
Message:

Wrote a new asForward helper for Autogen.

Location:
src/AST
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Create.cpp

    re9e9f56 r20737104  
    1010// Created On       : Tue Sep 20 13:28:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Sep 20 14:55:00 2022
    13 // Update Count     : 0
     12// Last Modified On : Tue Sep 21  9:29:00 2022
     13// Update Count     : 1
    1414//
    1515
     
    1919#include "AST/Copy.hpp"
    2020#include "AST/Decl.hpp"
     21#include "AST/Type.hpp"
    2122
    2223namespace ast {
     
    3536
    3637} // namespace
     38
     39FunctionDecl * asForward( FunctionDecl const * decl ) {
     40        if ( nullptr == decl->stmts ) {
     41                return nullptr;
     42        }
     43        return new ast::FunctionDecl( decl->location,
     44                decl->name,
     45                vectorCopy( decl->type_params ),
     46                vectorCopy( decl->assertions ),
     47                vectorCopy( decl->params ),
     48                vectorCopy( decl->returns ),
     49                nullptr,
     50                decl->storage,
     51                decl->linkage,
     52                vectorCopy( decl->attributes ),
     53                decl->funcSpec,
     54                decl->type->isVarArgs
     55        );
     56}
    3757
    3858StructDecl * asForward( StructDecl const * decl ) {
  • src/AST/Create.hpp

    re9e9f56 r20737104  
    1010// Created On       : Tue Sep 20 13:25:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Sep 20 14:38:00 2022
    13 // Update Count     : 0
     12// Last Modified On : Tue Sep 20 15:34:00 2022
     13// Update Count     : 1
    1414//
    1515
     
    2121/// If the argument is already a forward declaration, return nullptr instead.
    2222/// More efficient than the deepCopy and clear pattern.
     23FunctionDecl * asForward( FunctionDecl const * );
    2324StructDecl * asForward( StructDecl const * );
    2425UnionDecl * asForward( UnionDecl const * );
Note: See TracChangeset for help on using the changeset viewer.