Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does cppinsights support multiple file parsing #428

Open
sshsu opened this issue Jan 2, 2022 · 2 comments
Open

does cppinsights support multiple file parsing #428

sshsu opened this issue Jan 2, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@sshsu
Copy link

sshsu commented Jan 2, 2022

I try to make a test using two files as below

// b.h

#ifndef B_H_
#define B_H_

template<typename T>
T Add(T t1, T t2){
  T result = t1 + t2;  
}

#endif 
//main.cpp

#include<iostream>
#include "b.h"

int main(){

    int t1 =1;
    int t2 =2;
    int result = Add<int>(t1, t2);
    std::cout<<result;
    return 0;
}

then I use c++insights in vscode, it doesn't show the template deduction. Does c++insight support it?

image

@andreasfertig
Copy link
Owner

Hello @sshsu,

thanks for bringing this up! C++ Insights blocks transformations from include files for two reasons:

  1. Usually the expansion of STL headers is more confusing then helpful.
  2. For own include files, as well as for STL includes, I need a location where to insert the transformation.

I can look into this and see what I can do. One idea is to insert the transformations from include files directly below the #include.

Please let me know what you think.

Andreas

@andreasfertig andreasfertig added the enhancement New feature or request label Jan 4, 2022
jacquev6 added a commit to jacquev6/Sudoku that referenced this issue Nov 24, 2023
@jacquev6
Copy link

jacquev6 commented Nov 24, 2023

FYI, what I'm doing in @jacquev6/Sudoku (see commit referenced just above this comment) :

In that project, I git add the outputs of C++ Insights, so that git diff gives me insights on what I've changed. With that setup, I wanted to validate that a refactoring in a template did what I expected. That template is defined in a header file in my project, so I faced this issue : the template instanciation was not in the insight.

So I decided to write a very crude C preprocessor that only includes local files, and to pass its output to insights. Worked like a charm, and I was able to validate my refactoring in the next commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants