bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ scoping of cross-reference?


From: Shigio YAMAGUCHI
Subject: Re: C++ scoping of cross-reference?
Date: Mon, 11 Jul 2011 12:15:51 +0900

Hi,
I agree with you.
I would like to make your proposal be a base of the specification
of the class facility of GLOBAL. I have put this into the TODO list.
(http://www.gnu.org/software/global/plans.html)

Thank you.

I would like to make your proposal as a base of the class 
> 
>  On 04/05/2011 10:26 PM, Shigio YAMAGUCHI wrote:
> > ...
> > Could you please review your example so as not to include what is not
> > important? If there are such things, it is difficult to understand your
> > intention. Thank you in advance.
> Hi Shigio,
> 
> Sorry for the delay in replying to this thread. I've taken another go at
> describing the extended functionality I'd like to see. Please let me
> know your comments.
> 
> I propose that the gtags database be extended to provide class-qualified
> definitions. When searching for a definition, I would like to be able to
> optionally specify the class qualifier. For example, consider:
> 
> [Class hierarchy]
> 
>     class A
>       |- class B
>            |- class C
> 
> [Source files]
> 
>     [classA.cc]
>     +--------------------------------
>     |...
>     |class A
>         |{
>         |  void dump() {...};
>         |  void method2() {...};
>         |};
> 
> 
>     [classB.h]
>     +--------------------------------
>     |...
>     |class B : A
>         |{
>         |  void dump()  // overrides A::dump()
>         |};
> 
>     [classB.cc]
>     +--------------------------------
>     |...
>     |void B::dump() {...}
> 
>     [classC.cc]
>     +--------------------------------
>     |...
>     |class C : B
>         |{
>         |  void dump() {...}; // overrides B::dump()
>         |}
> 
> 
> [Execution image]
> 
>         $ global -x dump
>     A::dump        classA.cc     50 class A { void dump() {...} }
>     B::dump        classB.h     20 class B : A { void dump() }
>     B::dump        classB.cc    100 void B::dump() {...}
>     C::dump        classC.cc     90 class C : B { void dump() {...} }
>     $ _
> 
>     $ global -x A::dump
>     A::dump        classA.cc     50 class A { void dump() {...} }
>         $ _
> 
>     $ global -x B::dump
>     B::dump        classB.h     20 class B : A { void dump() }
>     B::dump        classB.cc    100 void B::dump() {...}
>     $ _
> 
>     $ global -x C::dump
>     C::dump        classC.cc     90 class C : B { void dump() {...} }
>     $ _
> 
> Possible extension
> ==================
> I propose that global also be extended with a new option which
> provides the ability to show derived methods:
> 
>   -d    Shows methods derived from given C++ symbol. (Requires gtags
>         database built with C++ scoping)
> 
> [Execution image]
> 
>     $ global -x -d A::dump
>     A::dump        classA.cc     50 class A { void dump() {...} }
>     B::dump        classB.h     20 class B : A { void dump() }
>     B::dump        classB.cc    100 void B::dump() {...}
>     C::dump        classC.cc     90 class C : B { void dump() {...} }
>         $ _
> 
>     $ global -x -d B::dump
>     B::dump        classB.h     20 class B : A { void dump() }
>     B::dump        classB.cc    100 void B::dump() {...}
>     C::dump        classC.cc     90 class C : B { void dump() {...} }
>     $ _
> 
>     $ global -x -d C::dump
>     C::dump        classC.cc     90 class C : B { void dump() {...} }
>     $ _
> 
> Searching on an inherited, but not derived method
> =================================================
> If a class inherits a method but does not override/derive it, then it
> does not have a gtags symbol for that method:
> 
> [Execution image]
> 
>      $ global -x B::method2
>         $ _
> 
> 
> Searching for symbol references
> ===============================
> 
> [Execution image] - should give
> ...
>     $ global -xr B::method2
>     B::method2    other.cc     20     b_p->method2();
>     B::method2    other.cc     25     local_b.method2();
>     $_
> 
> It would still be possible to search for references to just method2,
> and this would return matches on all classes as it does today.
> 
> [Execution image] - should give
> ...
>     $ global -xr method2
>     B::method2    other.cc     20     b_p->method2();
>     B::method2    other.cc     25     local_b.method2();
>         OtherClass::method2  foo.cc      15     bar_p->method2();
>     $_
> 
> 
> Cheers,
> 
>  Iain
> 
> -- 
> Iain Woolf              W-CDMA Base Software, Alcatel-Lucent
> Tel: 613-784-3465 / OnNET 2-825-3465
> IM: iwoolf (im.ca.alcatel-lucent.com) / i_woolf (YahooIM)
--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3



reply via email to

[Prev in Thread] Current Thread [Next in Thread]