[PATCH] Fix path concatenation in HeaderSearch

Yaron Keren yaron.keren at gmail.com
Sat May 10 05:09:45 PDT 2014


+deleted line
+test

http://reviews.llvm.org/D3686

Files:
  tools/clang/lib/Lex/HeaderSearch.cpp
  tools/clang/test/Frontend/Inputs/just-warning.h
  tools/clang/test/Frontend/path-seperator.c

Index: tools/clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- tools/clang/lib/Lex/HeaderSearch.cpp
+++ tools/clang/lib/Lex/HeaderSearch.cpp
@@ -621,10 +621,8 @@
          I != E; ++I) {
       const FileEntry *Includer = *I;
       // Concatenate the requested file onto the directory.
-      // FIXME: Portability.  Filename concatenation should be in sys::Path.
       TmpDir = Includer->getDir()->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
Index: tools/clang/test/Frontend/path-seperator.c
===================================================================
--- tools/clang/test/Frontend/path-seperator.c
+++ tools/clang/test/Frontend/path-seperator.c
@@ -0,0 +1,6 @@
+// REQUIRES: system-windows
+// RUN: %clang -c %s -nostdinc -I%S\Inputs 2>&1 | FileCheck %s
+
+// CHECK: Inputs\just-warning.h:1:2: warning
+
+#include <just-warning.h>
Index: tools/clang/test/Frontend/Inputs/just-warning.h
===================================================================
--- tools/clang/test/Frontend/Inputs/just-warning.h
+++ tools/clang/test/Frontend/Inputs/just-warning.h
@@ -0,0 +1 @@
+#warning 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3686.9278.patch
Type: text/x-patch
Size: 1408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140510/8febe49f/attachment.bin>


More information about the cfe-commits mailing list