Changeset dd020c0 for src/SymTab


Ignore:
Timestamp:
Mar 3, 2017, 10:12:02 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
8191203
Parents:
f37147b
Message:

first attempt to create function specifiers

Location:
src/SymTab
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.cc

    rf37147b rdd020c0  
    1010// Created On       : Thu Mar 03 15:45:56 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 16 15:02:50 2017
    13 // Update Count     : 13
     12// Last Modified On : Fri Mar  3 22:00:55 2017
     13// Update Count     : 30
    1414//
    1515
     
    163163                DeclarationNode::StorageClass sc = functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static;
    164164                LinkageSpec::Spec spec = isIntrinsic ? LinkageSpec::Intrinsic : LinkageSpec::AutoGen;
    165                 FunctionDecl * decl = new FunctionDecl( fname, sc, spec, ftype, new CompoundStmt( noLabels ), true, false );
     165                FunctionDecl * decl = new FunctionDecl( fname, sc, spec, ftype, new CompoundStmt( noLabels ),
     166                                                                                                std::list< Attribute * >(), DeclarationNode::FuncSpecifier( DeclarationNode::InlineSpec ) );
    166167                decl->fixUniqueId();
    167168                return decl;
     
    717718                                        TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), DeclarationNode::NoStorageClass, nullptr, TypeDecl::Any );
    718719                                        TypeInstType * inst = new TypeInstType( Type::Qualifiers(), newDecl->get_name(), newDecl );
    719                                         newDecl->get_assertions().push_back( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genAssignType( inst ), nullptr, true, false ) );
    720                                         newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genDefaultType( inst ), nullptr, true, false ) );
    721                                         newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genCopyType( inst ), nullptr, true, false ) );
    722                                         newDecl->get_assertions().push_back( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genDefaultType( inst ), nullptr, true, false ) );
     720                                        newDecl->get_assertions().push_back( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genAssignType( inst ), nullptr,
     721                                                                                                                                                   std::list< Attribute * >(), DeclarationNode::FuncSpec( DeclarationNode::InlineSpec ) ) );
     722                                        newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
     723                                                                                                                                                   std::list< Attribute * >(), DeclarationNode::FuncSpec( DeclarationNode::InlineSpec ) ) );
     724                                        newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genCopyType( inst ), nullptr,
     725                                                                                                                                                   std::list< Attribute * >(), DeclarationNode::FuncSpec( DeclarationNode::InlineSpec ) ) );
     726                                        newDecl->get_assertions().push_back( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
     727                                                                                                                                                   std::list< Attribute * >(), DeclarationNode::FuncSpec( DeclarationNode::InlineSpec ) ) );
    723728                                        typeParams.push_back( newDecl );
    724729                                        done.insert( ty->get_baseType() );
  • src/SymTab/Validate.cc

    rf37147b rdd020c0  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 23 21:33:55 2017
    13 // Update Count     : 318
     12// Last Modified On : Fri Mar  3 21:02:23 2017
     13// Update Count     : 332
    1414//
    1515
     
    660660                // Note, qualifiers on the typedef are superfluous for the forward declaration.
    661661                if ( StructInstType *aggDecl = dynamic_cast< StructInstType * >( tyDecl->get_base() ) ) {
    662                         return aggDecl->get_baseStruct() ? Mutator::mutate( aggDecl->get_baseStruct() ) : new StructDecl( aggDecl->get_name() );
     662                        return new StructDecl( aggDecl->get_name() );
    663663                } else if ( UnionInstType *aggDecl = dynamic_cast< UnionInstType * >( tyDecl->get_base() ) ) {
    664                         return aggDecl->get_baseUnion() ? Mutator::mutate( aggDecl->get_baseUnion() ) : new UnionDecl( aggDecl->get_name() );
     664                        return new UnionDecl( aggDecl->get_name() );
    665665                } else if ( EnumInstType *enumDecl = dynamic_cast< EnumInstType * >( tyDecl->get_base() ) ) {
    666666                        return new EnumDecl( enumDecl->get_name() );
     
    691691                DeclarationWithType *ret = Mutator::mutate( objDecl );
    692692                typedefNames.endScope();
    693                 // is the type a function?
    694                 if ( FunctionType *funtype = dynamic_cast<FunctionType *>( ret->get_type() ) ) {
     693
     694                if ( FunctionType *funtype = dynamic_cast<FunctionType *>( ret->get_type() ) ) { // function type?
    695695                        // replace the current object declaration with a function declaration
    696                         FunctionDecl * newDecl = new FunctionDecl( ret->get_name(), ret->get_storageClass(), ret->get_linkage(), funtype, 0, ret->get_isInline(), ret->get_isNoreturn(), objDecl->get_attributes() );
     696                        FunctionDecl * newDecl = new FunctionDecl( ret->get_name(), ret->get_storageClass(), ret->get_linkage(), funtype, 0, objDecl->get_attributes(), ret->get_funcSpec() );
    697697                        objDecl->get_attributes().clear();
    698698                        objDecl->set_type( nullptr );
    699699                        delete objDecl;
    700700                        return newDecl;
    701                 } else if ( objDecl->get_isInline() || objDecl->get_isNoreturn() ) {
    702                         throw SemanticError( "invalid inline or _Noreturn specification in declaration of ", objDecl );
    703701                } // if
    704702                return ret;
Note: See TracChangeset for help on using the changeset viewer.