GabrielDosReis / ipr

Compiler-neutral Internal Program Representation for C++
BSD 3-Clause "New" or "Revised" License
222 stars 23 forks source link

Pull out a seq<Decl> from a scope into a region #180

Closed GorNishanov closed 2 years ago

GorNishanov commented 3 years ago

Currently, Region is just a host for a scope which contains both a sequence a declaration (in the order they appear in the region) and a lookup by name and type for a scope.

There are cases where a declaration lexically appears in one region, but, added to a scope in a different (usually in the home) region.

Tentative suggestion is to move members() from scope into a region.

GabrielDosReis commented 3 years ago

The notion of scope in IPR is more general than that of Standard C++. In IPR, a Scope is just a sequence of declarations, with no specific attachment to a declarative region. The Standard C++ notion of scope is obtained by pairing a declarative Region and a Scope. It makes sense for Region to provide an operation declarations() that retrieves all declarations from a Region (whether lexical or resident), but it is not clear that the operation members() of Scope must be moved out.

GabrielDosReis commented 2 years ago

Given that a Scope is a sequence of declaration, it is not clear what this suggestion would really accomplish. I am going to close this suggestion for now. Please, reopen if and when there is new information to change the design.