mirror of
https://github.com/intel/llvm.git
synced 2026-02-04 03:26:06 +08:00
[clang][tools] Remove path separator assumption
After 98e6deb6 the 'HeadersForSymbolTest.IWYUTransitiveExportWithPrivate' test in 'ClangIncludeCleanerTest' started failing. This is most likely because `FileEntryRef::getName()` now starts with ".\" on Windows, whereas `FileEntry::getName()` did not. This commit fixes assumption of forward slash separators.
This commit is contained in:
@@ -50,8 +50,7 @@ llvm::SmallVector<Header> ranked(llvm::SmallVector<Hinted<Header>> Headers) {
|
||||
// name.
|
||||
llvm::StringRef basename(llvm::StringRef Header) {
|
||||
Header = Header.trim("<>\"");
|
||||
if (auto LastSlash = Header.rfind('/'); LastSlash != Header.npos)
|
||||
Header = Header.drop_front(LastSlash + 1);
|
||||
Header = llvm::sys::path::filename(Header);
|
||||
// Drop everything after first `.` (dot).
|
||||
// foo.h -> foo
|
||||
// foo.cu.h -> foo
|
||||
|
||||
Reference in New Issue
Block a user