Re: namespaces and prefix types in context analysis
Eric Ludlam <[email protected]> Sun, 22 Mar 2015 18:27:09 -0400
| Newsgroups | gmane.emacs.cedet |
|---|---|
| Message-ID | <[email protected]> |
On 03/02/2015 05:22 PM, Martin Stein wrote:
> Hi,
>
> trying to figure out how C++ accomplishes computation of prefixe types
> for context analysis, I checked the following piece of code. It is
> derived from an equivalent f90 code, for which context analysis failed
> as well. Here it is:
>
> namespace mystructs
> {
> struct aaa
> {
> int xx;
> };
>
> struct bbb
> {
> struct aaa yy;
> };
> }
>
> struct bbb zz;
>
> int fun()
> {
> using mystructs;
> int uu = zz.!-1-
> int vv = zz.yy.!-2-
> }
[...]
>
> What I do not quite understand is the setting of slot fullscope of
> miniscope in function semantic-analyze-find-tag-sequence-default. (Slot
> typecache does not contain anything as well, so I am not sure in which
> circumstances this slot comes into play.) Why should I overwrite
> fullscope with a set of variable declaration tags, which are of no
> apparent (at least to me) use in type analysis?
Hi Martin,
Sorry for the very slow reply.
It's been a while since I worked in the scope code, so I'm a bit rusty.
The idea is that the scope is supposed to be adapted from the first part
of the dereference as you go through the the search across a long prefix
sequence to include things like types local to the class where you are.
In this case, struct aaa was not part of bbb where the fullscope is
being augmented from, but instead just in scope of the declaration of
yy. To account for this, I checked in a change that, when a lookup for
a type in scope fails, it visits the source tag (yy in this case), and
calculates a scope at that location and tries again. In that case, aaa
is now in scope and everything continues on. I included your example as
part of the test suite.
I don't know if this will help with your fortran parser or not, but it
did fix this C++ example.
Thanks so much for making a c++ example which I could understand. I
don't think I'd have been much help in fortran. ;)
Eric
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/