[PATCH] D81117: Fix path separator issue on Windows

Christopher Tetreault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 3 13:46:32 PDT 2020


ctetreau created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The following 3 tests fail on Windows:
Clang :: ClangScanDeps/header_stat_before_open.m
Clang :: ClangScanDeps/static-analyzer.c
Clang :: ClangScanDeps/vfsoverlay.cpp

The issue is that bad filenames are being constructed. This change uses
llvm::sys::path::append to concatenate file paths rather than string
append with a '/' thrown in the middle.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81117

Files:
  clang/lib/Lex/HeaderSearch.cpp


Index: clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -780,10 +780,8 @@
       const FileEntry *Includer = IncluderAndDir.first;
 
       // Concatenate the requested file onto the directory.
-      // FIXME: Portability.  Filename concatenation should be in sys::Path.
       TmpDir = IncluderAndDir.second->getName();
-      TmpDir.push_back('/');
-      TmpDir.append(Filename.begin(), Filename.end());
+      llvm::sys::path::append(TmpDir, Filename);
 
       // FIXME: We don't cache the result of getFileInfo across the call to
       // getFileAndSuggestModule, because it's a reference to an element of


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81117.268293.patch
Type: text/x-patch
Size: 737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200603/b02ca11f/attachment.bin>


More information about the cfe-commits mailing list