MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / flagsWithoutAliasCache

Function flagsWithoutAliasCache

src/ast/ast_typedecl.cpp:486–496  ·  view source on GitHub ↗

Save/clear/restore the lazy findAlias cache bits (PR #2849) so they don't enter the lookup/semantic hash. The bits reflect runtime cache state, not type identity; two compiles of the same source can leave them differently set depending on findAlias lifecycle, and we don't want that to leak.

Source from the content-addressed store, hash-verified

484 // type identity; two compiles of the same source can leave them differently
485 // set depending on findAlias lifecycle, and we don't want that to leak.
486 static __forceinline uint32_t flagsWithoutAliasCache(const TypeDecl * td) {
487 TypeDecl * mut = const_cast<TypeDecl*>(td);
488 const bool savedV = mut->aliasCacheValid;
489 const bool savedH = mut->aliasCacheHasAlias;
490 mut->aliasCacheValid = false;
491 mut->aliasCacheHasAlias = false;
492 const uint32_t result = mut->flags;
493 mut->aliasCacheValid = savedV;
494 mut->aliasCacheHasAlias = savedH;
495 return result;
496 }
497
498 void TypeDecl::getLookupHash(uint64_t & hash) const {
499 hash = hashmix(hash, baseType);

Callers 3

getLookupHashMethod · 0.85
getSemanticHashMethod · 0.85
getOwnSemanticHashMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected