Changeset 4ae2364


Ignore:
Timestamp:
Jun 3, 2019, 5:36:47 PM (3 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
98a8290, ee574a2
Parents:
f474e91 (diff), dafe9e1 (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
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    rf474e91 r4ae2364  
    4747namespace {
    4848
    49 // This is to preserve the SymTab::dereferenceOperator hack. It does not (and perhaps should not)
     49// This is to preserve the FindSpecialDecls hack. It does not (and perhaps should not)
    5050// allow us to use the same stratagy in the new ast.
    5151ast::FunctionDecl * dereferenceOperator = nullptr;
     52ast::StructDecl   * dtorStruct = nullptr;
     53ast::FunctionDecl * dtorStructDestroy = nullptr;
    5254
    5355}
     
    176178                        Validate::dereferenceOperator = decl;
    177179                }
     180                if ( dtorStructDestroy == node ) {
     181                        Validate::dtorStructDestroy = decl;
     182                }
    178183                return declWithTypePostamble( decl, node );
    179184        }
     
    231236                        LinkageSpec::Spec( node->linkage.val )
    232237                );
     238
     239                if ( dtorStruct == node ) {
     240                        Validate::dtorStruct = decl;
     241                }
     242
    233243                return aggregatePostamble( decl, node );
    234244        }
     
    14581468                        dereferenceOperator = decl;
    14591469                }
     1470
     1471                if ( Validate::dtorStructDestroy == old ) {
     1472                        dtorStructDestroy = decl;
     1473                }
    14601474        }
    14611475
     
    14791493
    14801494                this->node = decl;
     1495
     1496                if ( Validate::dtorStruct == old ) {
     1497                        dtorStruct = decl;
     1498                }
    14811499        }
    14821500
  • src/AST/Node.hpp

    rf474e91 r4ae2364  
    1010// Created On       : Wed May 8 10:27:04 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu May 23 16:00:00 2019
    13 // Update Count     : 4
     12// Last Modified On : Mon Jun  3 13:26:00 2019
     13// Update Count     : 5
    1414//
    1515
     
    107107        ptr_base() : node(nullptr) {}
    108108        ptr_base( const node_t * n ) : node(n) { if( node ) _inc(node); }
    109         ~ptr_base() { if( node ) _dec(node); }
     109        ~ptr_base() { if( node ) { auto tmp = node; node = nullptr; _dec(tmp); } }
    110110
    111111        ptr_base( const ptr_base & o ) : node(o.node) {
     
    127127        template<typename o_node_t>
    128128        ptr_base & operator=( const o_node_t * node ) {
    129                 assign( node ? strict_dynamic_cast<const node_t *>(node) : nullptr );
     129                assign( strict_dynamic_cast<const node_t *, nullptr>(node) );
    130130                return *this;
    131131        }
  • src/AST/Type.hpp

    rf474e91 r4ae2364  
    4848
    4949        Type * set_const( bool v ) { qualifiers.is_const = v; return this; }
     50        Type * set_volatile( bool v ) { qualifiers.is_volatile = v; return this; }
    5051        Type * set_restrict( bool v ) { qualifiers.is_restrict = v; return this; }
    5152        Type * set_lvalue( bool v ) { qualifiers.is_lvalue = v; return this; }
  • src/AST/TypeSubstitution.cpp

    rf474e91 r4ae2364  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 15:54:35 2017
    13 // Update Count     : 4
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jun  3 13:26:00 2017
     13// Update Count     : 5
    1414//
    1515
     
    2626}
    2727
    28 TypeSubstitution::~TypeSubstitution() {
    29         for ( TypeEnvType::iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) {
    30                 delete( i->second );
    31         }
    32         for ( VarEnvType::iterator i = varEnv.begin(); i != varEnv.end(); ++i ) {
    33                 delete( i->second );
    34         }
    35 }
     28TypeSubstitution::~TypeSubstitution() {}
    3629
    3730TypeSubstitution &TypeSubstitution::operator=( const TypeSubstitution &other ) {
  • src/Validate/FindSpecialDecls.cc

    rf474e91 r4ae2364  
    2626namespace Validate {
    2727        Type * SizeType = nullptr;
    28   FunctionDecl * dereferenceOperator = nullptr;
    29   StructDecl * dtorStruct = nullptr;
    30   FunctionDecl * dtorStructDestroy = nullptr;
     28        FunctionDecl * dereferenceOperator = nullptr;
     29        StructDecl * dtorStruct = nullptr;
     30        FunctionDecl * dtorStructDestroy = nullptr;
    3131
    3232        namespace {
  • src/include/cassert

    rf474e91 r4ae2364  
    1010// Created On       : Thu Aug 18 13:19:26 2016
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu May 23 15:30:00 2017
    13 // Update Count     : 17
     12// Last Modified On : Mon Jun  3 13:11:00 2017
     13// Update Count     : 18
    1414//
    1515
     
    4343#endif
    4444
    45 enum StrictAllowNull {NonNull, AllowNull};
    46 
    47 template<typename T, StrictAllowNull nullable = NonNull, typename U>
     45template<typename T, typename U>
    4846static inline T strict_dynamic_cast( const U & src ) {
    49         if (nullable == AllowNull && src == nullptr) {
    50                 return nullptr;
    51         }
    5247        assert(src);
    5348        T ret = dynamic_cast<T>(src);
    5449        assertf(ret, "%s", toString(src).c_str());
    5550        return ret;
     51}
     52
     53template<typename T, decltype(nullptr) null, typename U>
     54static inline T strict_dynamic_cast( const U & src ) {
     55        return src ? strict_dynamic_cast<T, U>( src ) : nullptr;
    5656}
    5757
Note: See TracChangeset for help on using the changeset viewer.