Changeset a56d544


Ignore:
Timestamp:
Feb 14, 2026, 10:38:00 PM (2 days ago)
Author:
Matthew Au-Yeung <mw2auyeu@…>
Branches:
stuck-waitfor-destruct
Children:
7e8c071
Parents:
c9d36b1
git-author:
Matthew Au-Yeung <mw2auyeu@…> (02/14/26 22:30:32)
git-committer:
Matthew Au-Yeung <mw2auyeu@…> (02/14/26 22:38:00)
Message:

cleanup and add tests

Files:
3 added
1 deleted
4 edited
3 moved

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.cpp

    rc9d36b1 ra56d544  
    264264}
    265265
     266ConstantExpr * ConstantExpr::from_ulonglong( const CodeLocation & loc, unsigned long long i ) {
     267        return new ConstantExpr{
     268                loc, new BasicType{ BasicKind::LongLongUnsignedInt }, std::to_string( i ) + "ULL",
     269                (unsigned long long)i };
     270}
     271
    266272ConstantExpr * ConstantExpr::from_string( const CodeLocation & loc, const std::string & str ) {
    267273        const Type * charType = new BasicType( BasicKind::Char, ast::CV::Const );
  • src/AST/Expr.hpp

    rc9d36b1 ra56d544  
    464464        /// Generates an integer constant of the given unsigned long int.
    465465        static ConstantExpr * from_ulong( const CodeLocation & loc, unsigned long i );
     466        /// Generates an integer constant of the given unsigned long long int.
     467        static ConstantExpr * from_ulonglong( const CodeLocation & loc, unsigned long long i );
    466468        /// Generates a string constant from the given string (char type, unquoted string).
    467469        static ConstantExpr * from_string( const CodeLocation & loc, const std::string & string );
  • src/Concurrency/MutexFuncHash.hpp

    rc9d36b1 ra56d544  
    1818#include "AST/Decl.hpp"
    1919#include "AST/Expr.hpp"
    20 #include "AST/Type.hpp"
    2120#include "SymTab/Mangler.hpp"
    2221
     
    2726// since function pointers may differ for static inline functions.
    2827static inline uint64_t hashMangle( const ast::DeclWithType * decl ) {
    29         std::string name = Mangle::mangle( decl );
     28        std::string name = Mangle::mangleType( decl );
    3029        uint64_t hash = 14695981039346656037ULL; // FNV offset basis
    3130        for ( char c : name ) {
     
    3635}
    3736
    38 // Create a ConstantExpr for the hash with proper ULL suffix to avoid
    39 // C compiler warnings about large unsigned constants.
    40 static inline ast::ConstantExpr * hashMangleExpr(
    41                 const CodeLocation & location, const ast::DeclWithType * decl ) {
    42         uint64_t hash = hashMangle( decl );
    43         return new ast::ConstantExpr{
    44                 location,
    45                 new ast::BasicType{ ast::BasicKind::LongLongUnsignedInt },
    46                 std::to_string( hash ) + "ull",
    47                 (unsigned long long)hash };
     37// Create a ConstantExpr with the hash of the mangled name.
     38static inline ast::ConstantExpr * hashMangleExpr(
     39        const CodeLocation & location, const ast::DeclWithType * decl ) {
     40        return ast::ConstantExpr::from_ulonglong( location, hashMangle( decl ) );
    4841}
    4942
  • tests/Makefile.am

    rc9d36b1 ra56d544  
    119119.PHONY : concurrency list .validate .test_makeflags
    120120.INTERMEDIATE : .validate .validate.cfa .test_makeflags
    121 EXTRA_PROGRAMS = array-collections/boxed avl_test linkonce linkoncedestructor linking/mangling/anon .dummy_hack # build but do not install
     121EXTRA_PROGRAMS = array-collections/boxed avl_test linkonce concurrency/waitfor/autogen_destructor linking/mangling/anon .dummy_hack # build but do not install
    122122EXTRA_DIST = test.py \
    123123        pybin/__init__.py \
     
    154154avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa
    155155linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa
    156 linkoncedestructor_SOURCES = link-once-destructor/waitfor-destructor.cfa link-once-destructor/nodestructor.cfa
     156concurrency_waitfor_autogen_destructor_SOURCES = concurrency/waitfor/autogen_destructor.cfa concurrency/waitfor/nodestructor.cfa
    157157linking_mangling_anon_SOURCES = linking/mangling/header.hfa linking/mangling/lib.cfa linking/mangling/main.cfa
    158158# automake doesn't know we still need C/CPP rules so pretend like we have a C program
  • tests/concurrency/waitfor/nodestructor.hfa

    rc9d36b1 ra56d544  
    33thread MyThread {};
    44
    5 void main(MyThread &t); 
     5void main(MyThread &t);
Note: See TracChangeset for help on using the changeset viewer.