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
 Problem with Find References
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ShadowIce
New Member

4 Posts

Posted - Dec 01 2014 :  09:06:28 AM  Show Profile  Reply with Quote
In the past few weeks I've noticed a problem with the find references function. It was getting really unreliable and most of the times I had to do a simple text search to get all the references. So I took some time to investigate why that happened and came up with this little example:


#define USE_STD_SMART_POINTERS

namespace mystd
{
#ifdef USE_STD_SMART_POINTERS
	using ::std::shared_ptr;
#else
	using ::boost::shared_ptr;
#endif
}

namespace foo
{
	class TestClass
	{
	public:
		TestClass() {}

		void Test() {}
	};

	class TestClassUser
	{
	public:
		TestClassUser()
		{
			m_t.reset(new TestClass());
			m_t->Test();		// not found

			mystd::shared_ptr<TestClass> t2 = m_t;
			t2->Test();		// also not found

			mystd::shared_ptr<TestClass> t(new TestClass());
			t->Test();		// found
		}

	private:
		mystd::shared_ptr<TestClass> m_t;
	};
}


Problem seems to be that there may be two possible implementations of shared_ptr. If I comment out one of them all references are found. I've tried using the va_stdafx.h file with a define for USE_STD_SMART_POINTERS but that didn't make any difference. Any idea how to fix this?

Tested in Visual Studio Professional 2013 (Update 4) with VAX 10.9.2052.

sean
Whole Tomato Software

USA
2641 Posts

Posted - Dec 01 2014 :  3:26:26 PM  Show Profile  Reply with Quote
Thanks for the test code. It demonstrates the problem clearly. I'm afraid we don't have a workaround but will investigate a proper fix. case=86670
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
15984 Posts

Posted - Dec 01 2014 :  3:52:36 PM  Show Profile  Reply with Quote
Are you able to edit the code, to change how the macro is used? Using your test code, I have changed it to read:

#define USE_STD_SMART_POINTERS
#define FELINE_STD_SMART_POINTERS using ::std::shared_ptr;
#define FELINE_BOOST_SMART_POINTERS using ::boost::shared_ptr;

namespace mystd
{
#ifdef USE_STD_SMART_POINTERS
	FELINE_STD_SMART_POINTERS
#else
	FELINE_BOOST_SMART_POINTERS
#endif
}


and added the following lines to the va_stdafx.h file, making sure the file ends with a blank line:

#define FELINE_STD_SMART_POINTERS using ::std::shared_ptr;
#define FELINE_BOOST_SMART_POINTERS


after rebuilding the VA symbol database, running Find References on the declaration of "Test" in "TestClass" is finding all 4 references, as expected. The obvious problem here is needing to update va_stdafx.h file when you change smart pointer classes.

zen is the art of being at one with the two'ness
Go to Top of Page

sean
Whole Tomato Software

USA
2641 Posts

Posted - Dec 01 2014 :  3:55:34 PM  Show Profile  Reply with Quote
Oops - that's a better workaround than none at all.

Edited by - sean on Dec 01 2014 3:55:51 PM
Go to Top of Page

ShadowIce
New Member

4 Posts

Posted - Dec 02 2014 :  03:21:09 AM  Show Profile  Reply with Quote
Yes, thank you. That worked perfectly.
Go to Top of Page

sean
Whole Tomato Software

USA
2641 Posts

Posted - Feb 13 2015 :  8:00:02 PM  Show Profile  Reply with Quote
case=86670 is fixed in build 2059
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000