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

libclang on Windows sometimes outputs paths with / as path separators instead of \ #37

Open
Yardanico opened this issue May 9, 2022 · 0 comments
Labels
bug Something isn't working Windows

Comments

@Yardanico
Copy link
Contributor

Yardanico commented May 9, 2022

It's not really an issue in Futhark, but it affects Futhark and I figured it'd be worth reporting it to maybe add a workaround or at least let others know.

Let's add a debug echo to the getLocation procedure:

proc getLocation(c: CXCursor): tuple[filename: string, line, column: cuint] =
  var filename: CXString
  c.getCursorLocation.getPresumedLocation(filename.addr, result.line.addr, result.column.addr)
  result.filename = $filename
  echo result.filename

For some reason on Windows result.filename might have / for a part (!) of the path:
image
image

A possible workaround is to add:

  # Workaround issue #37
  when defined(windows):
    result.filename = result.filename.replace('/', '\\')

to the end of getLocation and replace fname with:

      when not defined(windows):
        let fname = $file.getFileName
      else:
        let fname = ($file.getFileName).replace('/', '\\')

in genMacroDecl. It should be generally safe because / is not a valid character for a filename in Windows anyway

@Yardanico Yardanico changed the title libclang on Windows sometimes outputs paths that have / in them as path separators instead of \ libclang on Windows sometimes outputs paths with / as path separators instead of \ May 9, 2022
@PMunch PMunch added bug Something isn't working Windows labels May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows
Projects
None yet
Development

No branches or pull requests

2 participants