Changeset ef1da0e2 for src/AST


Ignore:
Timestamp:
Sep 20, 2022, 6:34:55 PM (2 years ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
79ae13d, a065f1f
Parents:
8f1e035
Message:

try to make parameter qualifier conversion work for assertions

Location:
src/AST
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Print.cpp

    r8f1e035 ref1da0e2  
    9090
    9191                static constexpr auto Qualifiers = make_array<const char*>(
    92                         "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic"
     92                        "const", "restrict", "volatile", "mutex", "_Atomic"
    9393                );
    9494        };
     
    16241624constexpr array<const char*, 3> Printer::Names::FuncSpecifiers;
    16251625constexpr array<const char*, 6> Printer::Names::StorageClasses;
    1626 constexpr array<const char*, 6> Printer::Names::Qualifiers;
     1626constexpr array<const char*, 5> Printer::Names::Qualifiers;
    16271627}
  • src/AST/TypeEnvironment.hpp

    r8f1e035 ref1da0e2  
    5656struct AssertCompare {
    5757        bool operator()( const VariableExpr * d1, const VariableExpr * d2 ) const {
     58                auto kind1 = ast::SymbolTable::getSpecialFunctionKind(d1->var->name);
     59                auto kind2 = ast::SymbolTable::getSpecialFunctionKind(d2->var->name);
     60                // heuristics optimization: force special functions to go last
     61                if (kind1 > kind2) return true;
     62                else if (kind1 < kind2) return false;
     63
    5864                int cmp = d1->var->name.compare( d2->var->name );
    5965                return cmp < 0 || ( cmp == 0 && d1->result < d2->result );
Note: See TracChangeset for help on using the changeset viewer.