aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/Path.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-08-14[Support] Add mapped_file_region::sync(), equivalent to msync (#153632)Steven Wu1-0/+37
2025-05-26[LLVM] [NFC] - Remove duplicate #include headers from the files of llvm dir ↵Akash Agrawal1-1/+0
(#141057) A few files of llvm dir had duplicate headers included. This patch removes those redundancies. --------- Co-authored-by: Akash Agrawal <akashag@qti.qualcomm.com>
2025-05-04[llvm] Remove unused local variables (NFC) (#138454)Kazu Hirata1-3/+0
2025-04-26[llvm] Use llvm::replace (NFC) (#137481)Kazu Hirata1-4/+2
2025-01-02[llvm][Support][Windows] Fix slash in path for remove_directories (#121448)Jinsong Ji1-0/+3
Before 925471ed903dad871042d7ed0bab89ab6566a564 remove_directories supports path with slash (instead of backslash). The ILCreateFromPathW in new implementation requires backslash path, so the call to remove_directories will fail if the path contains slash. This is to normalize the path to make sure remove_directories still support path with slash as well.
2024-08-30[NFC] Add explicit #include llvm-config.h where its macros are used. (#106621)Daniil Fukalov1-0/+1
Without these explicit includes, removing other headers, who implicitly include llvm-config.h, may have non-trivial side effects.
2024-06-13[llvm-project] Fix typo "seperate" (#95373)Jay Foad1-2/+2
2024-04-17[Support] Report EISDIR when opening a directory (#79880)azhan921-0/+22
The test `llvm/unittests/Support/CommandLineTest.cpp` that handles errors in expansion of response files was previously disabled for AIX. Originally the code was dependent on `read` returning `EISDIR` which occurs on platforms such as Linux. However, other platforms such as AIX allow use of `read` on file descriptors for directories. This change updates `readNativeFile` to produce `EISDIR` on AIX and z/OS when used on a directory (instead of relying on the call to `read` to do so). --------- Co-authored-by: Alison Zhang <alisonzhang@ibm.com> Co-authored-by: James Henderson <46713263+jh7370@users.noreply.github.com>
2024-01-18[Path] Fix off-by-one in finding filename for win style paths (#78055)Matheus Izvekov1-0/+1
This fixes a crash where `path::parent_path` causes an invalid access on a string upon receiving a path that consists of a single colon. On Windows machine, with runtime checks enabled build, upon `clang -I: test.cc` produces: ``` Assertion failed: Index < Length && "Invalid index!", file llvm\include\llvm/ADT/StringRef.h, line 232 ... #6 0x00007ff7816201eb `anonymous namespace'::parent_path_end llvm\lib\Support\Path.cpp:144:0 #7 0x00007ff781620135 llvm::sys::path::parent_path(class llvm::StringRef, enum llvm::sys::path::Style) llvm\lib\Support\Path.cpp:470:0 ``` Ideally, we can look for the last colon starting from the last character, but we can instead start from second to last, and handle empty paths by abusing `0 - 1 == npos`.
2023-12-09[ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with (#74916)Kazu Hirata1-6/+6
This patch renames {starts,ends}with to {starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. Since there are only a handful of occurrences, this patch skips the deprecation phase and simply renames them.
2023-09-12[Windows] Avoid using FileIndex for unique IDsMartin Storsjö1-0/+8
The FileIndex values returned from GetFileInformationByHandle are considered stable and uniquely identifying a file, as long as the handle is open. When handles are closed, there are no guarantees for their stability or uniqueness. On some file systems (such as NTFS), the indices are documented to be stable even across handles. But with some file systems, in particular network mounts, file indices can be reused very soon after handles are closed. When such file indices are used for LLVM's UniqueID, files are considered duplicates as soon as the filesystem driver happens to have used the same file index for the handle used to inspect the file. This caused widespread, non-obvious (seemingly random) breakage. This can happen e.g. if running on a directory that is shared via Remote Desktop or VirtualBox. To avoid the issue, use a hash of the canonicalized path for the file as unique identifier, instead of using FileIndex. This fixes https://github.com/llvm/llvm-project/issues/61401 and https://github.com/llvm/llvm-project/issues/22079. Performance wise, this adds (usually) one extra call to GetFinalPathNameByHandleW for each call to getStatus(). A test cases such as running clang-scan-deps becomes around 1% slower by this, which is considered tolerable. Change the equivalent() function to use getUniqueID instead of checking individual file_status fields. The equivalent(Twine,Twine,bool& result) function calls status() on each path successively, without keeping the file handles open, which also is prone to such false positives. This also gets rid of checks of other superfluous fields in the equivalent(file_status, file_status) function - the unique ID of a file should be enough (that is what is done for Unix anyway). This comes with one known caveat: For hardlinks, each name for the file now gets a different UniqueID, and equivalent() considers them different. While that's not ideal, occasional false negatives for equivalent() is usually that fatal (the cases where we strictly do need to deduplicate files with different path names are quite rare) compared to the issues caused by false positives for equivalent() (where we'd deduplicate and omit totally distinct files). The FileIndex is documented to be stable on NTFS though, so ideally we could maybe have used it in the majority of cases. That would require a heuristic for whether we can rely on FileIndex or not. We considered using the existing function is_local_internal for that; however that caused an unacceptable performance regression (clang-scan-deps became 38% slower in one test, even more than that in another test). Differential Revision: https://reviews.llvm.org/D155579
2023-02-10[NFC][TargetParser] Replace uses of llvm/Support/Host.hArchibald Elliott1-1/+1
The forwarding header is left in place because of its use in `polly/lib/External/isl/interface/extract_interface.cc`, but I have added a GCC warning about the fact it is deprecated, because it is used in `isl` from where it is included by Polly.
2023-02-07[NFC][TargetParser] Remove llvm/ADT/Triple.hArchibald Elliott1-1/+1
I also ran `git clang-format` to get the headers in the right order for the new location, which has changed the order of other headers in two files.
2023-01-25[unittests] Use GTEST_SKIP() instead of return when appropriatePaul Robinson1-1/+2
Basically NFC: A TEST/TEST_F/etc that bails out early (usually because setup failed or some other runtime condition wasn't met) generally should use GTEST_SKIP() to report its status correctly, unless it takes steps to report another status (e.g., FAIL()). I did see a handful of tests show up as SKIPPED after this change, which is not unexpected. The status seemed appropriate in all the new cases.
2023-01-16[llvm][ADT] Replace uses of `makeMutableArrayRef` with deduction guidesJoe Loser1-2/+2
Similar to how `makeArrayRef` is deprecated in favor of deduction guides, do the same for `makeMutableArrayRef`. Once all of the places in-tree are using the deduction guides for `MutableArrayRef`, we can mark `makeMutableArrayRef` as deprecated. Differential Revision: https://reviews.llvm.org/D141814
2022-12-16[Support] llvm::Optional => std::optionalFangrui Song1-5/+5
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-02[llvm/unittests] Use std::nullopt instead of None (NFC)Kazu Hirata1-2/+2
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-09-08Revert "Support: Add mapped_file_region::sync(), equivalent to msync"raghavmedicherla1-27/+0
This reverts commit 142f51fc2f448845f6a32e767ffaa2b665eea11f. This shouldn't be committed, it got committed accidentally.
2022-09-06Support: Add mapped_file_region::sync(), equivalent to msyncraghavmedicherla1-0/+27
Add mapped_file_region::sync(), equivalent to POSIX msync, synchronizing written content to disk without unmapping the region. Asserts if the mode is not mapped_file_region::readwrite. Note that I don't have access to a Windows machine, so I can't easily run those unit tests. Change by dexonsmith Differential Revision: https://reviews.llvm.org/D95494
2022-08-13[llvm] Update FileSystem test that failed spuriouslyBen Langmuir1-8/+7
This test failed spuriously in an environment that appears to ignore the 'x' bit permission on directories. Allow for that possibility.
2022-08-12[llvm] Fix assertion when stat fails in remove_directoriesBen Langmuir1-0/+22
We were dereferencing an empty Optional if IgnoreErrors was true and the stat failed. rdar://60887887 Differential Revision: https://reviews.llvm.org/D131791
2022-06-02Fix a buglet in remove_dots().Paul Pluzhnikov1-8/+7
The function promises to canonicalize the path, but neglected to do so for the root component. For example, calling remove_dots("/tmp/foo.c", Style::windows_backslash) resulted in "/tmp\foo.c". Now it produces "\tmp\foo.c". Also fix FIXME in the corresponding test. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D126412
2022-04-08[RGT] Use GTEST_SKIP() in more places where we skip a testPaul Robinson1-16/+16
Simply returning will report the test as PASSED when it didn't really do anything. SKIPPED is the correct result for these. Found by the Rotten Green Tests project.
2022-04-08[Support][unittests] Silence warning when building with Clang 13 onAlexandre Ganea1-1/+1
Windows.
2022-01-21Remove dependency from raw_ostream on <chrono>serge-sans-paille1-0/+1
The tryLockFor method from raw_fd_sotreamis the sole user of that header, and it's not referenced in the mono repo. I still chose to keep it (may be useful for downstream user) but added a transient type that's forward declared to hold the duration parameter. Notable changes: - "llvm/Support/Duration.h" must be included in order to use tryLockFor. - "llvm/Support/raw_ostream.h" no longer includes <chrono> This sole change has an interesting impact on the number of processed line, as measured by: clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Support/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l before: 7917500 after: 7835142 Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup/5831
2022-01-21[NFCI][Support] Avoid ASSERT_/EXPECT_TRUE(A <op> B)Archibald Elliott1-1/+1
The error messages in tests are far better when a test fails if the test is written using ASSERT_/EXPECT_<operator>(A, B) rather than ASSERT_/EXPECT_TRUE(A <operator> B). This commit updates all of llvm/unittests/Support to use these macros where possible. This change has not been possible in: - llvm/unittests/Support/FSUniqueIDTest.cpp - due to not overloading operators beyond ==, != and <. - llvm/unittests/Support/BranchProbabilityTest.cpp - where the unchanged tests are of the operator overloads themselves. There are other possibilities of this conversion not being valid, which have not applied in these tests, as they do not use NULL (they use nullptr), and they do not use const char* (they use std::string or StringRef). Reviewed By: mubashar_ Differential Revision: https://reviews.llvm.org/D117319
2022-01-11Support: Extract sys::fs::readNativeFileToEOF() from MemoryBufferDuncan P. N. Exon Smith1-0/+47
Extract the `readNativeFile()` loop from `MemoryBuffer::getMemoryBufferForStream()` into `readNativeFileToEOF()` to allow reuse. The chunk size is configurable; the default of `4*4096` is exposed as `sys::fs::DefaultReadChunkSize` to allow sizing of SmallVectors. There's somewhere I'd like to read a usually-small file without overhead of a MemoryBuffer; extracting existing logic rather than duplicating it. Differential Revision: https://reviews.llvm.org/D115397
2021-11-05[Support] [Windows] Convert paths to the preferred formMartin Storsjö1-2/+46
This normalizes most paths (except ones input from the user as command line arguments) into the preferred form, if `real_style()` evaluates to `windows_forward`. Differential Revision: https://reviews.llvm.org/D111880
2021-11-05[Support] Add a new path style for Windows with forward slashesMartin Storsjö1-2/+33
This behaves just like the regular Windows style, with both separator forms accepted, but with get_separator() returning forward slashes. Add a more descriptive name for the existing style, keeping the old name around as an alias initially. Add a new function `make_preferred()` (like the C++17 `std::filesystem::path` function with the same name), which converts windows paths to the preferred separator form (while this one works on any platform and takes a `path::Style` argument). Contrary to `native()` (just like `make_preferred()` in `std::filesystem`), this doesn't do anything at all on Posix, it doesn't try to reinterpret backslashes into forward slashes there. Differential Revision: https://reviews.llvm.org/D111879
2021-10-29Support: Remove sys::path::is_style_native()Duncan P. N. Exon Smith1-5/+0
Remove sys::path::is_style_native(), which was added alongside is_style_windows() and is_style_posix(). Thinking a bit about the windows forward-slash style variant in https://reviews.llvm.org/D111879, it's not clear to me how the new sys::path::is_style_native() should behave for them. - Should it return true for both `windows_slash` and `windows_backslash`? - Should it return true for only one of them? I can think of hypothetical uses and justifications for either one, and I could also imagine clients guessing either behaviour when just looking at the function name in code. Call sites will probably be more clear if they don't use this function, and instead write out the code: ``` // Is "S" the coarse-grained native style? if (is_style_windows(S) == is_style_windows(Style::native)) // Is "S" the fine-grained native style? if (is_style_windows(S) == is_style_windows(Style::native) && preferred_separator(S) == preferred_separator(Style::native)) ``` Can always add this again if someone needs it and can justify one behaviour over the other, but for now might as well avoid growing users.
2021-10-29Support: Reduce stats in fs::copy_file on DarwinDuncan P. N. Exon Smith1-0/+58
fs::copy_file() on Darwin has a nice optimization to clone the file when possible. Change the implementation to use clonefile() directly, instead of the higher-level copyfile(). The latter does the wrong thing for symlinks, which requires calling `stat` first... With that out of the way, optimistically call clonefile() all the time, and then for any error that's recoverable try again with copyfile() (without the COPYFILE_CLONE flag, as before). Differential Revision: https://reviews.llvm.org/D112250
2021-10-29Support: Expose sys::path::is_style_{posix,windows,native}()Duncan P. N. Exon Smith1-5/+29
Expose three helpers in namespace llvm::sys::path to detect the path rules followed by sys::path::Style. - is_style_posix() - is_style_windows() - is_style_native() This are constexpr functions that that will allow a bunch of path-related code to stop checking `_WIN32`. Originally I looked at adding system_style(), analogous to sys::endian::system_endianness(), but future patches (from others) will add more Windows style variants for slash preferences. These helpers should be resilient to that change, allowing callers to detect basic path rules. Differential Revision: https://reviews.llvm.org/D112288
2021-05-12[SystemZ][z/OS] Fix warning caused by umask returning a signed integer typeAbhina Sreeskantharajan1-1/+2
On z/OS, umask() returns an int because mode_t is type int, however it is being compared to an unsigned int. This patch fixes the following warning we see when compiling Path.cpp. ``` comparison of integers of different signs: 'const int' and 'const unsigned int' ``` Reviewed By: muiez Differential Revision: https://reviews.llvm.org/D102326
2021-04-09Support: Add move semantics to mapped_file_regionDuncan P. N. Exon Smith1-1/+18
Update llvm::sys::fs::mapped_file_region to have a move constructor and a move assignment operator, allowing it to be used as an Optional. Also, update FileOutputBuffer's OnDiskBuffer to take advantage of this, avoiding an extra allocation from the unique_ptr. A nice follow-up would be to make the mapped_file_region constructor private and replace its use with a factory function, such as mapped_file_region::create(), that returns an Expected (or ErrorOr). I don't plan on doing that immediately, but I might swing back later. No functionality change, besides the saved allocation in OnDiskBuffer. Differential Revision: https://reviews.llvm.org/D100159
2021-04-08Support: Extract fs::resize_file_before_mapping_readwrite from FileOutputBufferDuncan P. N. Exon Smith1-1/+27
Add a variant of `fs::resize_file` for use immediately before opening a file with `mapped_file_region::readwrite`. On Windows, `_chsize` (`ftruncate`) is slow, but `CreateFileMapping` (`mmap`) automatically extends the file so the call to `fs::resize_file` can be skipped. This optimization was added to `FileOutputBuffer` in da9bc2e56d5a5c6332a9def1a0065eb399182b93; this commit just extracts the logic out and adds a unit test. Differential Revision: https://reviews.llvm.org/D95490
2021-04-06[SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag ↵Abhina Sreeskantharajan1-1/+1
instead of OF_Text Problem: On SystemZ we need to open text files in text mode. On Windows, files opened in text mode adds a CRLF '\r\n' which may not be desirable. Solution: This patch adds two new flags - OF_CRLF which indicates that CRLF translation is used. - OF_TextWithCRLF = OF_Text | OF_CRLF indicates that the file is text and uses CRLF translation. Developers should now use either the OF_Text or OF_TextWithCRLF for text files and OF_None for binary files. If the developer doesn't want carriage returns on Windows, they should use OF_Text, if they do want carriage returns on Windows, they should use OF_TextWithCRLF. So this is the behaviour per platform with my patch: z/OS: OF_None: open in binary mode OF_Text : open in text mode OF_TextWithCRLF: open in text mode Windows: OF_None: open file with no carriage return OF_Text: open file with no carriage return OF_TextWithCRLF: open file with carriage return The Major change is in llvm/lib/Support/Windows/Path.inc to only set text mode if the OF_CRLF is set. ``` if (Flags & OF_CRLF) CrtOpenFlags |= _O_TEXT; ``` These following files are the ones that still use OF_Text which I left unchanged. I modified all these except raw_ostream.cpp in recent patches so I know these were previously in Binary mode on Windows. ./llvm/lib/Support/raw_ostream.cpp ./llvm/lib/TableGen/Main.cpp ./llvm/tools/dsymutil/DwarfLinkerForBinary.cpp ./llvm/unittests/Support/Path.cpp ./clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp ./clang/lib/Frontend/CompilerInstance.cpp ./clang/lib/Driver/Driver.cpp ./clang/lib/Driver/ToolChains/Clang.cpp Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D99426
2021-03-25[Support][Windows] Make sure only executables are found by ↵Markus Böck1-0/+5
sys::findProgramByName The function utilizes Windows' SearchPathW function, which as I found out today, may also return directories. After looking at the Unix implementation of the file I found that it contains a check whether the found path is also executable. While fixing the Windows implementation, I also learned that sys::fs::access returns successfully when querying whether directories are executable, which the Unix version does not. This patch makes both of these functions equivalent to their Unix implementation and insures that any path returned by sys::findProgramByName on Windows may only be executable, just like the Unix implementation. The equivalent additions I have made to the Windows implementation, in the Unix implementation are here: sys::findProgramByName: https://github.com/llvm/llvm-project/blob/39ecfe614350fa5db7b8f13f81212f8e3831a390/llvm/lib/Support/Unix/Program.inc#L90 sys::fs::access: https://github.com/llvm/llvm-project/blob/c2a84771bb63947695ea50b89160c02b36fb634d/llvm/lib/Support/Unix/Path.inc#L608 I encountered this issue when running the LLVM testsuite. Commands of the form not test ... would fail to correctly execute test.exe, which is part of GnuWin32, as it actually tried to execute a folder called test, which happened to be in a directory on my PATH. Differential Revision: https://reviews.llvm.org/D99357
2020-09-24[unittests] Use std::make_tuple to make some toolchains happy againMikael Holmen1-5/+13
My toolchain stopped working (LLVM 8.0, libstdc++ 5.4.0) after 577adda: 06:25:37 ../unittests/Support/Path.cpp:91:7: error: chosen constructor is explicit in copy-initialization 06:25:37 {"", false, false}, {"/", true, true}, {"/foo", true, true}, 06:25:37 ^~~~~~~~~~~~~~~~~~ 06:25:37 /proj/flexasic/app/llvm/8.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.4.0/../../../../include/c++/5.4.0/tuple:479:19: note: explicit constructor declared here 06:25:37 constexpr tuple(_UElements&&... __elements) 06:25:37 ^ This commit adds explicit calls to std::make_tuple to work around the problem.
2020-09-23[Support/Path] Add path::is_absolute_gnuVinicius Tinti1-0/+18
Implements IS_ABSOLUTE_PATH from GNU tools. C++17 is_absolute behavior is different the from the behavior defined by GNU tools. According to cppreference.com, C++17 states: "An absolute path is a path that unambiguously identifies the location of a file without reference to an additional starting location." In other words, the rules are: 1. POSIX style paths with nonempty root directory are absolute. 2. Windows style paths with nonempty root name and root directory are absolute. 3. No other paths are absolute. GNU rules are: 1. Paths starting with a path separator are absolute. 2. Windows style paths are also absolute if they start with a character followed by ':'. 3. No other paths are absolute. On Windows style the path "C:\Users\Default" has "C:" as root name and "\" as root directory. Hence "C:" on Windows is absolute under GNU rules and not absolute under C++17 because it has no root directory. Likewise "/" and "\" on Windows are absolute under GNU and are not absolute under C++17 due to empty root name. Related to PR46368. Differential Revision: https://reviews.llvm.org/D87667
2020-07-30[Support] Class to facilitate file lockingSerge Pavlov1-0/+47
This change define RAII class `FileLocker` and methods `lock` and `tryLockFor` of the class `raw_fd_stream` to facilitate using file locks. Differential Revision: https://reviews.llvm.org/D79066
2020-07-15[Support] Fix Windows directory_iterator_construct out of boundsAndrew Ng1-0/+33
Fix incorrect use of the size of Path when accessing PathUTF16, as the UTF-16 path can be shorter. Added unit test for coverage of this test case. Thanks to Ding Fei (danix800) for the code fix, see https://reviews.llvm.org/D83321. Differential Revision: https://reviews.llvm.org/D83689
2020-07-06[Support] Add path::user_config_directory for $XDG_CONFIG_HOME etcSam McCall1-0/+42
Reviewers: hokein Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D83128
2020-06-27Reland: [clang driver] Move default module cache from system temporary directoryDavid Zarzycki1-1/+2
This fixes a unit test. Otherwise here is the original commit: 1) Shared writable directories like /tmp are a security problem. 2) Systems provide dedicated cache directories these days anyway. 3) This also refines LLVM's cache_directory() on Darwin platforms to use the Darwin per-user cache directory. Reviewers: compnerd, aprantl, jakehehrlich, espindola, respindola, ilya-biryukov, pcc, sammccall Reviewed By: compnerd, sammccall Subscribers: hiraditya, llvm-commits, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D82362
2020-06-04[Support][NFC] Tests for root_name(), root_directory() and root_path()Jan Korous1-0/+65
It's literally just doc comments converted to unittests.
2020-06-03Revert "[Support] Add file lock/unlock functions"Serge Pavlov1-45/+0
This reverts commit f51bc4fb60fbcef26d18eff549fc68307fd46489. It broke the Solaris buildbots (Builder clang-solaris11-sparcv9 Build #5494 <http://lab.llvm.org:8014/builders/clang-solaris11-sparcv9/builds/54).
2020-06-03[Support] Add file lock/unlock functionsSerge Pavlov1-0/+45
New functions `lockFile`, `tryLockFile` and `unlockFile` implement simple file locking. They lock or unlock entire file. This must be enough to support simulataneous writes to log files in parallel builds. Differential Revision: https://reviews.llvm.org/D78896
2020-05-13[Clang] Restore replace_path_prefix instead of startswithSylvain Audi1-12/+37
In D49466, sys::path::replace_path_prefix was used instead startswith for -f[macro/debug/file]-prefix-map options. However those were reverted later (commit rG3bb24bf25767ef5bbcef958b484e7a06d8689204) due to broken Windows tests. This patch restores those replace_path_prefix calls. It also modifies the prefix matching to be case-insensitive under Windows. Differential Revision : https://reviews.llvm.org/D76869
2020-05-05Let normalize() for posix style convert backslash to slash unconditionally.Nico Weber1-1/+1
Currently, normalize() for posix replaces backslashes to slashes, except that two backslashes in sequence are kept as-is. clang calls normalize() to convert \ to / is microsoft compat mode. This generally works well, but a path like "c:\\foo\\bar.h" with two backslashes doesn't work due to the exception in normalize(). These paths happen naturally on Windows hosts with e.g. `#include __FILE__`, and them not working on other hosts makes it more difficult to write tests for this case. The special case has been around without justification since this code was added in r203611 (since then moved around in r215241 r215243). No integration tests fail if I remove it. Try removing the special case. Differential Revision: https://reviews.llvm.org/D79265
2020-05-05Add a test to Support.NormalizePath.Nico Weber1-0/+1
2020-05-04Re-land "Optimize path::remove_dots"Reid Kleckner1-0/+29
This reverts commit fb5fd74685e728b1d5e68d33e9842bcd734b98e6. Re-instates commit 53913a65b408ade2956061b4c0aaed6bba907403 The fix is to trim off trailing separators, as in `/foo/bar/` and produce `/foo/bar`. VFS tests rely on this. I added unit tests for remove_dots.