Re: [cedet-semantic] C++ member function declaration vs definitions and more
Brought to you by:
zappo
From: Eric M. L. <er...@si...> - 2008-09-15 11:32:33
|
>>> Gerdin Tobias <Tob...@sa...> seems to think that: >Hello again, > >I have been using semantic-ia-fast-jump some more and while it often >works well, I do have some questions: > >1) Jumping to a tag corresponding to a C++ member function always >seem to take me to the function _declaration_ in the class >definition. Is there any way to get to the member function >_definition_? I am confused regarding weather a Semantic tag is a >one-to-one or a one-to-many mapping between tag name and source >location, but in the latter case I believe there should be a way to >continue to the next location of the tag in question. Hi, First, I'll mention that tools like semantic-ia-fast-jump, semantic-complete-jump, and a few others are actually short demo functions I whipped up to show how to use the various Semantic libraries. They are meant to be useful, of course, but also they are meant to show how to write a good piece of code using the utilities. semantic-ia-fast-jump, for example, gets an analyzer context, pulls out the prefix, and then just visits whatever it found. The analyzer is concerned with getting the semantic context of the local area, and doesn't care where the definition is, as long as a declaration is available. In addition, the analyzer wants to be as fast as possible, so it doesn't parse every file, only the files directly included in the current buffer. There is a way to get the definition of a class, and that is via the "brutish" search. Getting that to work requires parsing every file in your project. There are likely clever ways to get it to associate a header file with some group of C files, but that would not be reliable. Each semantic tag maps to a single file location. There can be many tags pointing to the same tag name/concept but the text for those tags would be in different places. The right solution here would be for someone to take on the project of jumping to a tag, and make an appropriately advanced implementation, as there are many nuances to what a user intends when a jump is done, and as you noticed, often more than one possible destination. I know when I use etags, I often get many useless hits if the function in question is short, or a data type. You won't ever get that w/ the Semantic jump, but it is also very narrowly targeted. >2) Semantic sometimes seems to confuse class definition with their >forward declarations. When looking up a tag corresponding to a class >name, I want to see the former. This is the same issue I mentioned above. When multiple references to the same name/concept exist, Semantic will pick the most concrete one, but that is sometimes not available via your include list. In addition, of you depend on the idle timer functions, those will skip parsing everything for speed purposes. >I think that it would also be nice if semantic-ia-fast-jump would >flash the line jumped to, like when I select a tag from the speedbar. [ ... ] This one is easy. I've made the change, and will check it in sometime soon. Thanks Eric -- Eric Ludlam: er...@si... Siege: www.siege-engine.com Emacs: http://cedet.sourceforge.net |