Changeset b0d9ff7 for src/SymTab


Ignore:
Timestamp:
Sep 1, 2022, 1:27:52 PM (20 months ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
12df6fe
Parents:
def751f
Message:

Fix up the QualifiedNameExpr?. It should now work on both old AST and new AST. There are some known bugs to fix so make all-tests will fail.

Location:
src/SymTab
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Mangler.cc

    rdef751f rb0d9ff7  
    6565                                void postvisit( const QualifiedType * qualType );
    6666
     67                                void postvisit( const QualifiedNameExpr * qualNameExpr );
     68
    6769                                std::string get_mangleName() { return mangleName; }
    6870                          private:
     
    305307                                        mangleName += Encoding::qualifiedTypeEnd;
    306308                                }
     309                        }
     310
     311                        void Mangler_old::postvisit( const QualifiedNameExpr * qual ) {
     312                                maybeAccept( qual->var, *visitor );
    307313                        }
    308314
     
    417423                        void postvisit( const ast::OneType * oneType );
    418424                        void postvisit( const ast::QualifiedType * qualType );
     425                        void postvisit( const ast::QualifiedNameExpr * qualNameExpr );
    419426
    420427                        std::string get_mangleName() { return mangleName; }
     
    645652                                mangleName += Encoding::qualifiedTypeEnd;
    646653                        }
     654                }
     655                void Mangler_new::postvisit( const ast::QualifiedNameExpr * qual ) {
     656                        maybeAccept( qual->var.get(), *visitor );
    647657                }
    648658
  • src/SymTab/Validate.cc

    rdef751f rb0d9ff7  
    857857                } else if ( UnionInstType * aggDecl = dynamic_cast< UnionInstType * >( designatorType ) ) {
    858858                        declsToAddBefore.push_back( new UnionDecl( aggDecl->name, noAttributes, tyDecl->linkage ) );
    859                 } else if ( EnumInstType * enumDecl = dynamic_cast< EnumInstType * >( designatorType ) ) {
     859                } else if ( EnumInstType * enumInst = dynamic_cast< EnumInstType * >( designatorType ) ) {
    860860                        // declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage, enumDecl->baseEnum->base ) );
    861                         if (enumDecl->baseEnum) {
    862                                 declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage, enumDecl->baseEnum->base ) );
     861                        if ( enumInst->baseEnum ) {
     862                                const EnumDecl * enumDecl = enumInst->baseEnum;
     863                                declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, enumDecl->isTyped, tyDecl->linkage, enumDecl->base ) );
    863864                        } else {
    864                                 declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage ) );
     865                                declsToAddBefore.push_back( new EnumDecl( enumInst->name, noAttributes, tyDecl->linkage ) );
    865866                        }
    866867                } // if
  • src/SymTab/ValidateType.cc

    rdef751f rb0d9ff7  
    8282        void postvisit( QualifiedType * qualType );
    8383
     84        void postvisit( QualifiedNameExpr * qualExpr );
     85
    8486        void postvisit( EnumDecl * enumDecl );
    8587        void postvisit( StructDecl * structDecl );
     
    157159        // linking only makes sense for the 'oldest ancestor' of the qualified type
    158160        qualType->parent->accept( * visitor );
     161}
     162
     163void LinkReferenceToTypes_old::postvisit( QualifiedNameExpr * qualExpr ) {
     164        const EnumDecl * st = local_indexer->lookupEnum( qualExpr->type_decl->name );
     165        qualExpr->type_decl = const_cast<EnumDecl *>(st);
    159166}
    160167
Note: See TracChangeset for help on using the changeset viewer.