This is an archive of the discontinued LLVM Phabricator instance.

[clang][Tooling] Make the filename behaviour consistent
ClosedPublic

Authored by kadircet on Nov 14 2022, 10:01 AM.

Details

Summary

Dotdots were removed only when converting a relative path to absolute
one. This patch makes the behaviour consistent for absolute file paths by
removing them in that case as well. Also updates the documentation to mention
the behaviour.

Fixes https://github.com/clangd/clangd/issues/1317

Diff Detail

Event Timeline

kadircet created this revision.Nov 14 2022, 10:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 14 2022, 10:01 AM
kadircet requested review of this revision.Nov 14 2022, 10:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 14 2022, 10:01 AM
nridge added a subscriber: nridge.Nov 14 2022, 12:38 PM
sammccall accepted this revision.Nov 14 2022, 3:47 PM

Code change LGTM, i think the doc change should be dropped or reshaped though.

clang/docs/JSONCompilationDatabase.rst
89 ↗(On Diff #475189)

This doesn't fit with the rest of the spec text: the new text describing tool behavior, while everything else describes the data.

I'm not totally sure about documenting this (it's of pretty limited interest, doesn't cover symlink handling exhaustively, and seems more a limitation of the tools than a feature of the format). If you do want to I'd suggest separating it from the format description into a separate paragraph below (e.g. "Because compilation databases can be large, tools match filenames are matched against entries textually without IO. This means they generally don't understand symlinks.")

This revision is now accepted and ready to land.Nov 14 2022, 3:47 PM
kadircet updated this revision to Diff 475362.Nov 15 2022, 12:52 AM
  • Drop documentation
  • Call remove_dots on the common path
This revision was landed with ongoing or failed builds.Nov 15 2022, 1:52 AM
This revision was automatically updated to reflect the committed changes.
thakis added a subscriber: thakis.Nov 15 2022, 4:02 AM

This breaks tests on windows: http://45.33.8.238/win/69993/step_7.txt

Please take a look and revert for now if it takes a while to fix.