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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.