Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 VA confused by iterating over map with shared_ptrs
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

muxecoid
New Member

Israel
4 Posts

Posted - Jun 14 2020 :  10:42:50 AM  Show Profile  Reply with Quote
Given map with shared pointers:
typedef std::shared_ptr<Item> item_t;
typedef std::map<item_id_t, item_t> items_map_t;

And this code that iterates over it:

	for(items_map_t::const_iterator currItem = items_.cbegin(); currItem != items_.cend(); ++currItem)
	{
		currItem->second->doWork(args);
	}

VA can not determine that doWork refers to Item::doWork. "Goto Implementation" lists all symbols named doWork in current project. What is worse "Find References" on Item::doWork does not find the code above as reference. I use VA as main tool to learn a large codebase I inherited making this issue very annoying, can not trust VA for navigation.

Intellisense correctly identifies the symbol (but finding references is 10 times slower than VA).

VA_X.dll file version 10.9.2375.0 built 2020.05.09
DevEnv.exe version 14.0.25420.1 Professional

Edited by - muxecoid on Jun 14 2020 10:47:44 AM

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 14 2020 :  6:21:20 PM  Show Profile  Reply with Quote
I have completed your snippets to a code that complies. Find References on doWork works with that code. Did I complete your code correctly?

class testclass
{
public:
	void doWork() {}
};

typedef std::shared_ptr<testclass> item_t;
typedef std::map<int, item_t> items_map_t;

void func()
{
	items_map_t items_;
	for (items_map_t::const_iterator currItem = items_.cbegin(); currItem != items_.cend(); ++currItem)
	{
		currItem->second->doWork();
	}
}


Does find references work with my sample code?

Edited by - accord on Jun 14 2020 6:23:10 PM
Go to Top of Page

muxecoid
New Member

Israel
4 Posts

Posted - Jun 15 2020 :  08:10:33 AM  Show Profile  Reply with Quote
I copied a snippet from production code and removed all proprietary information which could change something. I will play with separate test project to find minimal case where this reproduces.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Jun 15 2020 :  08:14:57 AM  Show Profile  Reply with Quote
A random thought on this, in the file where you see this problem, does Alt-M (list of methods in the current file) and VA Outline report the correct information for the file?

If there is something in the file that is confusing our parser it will sometimes show up here as well, and also explain why Find References is getting confused. Checking at the file level can be an easier method of locating where the problem starts.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000