Author |
Topic |
|
Z01
Junior Member
13 Posts |
Posted - Jun 24 2019 : 07:28:46 AM
|
Hi, I unfortunately can not paste the code, since it filled with real class names and logic, but this is approximate setup: I have manually created 2 constructors in the header(one with () and one with one argument). When I click VA->create implementation it generates it inside a function in a cpp. More precisely it generates it inside a vector of std::function initalizer list.
Anonimized it looks something like this:
std::vector<std::function<Haha()>> lol{ [&]() { return MakeHaha("0"); }, [&]() { return MakeHaha("1"); }, [&]() { return MakeHaha("2"); }, // many other lambdas in ilist after create implementation code is something like:
std::vector<std::function<Haha()>> lol{
MyClass::MyClass(){
}
[&](){return MakeHaha("0"); // ...
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Jun 24 2019 : 10:43:17 AM
|
So far I cannot reproduce this problem here. I am using the following test code, which is compiling quite happily here in VS2019. In the header file I have:
class simpleTestClass
{
private:
int m_nSimpleHeight;
int m_nSimpleWidth;
public:
simpleTestClass();
simpleTestClass(int nSimpleHeight, int nSimpleWidth);
int vectorInitTest();
};
and in the matching cpp file I have:
#include <functional>
#include <vector>
int simpleTestClass::vectorInitTest()
{
std::vector<std::function<std::string()> > vectrorOddInit {
[&]() { return std::string("hello"); },
[&]() { return std::string("world"); },
[&]() { return std::string("vector"); },
[&]() { return std::string("with"); },
[&]() { return std::string("strings"); },
[&]() { return std::string("here"); }
};
return vectrorOddInit.size();
}
when I trigger Create Implementation on either constructor in the header file, the code is placed correctly, at file level.
Does my example look close enough to your code? Can you please try my sample, just to see if you get a different result on your system?
It is possible this is a solution or file specific problem, or it could simply be that my sample is not complex enough to trigger the problem.
In the cpp file where you are seeing the problem, can you please show VA View:
VAssistX -> Tools -> VA View
and see if the outline shown looks correct? I am wondering if VA is confused about the structure of the file. If so, this may well show up in VA View as well. If there is something wrong with the outline shown in VA View this may help us to track down where the problem is coming from. |
zen is the art of being at one with the two'ness |
|
|
Z01
Junior Member
13 Posts |
Posted - Jun 24 2019 : 12:20:51 PM
|
Hi, the problematic cpp file is unselectable in VA View(double click on it just selects it's header file and name of the filed does not show up as selected). I guess this is a bug since other cpp files work. If you have a way for me to give you more data without giving away source(maybe some dbg log) I would be happy to do that.
Your small example works fine, but I can not guess why... Maybe because my class actually inherits from a template( : public SomeTemplateBase<SomeOtherClass> ) :) but your example works even when it inherits from the same template base class... I also tried to take as an argument of a constructor a tricky type I use in real class (type is tricky because if you do not use leading :: in ::ns1::ns2::MyType it is ambiguous). Still works fine.
long story short: If I can collect you more data without sharing the source please tell me how, if not, I will just learn to live with this.
Also thank you for a quick reply. |
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Jun 24 2019 : 3:04:43 PM
|
Sorry, I should have said VA Outline, not VA View:
VAssistX -> Tools -> VA Outline
however the fact that VA View is not working as expected is an interesting clue.
VA Outline should show you the functions in the cpp file correctly. Can you also look at the Alt-M list, the list of methods in the current file, and see if there are any obvious problems there?
If VA does not correctly identify the functions immediately above and below the function containing the std::vector block then this is probably why Create Implementation is going wrong. VA will think it is placing the new implementation at file scope, not within a function. If we can find the general part of the file that is confusing VA's parser then it should be relatively easy to look for more clues to narrow down the specific problem. |
zen is the art of being at one with the two'ness |
|
|
Z01
Junior Member
13 Posts |
Posted - Jun 25 2019 : 10:49:01 AM
|
Everything looked ok, until I tried double click in VA Outline, function selection is messed up. https://imgur.com/a/qXKpOnq
|
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Jun 26 2019 : 08:36:05 AM
|
That is odd, but also matches the problem VA is having with placing the new constructor implementation.
What happens if you double click to select the function immediately above or below this function, via VA Outline? Are these selected correctly, or do you see a selection problem there as well? I am wondering if the problem is specific to this function, or if it is also effecting code above or below this function.
Since VA has not selected the start of the function I suspect that something in the function above is triggering the problem, but it is showing up further down the file. If so, using Alt-Up Arrow and Alt-Down Arrow to trigger VA's Next and Previous scope commands should also help you to narrow down where VA's confusion is starting.
If you can track this down to just one or two functions I am happy to have a look at the code, you can email it to us directly, no need to post it here. We will treat it as confidential, and only use it to pin down the cause of this bug. But I realise this is often not an option, but it's worth mentioning just in case it helps you. |
zen is the art of being at one with the two'ness |
|
|
Z01
Junior Member
13 Posts |
Posted - Jun 26 2019 : 11:21:38 AM
|
Hi, unfortunately I can not give you a small repo because code is quite complicated(templates that use a lot of our internal classes as template arguments), so even ignoring confidentiality it would just take too much time.
But here is something I noticed: all functions are broken in the same way, meaning that when I select a function it thinks that the function is from begining of the function(this is correct) till the std::vector<std::function<Bla()>> blas{ (selection ends at { after blas). Unfortunately all the functions follow the same pattern(they are basically manual reflection so they are very similar) so this is not much of a signal. Non class function before in the file work fine, and dtor(later in the file) works fine.
What I noticed is that when I comment out the initializer list of vector of std::functions (vector is still used but empty) selection works. So I think that your heuristic parser gets confused.
So that is unfortunately all the info I can get you regarding this issue.
But I have one more general question: Is there some issue/feature request number for ability to use use clang/msvc for parsing(either exclusively or in hybrid mode). I ask because before Intellisense was so horrible and slow that VA was much better, but this days IS is actually relatively quick and sometimes more precise.
|
|
|
|
Topic |
|
|
|