r196859 - Use llvm::sys::path::append to concatenate paths

Dmitri Gribenko gribozavr at gmail.com
Mon Dec 9 17:36:10 PST 2013


Author: gribozavr
Date: Mon Dec  9 19:36:10 2013
New Revision: 196859

URL: http://llvm.org/viewvc/llvm-project?rev=196859&view=rev
Log:
Use llvm::sys::path::append to concatenate paths

Modified:
    cfe/trunk/lib/Lex/HeaderSearch.cpp

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=196859&r1=196858&r2=196859&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Mon Dec  9 19:36:10 2013
@@ -549,12 +549,9 @@ const FileEntry *HeaderSearch::LookupFil
   // a subsequent include of "baz.h" should resolve to "whatever/foo/baz.h".
   // This search is not done for <> headers.
   if (CurFileEnt && !isAngled && !NoCurDirSearch) {
-    SmallString<1024> TmpDir;
     // Concatenate the requested file onto the directory.
-    // FIXME: Portability.  Filename concatenation should be in sys::Path.
-    TmpDir += CurFileEnt->getDir()->getName();
-    TmpDir.push_back('/');
-    TmpDir.append(Filename.begin(), Filename.end());
+    SmallString<1024> TmpDir(CurFileEnt->getDir()->getName());
+    llvm::sys::path::append(TmpDir, Filename);
     if (const FileEntry *FE = FileMgr.getFile(TmpDir.str(),/*openFile=*/true)) {
       // Leave CurDir unset.
       // This file is a system header or C++ unfriendly if the old file is.





More information about the cfe-commits mailing list