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

Reconsider using the incorrectly cased input file name for TranslatedFile #67

Open
PathogenDavid opened this issue Oct 3, 2020 · 0 comments
Labels
Area-Translation Issues concerning the translation from libclang into Biohazrd EdgeCase

Comments

@PathogenDavid
Copy link
Member

Currently if the user provides the incorrect casing for a file name, we prefer using their casing:

https://github.com/InfectedLibraries/Biohazrd/blob/23589dbdba1590a863097eba071bb0f5c7919df0/Biohazrd/TranslationUnitParser.cs#L131-L136

Upon a second look, I'm not sure this is a great idea. Instead we should prefer the real casing provided by Clang and warn if the provided casing was different.

However, this isn't ideal if Clang can't provide the real casing. (When does TryGetRealPathName fail?) Because then we're using the (possibly incorrect) casing from an #include directive.

https://github.com/InfectedLibraries/Biohazrd/blob/23589dbdba1590a863097eba071bb0f5c7919df0/Biohazrd/TranslationUnitParser.cs#L113-L114

(I think this code was written this was for that reason before I found TryGetRealPathName.)

Perhaps the ideal solution is:

  • Use the Clang real path casing
  • If that casing differs from what we were given, emit a warning since the generator isn't portable
  • Emit a warning if Clang doesn't provide the real casing (Assuming that situation is uncommon/rare -- need to investigate.)
@PathogenDavid PathogenDavid added Area-Translation Issues concerning the translation from libclang into Biohazrd EdgeCase labels Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Translation Issues concerning the translation from libclang into Biohazrd EdgeCase
Projects
None yet
Development

No branches or pull requests

1 participant