Author |
Topic  |
|
slymz
Junior Member
 
USA
18 Posts |
Posted - May 24 2019 : 09:26:53 AM
|
It would be a super useful feat if VAssist showed preprocessed C++ source code for a given region.
While studying code, libraries, etc. it is super interesting and revealing to look at macro expanded version of the code. Helps understand how macros are implemented, what choices/values are active/made for #defines, etc.
Current workaround is too cumbersome:
1. locate the source file in the solution explorer; or if a header, create a new cpp or scavenge hunt for existing cpp that uses it 2. go to compiler settings and preprocess to a file 3. locate the preprocessed file (.i extension) under obj dir 4. open up the 1 quadrillion line file and attempt to locate the region of interest 5. copy that region back to an empty source buffer - indent
|
|
feline
Whole Tomato Software
    
United Kingdom
19137 Posts |
Posted - May 24 2019 : 10:59:55 AM
|
Unfortunately VA does not actually run a pre-processor its self. Running the preprocessor can heavily edit the code, which then makes it hard to map back to what you were originally editing.
The idea of finding and running a preprocessor separately, to work out what happens, is one we have considered, but currently it is just an idea we are considering. I have noted that you are interested in this, but I am not sure if this will ever happen as part of VA:
case=104193 |
zen is the art of being at one with the two'ness |
 |
|
pwc
Tomato Guru
    
138 Posts |
Posted - May 29 2019 : 1:51:49 PM
|
I'd really like this feature too. More precisely, to be able to "expand" a macro to a user-specified level (in the case of nested macros). The macro should be expanded in-place since we can always just hit 'undo' or 'revert' if under source control. Perhaps add the original macro line as a comment directly above the expanded code. I think I may have already requested this a while ago, so sorry if this is a duplicate request. Note that ReSharper has something along the lines of this feature request (not that I can use R++ since it can't handle the size of our solution (slow, crashes) whereas VAX handles it with ease - nice work). |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19137 Posts |
Posted - May 29 2019 : 3:04:05 PM
|
Expanding a specific macro call, so you can see what is going on, is something we are considering:
case=57776
The fact that this has come up before is no matter. Instead it is actually helpful, since seeing how popular a given feature request is is one way we try to prioritize what we are doing next. It's not everything, but it is useful information. |
zen is the art of being at one with the two'ness |
 |
|
pwc
Tomato Guru
    
138 Posts |
|
feline
Whole Tomato Software
    
United Kingdom
19137 Posts |
Posted - May 31 2019 : 07:54:50 AM
|
Interesting, I am not sure if I misunderstood or not, but your original request was taken to mean expanding all calls to a given macro inside the code, so changing the code its self to remove / replace the macro call. Which is something we are still considering doing.
The idea behind case=57776 is to show how a single macro call would be expanded, inside a dialog, so showing what is going on, without actually updating the code you are currently sitting in. A similar result, but a different way of going about it. |
zen is the art of being at one with the two'ness |
 |
|
Zeblote
Tomato Guru
    
183 Posts |
Posted - Jun 11 2019 : 12:37:43 PM
|
Something that would be very cool for such a feature but I haven't seen anyone do before: Give an option to limit the recursion depth, so we can see what the first macro expands to only, then what the ones used by it expand to, etc., until the final code is visible |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19137 Posts |
Posted - Jun 12 2019 : 10:56:51 AM
|
That's fair. I would expect a dialog to expand one level at a time personally, since that is often how I work through macros to understand them myself. I have noted this on the case for you. |
zen is the art of being at one with the two'ness |
 |
|
|
Topic  |
|