NagyDonat wrote:

> Probably name of `AllowedAccessTy` was not the best name for this type. This 
> member is meant to be used only for this alternate read-write check 
> functionality.

`AllowedAccess`(Ty) is not a good name for one of several secondary state 
components, but it is a good name for the primary enum within the `StreamState` 
object – better than the generic "`Kind`". (`Kind` does not say anything 
concrete, while `AllowedAccess` clearly implies the meaning of this enum 
value/type.) 

> The stream has still a state and I do not like it to rename this to "access".

The stream still has a state which should be the combination of everything that 
we know about it: the allowed access operations, the `ErrorState` and the 
`FilePositionIndeterminate` bit. You should definitely keep the class 
`StreamState` and its public interface (you may even keep e.g. `getKindStr()` 
if you really want).

------

> The whole issue affects only the internal representation of `StreamState`. If 
> members are made private and access functions are added for all members 
> including `AllowedAccess` (or a new name) an assertion can be added to not 
> use it in closed state.

Hiding the internal representation does not solve the problem that the source 
code is needlessly complex – in fact adding access functions etc. just 
_increases_ the complexity.

https://github.com/llvm/llvm-project/pull/229134
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to