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

Subdoc doc generation doesn't work on windows #455

Open
PeterChou1 opened this issue Mar 8, 2024 · 2 comments
Open

Subdoc doc generation doesn't work on windows #455

PeterChou1 opened this issue Mar 8, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@PeterChou1
Copy link

The issues lies in subdoc_main.cc here

you need to also canonicalize the input_path to use / instead of \ too it should look something like this:

for (const std::string& input_path : paths) {
    bool found = false;

    std::string input_path_replace = input_path;
    std::replace(input_path_replace.begin(), input_path_replace.end(), '\\', '/');

    for (const std::string& s : comp_db_files) {
      // Canonicalize the path to use `/` instead of `\`.
      auto canonical_path = std::string(s);
      std::replace(canonical_path.begin(), canonical_path.end(), '\\', '/');

      if (canonical_path.find(input_path_replace) == std::string::npos) {
        continue;
      }
      run_against_files.push(sus::move(canonical_path));
      found = true;
    }
    if (!found) {
      fmt::println(stderr, "Unknown file, not in compiledb: {}", input_path);
      return 1;
    }
  }
@danakj
Copy link
Collaborator

danakj commented Mar 8, 2024

Oh, I primarily use subdoc on Windows. Here is how I run it: https://github.com/chromium/subspace/blob/main/tools/run_subdoc.bat

I wonder what is different in my setup that it works.

@danakj danakj added the documentation Improvements or additions to documentation label Mar 8, 2024
@PeterChou1
Copy link
Author

PeterChou1 commented Mar 8, 2024

Oh, I primarily use subdoc on Windows. Here is how I run it: https://github.com/chromium/subspace/blob/main/tools/run_subdoc.bat

I wonder what is different in my setup that it works.

I was trying to generate documentation for llvm on windows as part of my research for gsoc.

Here's the command i used:

D:\Compilers\subspace\release\subdoc\Release\subdoc.exe -p D:\Compilers\clion-llvm\llvm-project\build --out .\build-docs --include-file-pattern D:\Compilers\clion-llvm\llvm-project\llvm\ --project-name llvm D:\Compilers\clion-llvm\llvm-project\llvm

its probably because I supplied windows style paths to subdoc that it failed. Maybe not necessarily a bug but i guess worth noting in the subdoc documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants