Changeset 17fa94f for src/AST/Util.cpp


Ignore:
Timestamp:
Feb 11, 2025, 11:24:07 AM (12 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
691bf0a
Parents:
3e5e32cf
Message:

Reworked some nodes so they can be typed or untyped. This allowed me to remove TranslationDeps as the type information is only needed in the candidate finder, which can easily insert it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Util.cpp

    r3e5e32cf r17fa94f  
    384384}
    385385
    386 namespace {
    387         const TranslationUnit * transUnit = 0;
    388 }
    389 
    390 void TranslationDeps::evolve( TranslationUnit & u ) {
    391         transUnit = &u;
    392 }
    393 
    394 const ast::Type * TranslationDeps::getSizeType() {
    395         static const ast::Type * zd_abstract = new TypeInstType{ "size_t", TypeDecl::Kind::Dtype };
    396         static const ast::Type * ld_concrete = new BasicType( BasicKind::LongUnsignedInt );
    397         if ( ! transUnit ) {
    398                 // early state
    399                 // as if `size_t` in program text were freshly parsed
    400                 return zd_abstract;
    401         } else if ( transUnit->global.sizeType ) {
    402                 // late state, normal run
    403                 // whatever size_t was defined as
    404                 return transUnit->global.sizeType;
    405         } else {
    406                 // late state, no prelude (-n)
    407                 // placeholder: cfa-cpp is being used experimentally, stay out of the way
    408                 return ld_concrete;
    409         }
    410 }
    411 
    412 
    413386} // namespace ast
Note: See TracChangeset for help on using the changeset viewer.