Changeset 0026d67 for src


Ignore:
Timestamp:
Oct 27, 2022, 12:29:48 PM (18 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
22a0e87
Parents:
63d1ebe
Message:

Replaced Mangle::typeMode() with Mangle::mangleType(...), as it is how typeMode() was always used and it is shorter. Various other clean-up in the Mangler files.

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScrubTyVars.cc

    r63d1ebe r0026d67  
    2020#include "GenPoly/ErasableScopedMap.h"  // for ErasableScopedMap<>::const_it...
    2121#include "ScrubTyVars.h"
    22 #include "SymTab/Mangler.h"             // for mangle, typeMode
     22#include "SymTab/Mangler.h"             // for mangleType
    2323#include "SynTree/Declaration.h"        // for TypeDecl, TypeDecl::Data, Typ...
    2424#include "SynTree/Expression.h"         // for Expression (ptr only), NameExpr
     
    227227        if ( dynType ) {
    228228                return new ast::NameExpr( expr->location,
    229                         sizeofName( Mangle::mangle( dynType, Mangle::typeMode() ) ) );
     229                        sizeofName( Mangle::mangleType( dynType ) ) );
    230230        } else {
    231231                return expr;
     
    237237        if ( dynType ) {
    238238                return new ast::NameExpr( expr->location,
    239                         alignofName( Mangle::mangle( dynType, Mangle::typeMode() ) ) );
     239                        alignofName( Mangle::mangleType( dynType ) ) );
    240240        } else {
    241241                return expr;
  • src/ResolvExpr/SatisfyAssertions.cpp

    r63d1ebe r0026d67  
    268268                ast::ptr< ast::Type > resType = cand.expr->result;
    269269                cand.env.apply( resType );
    270                 return Mangle::mangle( resType, Mangle::typeMode() );
     270                return Mangle::mangleType( resType );
    271271        }
    272272
  • src/SymTab/Mangler.cc

    r63d1ebe r0026d67  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:40:29 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 11 21:56:06 2021
    13 // Update Count     : 74
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Oct 21 16:18:00 2022
     13// Update Count     : 75
    1414//
    1515#include "Mangler.h"
     
    418418                        void postvisit( const ast::QualifiedType * qualType );
    419419
    420                         std::string get_mangleName() { return mangleName; }
     420                        /// The result is the current constructed mangled name.
     421                        std::string result() const { return mangleName; }
    421422                  private:
    422423                        std::string mangleName;         ///< Mangled name being constructed
     
    444445        } // namespace
    445446
    446 
    447447        std::string mangle( const ast::Node * decl, Mangle::Mode mode ) {
    448                 ast::Pass<Mangler_new> mangler( mode );
    449                 maybeAccept( decl, mangler );
    450                 return mangler.core.get_mangleName();
     448                return ast::Pass<Mangler_new>::read( decl, mode );
    451449        }
    452450
     
    689687                                        } // for
    690688                                        for ( auto & assert : ptype->assertions ) {
    691                                                 ast::Pass<Mangler_new> sub_mangler(
    692                                                         mangleOverridable, typeMode, mangleGenericParams, nextVarNum, varNums );
    693                                                 assert->var->accept( sub_mangler );
    694                                                 assertionNames.push_back( sub_mangler.core.get_mangleName() );
     689                                                assertionNames.push_back( ast::Pass<Mangler_new>::read(
     690                                                        assert->var.get(),
     691                                                        mangleOverridable, typeMode, mangleGenericParams, nextVarNum, varNums ) );
    695692                                                acount++;
    696693                                        } // for
  • src/SymTab/Mangler.h

    r63d1ebe r0026d67  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:44:03 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:45:30 2017
    13 // Update Count     : 15
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thu Oct 27 11:58:00 2022
     13// Update Count     : 16
    1414//
    1515
     
    2222
    2323#include "AST/Bitfield.hpp"
    24 #include "AST/Fwd.hpp"
    2524#include "SynTree/SynTree.h"  // for Types
    2625#include "SynTree/Visitor.h"  // for Visitor, maybeAccept
     
    3332// * Currently name compression is not implemented.
    3433
     34namespace ast {
     35        class Node;
     36}
    3537namespace ResolvExpr {
    3638        class TypeEnvironment;
     
    101103        using Mode = bitfield<mangle_flags>;
    102104
    103         static inline Mode typeMode() { return NoOverrideable | Type; }
     105        /// Mangle declaration name.
     106        std::string mangle( const ast::Node * decl, Mode mode = {} );
    104107
    105         /// Mangle declaration name
    106         std::string mangle( const ast::Node * decl, Mode mode = {} );
     108        /// Most common mangle configuration for types.
     109        static inline std::string mangleType( const ast::Node * type ) {
     110                return mangle( type, { NoOverrideable | Type } );
     111        }
    107112
    108113        namespace Encoding {
  • src/Virtual/ExpandCasts.cc

    r63d1ebe r0026d67  
    295295        // returns the previous declaration for error messages.
    296296        ast::ObjectDecl const * insert( ast::ObjectDecl const * typeIdDecl ) {
    297                 std::string const & mangledName =
    298                                 Mangle::mangle( typeIdDecl->type, Mangle::typeMode() );
     297                std::string mangledName = Mangle::mangleType( typeIdDecl->type );
    299298                ast::ObjectDecl const *& value = instances[ mangledName ];
    300299                if ( value ) {
     
    310309
    311310        ast::ObjectDecl const * lookup( ast::Type const * typeIdType ) {
    312                 std::string const & mangledName =
    313                                 Mangle::mangle( typeIdType, Mangle::typeMode() );
     311                std::string mangledName = Mangle::mangleType( typeIdType );
    314312                auto const it = instances.find( mangledName );
    315313                return ( instances.end() == it ) ? nullptr : it->second;
Note: See TracChangeset for help on using the changeset viewer.