Changeset 6018ddb for src


Ignore:
Timestamp:
Feb 25, 2026, 12:52:06 AM (3 days ago)
Author:
Matthew Au-Yeung <mw2auyeu@…>
Branches:
stuck-waitfor-destruct
Children:
a0548c2
Parents:
2b3ebe5
git-author:
Matthew Au-Yeung <mw2auyeu@…> (02/25/26 00:31:10)
git-committer:
Matthew Au-Yeung <mw2auyeu@…> (02/25/26 00:52:06)
Message:

Revert "cleanup and add tests"

This reverts commit a56d544a48fa37aa9352321253b32a7ddc0159c7.

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.cpp

    r2b3ebe5 r6018ddb  
    264264}
    265265
    266 ConstantExpr * 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 
    272266ConstantExpr * ConstantExpr::from_string( const CodeLocation & loc, const std::string & str ) {
    273267        const Type * charType = new BasicType( BasicKind::Char, ast::CV::Const );
  • src/AST/Expr.hpp

    r2b3ebe5 r6018ddb  
    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 );
    468466        /// Generates a string constant from the given string (char type, unquoted string).
    469467        static ConstantExpr * from_string( const CodeLocation & loc, const std::string & string );
  • src/Concurrency/MutexFuncHash.hpp

    r2b3ebe5 r6018ddb  
    1818#include "AST/Decl.hpp"
    1919#include "AST/Expr.hpp"
     20#include "AST/Type.hpp"
    2021#include "SymTab/Mangler.hpp"
    2122
     
    2627// since function pointers may differ for static inline functions.
    2728static inline uint64_t hashMangle( const ast::DeclWithType * decl ) {
    28         std::string name = Mangle::mangleType( decl );
     29        std::string name = Mangle::mangle( decl );
    2930        uint64_t hash = 14695981039346656037ULL; // FNV offset basis
    3031        for ( char c : name ) {
     
    3536}
    3637
    37 // Create a ConstantExpr with the hash of the mangled name.
    38 static inline ast::ConstantExpr * hashMangleExpr(
    39         const CodeLocation & location, const ast::DeclWithType * decl ) {
    40         return ast::ConstantExpr::from_ulonglong( location, hashMangle( decl ) );
     38// Create a ConstantExpr for the hash with proper ULL suffix to avoid
     39// C compiler warnings about large unsigned constants.
     40static 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 };
    4148}
    4249
Note: See TracChangeset for help on using the changeset viewer.