Changeset 4dc3b8c for src/Tuples


Ignore:
Timestamp:
Nov 30, 2023, 6:14:20 PM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master, stuck-waitfor-destruct
Children:
2f8d351
Parents:
7f2bfb7 (diff), c4570af3 (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

Location:
src/Tuples
Files:
1 deleted
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/Tuples/TupleAssignment.cc

    r7f2bfb7 r4dc3b8c  
    1313// Update Count     : 10
    1414//
     15
     16#include "Tuples.h"
    1517
    1618#include <algorithm>                       // for transform
     
    224226                                // by the cast type as needed, and transfer the resulting environment.
    225227                                ResolvExpr::CandidateFinder finder( spotter.crntFinder.context, env );
    226                                 finder.find( rhsCand->expr, ResolvExpr::ResolvMode::withAdjustment() );
     228                                finder.find( rhsCand->expr, ResolvExpr::ResolveMode::withAdjustment() );
    227229                                assert( 1 == finder.candidates.size() );
    228230                                env = std::move( finder.candidates.front()->env );
     
    345347
    346348                        try {
    347                                 finder.find( expr, ResolvExpr::ResolvMode::withAdjustment() );
     349                                finder.find( expr, ResolvExpr::ResolveMode::withAdjustment() );
    348350                        } catch (...) {
    349351                                // No match is not failure, just that this tuple assignment is invalid.
  • src/Tuples/TupleExpansion.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TupleExpansionNew.cpp --
     7// TupleExpansion.cpp --
    88//
    99// Author           : Henry Xue
     
    294294}
    295295
     296const ast::Type * makeTupleType( const std::vector<ast::ptr<ast::Expr>> & exprs ) {
     297        // If there are no expressions, the answer is set, otherwise go through a loop.
     298        if ( exprs.empty() ) return new ast::TupleType( {} );
     299
     300        std::vector<ast::ptr<ast::Type>> types;
     301        ast::CV::Qualifiers quals(
     302                ast::CV::Const | ast::CV::Volatile | ast::CV::Restrict |
     303                ast::CV::Atomic | ast::CV::Mutex );
     304
     305        for ( const ast::Expr * expr : exprs ) {
     306                assert( expr->result );
     307                // If the type of any expr is void, the type of the entire tuple is void.
     308                if ( expr->result->isVoid() ) return new ast::VoidType();
     309
     310                // Qualifiers on the tuple type are the qualifiers that exist on all components.
     311                quals &= expr->result->qualifiers;
     312
     313                types.emplace_back( expr->result );
     314        }
     315
     316        return new ast::TupleType( std::move( types ), quals );
     317}
     318
     319const ast::TypeInstType * isTtype( const ast::Type * type ) {
     320        if ( const ast::TypeInstType * inst = dynamic_cast< const ast::TypeInstType * >( type ) ) {
     321                if ( inst->base && inst->base->kind == ast::TypeDecl::Ttype ) {
     322                        return inst;
     323                }
     324        }
     325        return nullptr;
     326}
     327
    296328} // namespace Tuples
     329
  • src/Tuples/module.mk

    r7f2bfb7 r4dc3b8c  
    1919        Tuples/Explode.h \
    2020        Tuples/TupleAssignment.cc \
    21         Tuples/TupleExpansion.cc \
    22         Tuples/TupleExpansionNew.cpp \
     21        Tuples/TupleExpansion.cpp \
    2322        Tuples/Tuples.cc \
    2423        Tuples/Tuples.h
Note: See TracChangeset for help on using the changeset viewer.