<div dir="ltr">Looks like there's a buildbot error, so I committed r368578 to get things green again:<pre style="font-family:"Courier New",courier,monotype,monospace;color:rgb(0,0,0);font-size:medium"><span class="gmail-stdout">FAILED: /usr/local/bin/c++   -DGTEST_HAS_RTTI=0 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/llvm-ar -I/home/buildslave/buildslave/clang-cmake-armv7-lnt/llvm/tools/llvm-ar -I/usr/include/libxml2 -Iinclude -I/home/buildslave/buildslave/clang-cmake-armv7-lnt/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O3    -UNDEBUG  -fno-exceptions -fno-rtti -MMD -MT tools/llvm-ar/CMakeFiles/llvm-ar.dir/llvm-ar.cpp.o -MF tools/llvm-ar/CMakeFiles/llvm-ar.dir/llvm-ar.cpp.o.d -o tools/llvm-ar/CMakeFiles/llvm-ar.dir/llvm-ar.cpp.o -c /home/buildslave/buildslave/clang-cmake-armv7-lnt/llvm/tools/llvm-ar/llvm-ar.cpp
/home/buildslave/buildslave/clang-cmake-armv7-lnt/llvm/tools/llvm-ar/llvm-ar.cpp: In function ‘std::__cxx11::string normalizePath(llvm::StringRef)’:
/home/buildslave/buildslave/clang-cmake-armv7-lnt/llvm/tools/llvm-ar/llvm-ar.cpp:478:26: error: operands to ?: have different types ‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’ and ‘llvm::StringRef’
   return CompareFullPath ? sys::path::convert_to_slash(Path)
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          : sys::path::filename(Path);
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~</span></pre></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 12, 2019 at 6:59 AM Owen Reynolds via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: gbreynoo<br>
Date: Mon Aug 12 07:00:28 2019<br>
New Revision: 368573<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=368573&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=368573&view=rev</a><br>
Log:<br>
[llvm-ar] Accept file paths with windows format slashes<br>
<br>
The internal representation of llvm-ar archives uses linux style slashes<br>
for paths, no matter the OS. In the case of windows this meant file<br>
paths input intending to match existing members would only match if<br>
linux style slashes where used. This change allows either slash<br>
direction to be input by the user.<br>
<br>
This change includes removing an unnecessary call to normalisePath and<br>
moving the call of another.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D65743" rel="noreferrer" target="_blank">https://reviews.llvm.org/D65743</a><br>
<br>
Added:<br>
    llvm/trunk/test/tools/llvm-ar/windows-path.test<br>
Modified:<br>
    llvm/trunk/tools/llvm-ar/llvm-ar.cpp<br>
<br>
Added: llvm/trunk/test/tools/llvm-ar/windows-path.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/windows-path.test?rev=368573&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/windows-path.test?rev=368573&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/tools/llvm-ar/windows-path.test (added)<br>
+++ llvm/trunk/test/tools/llvm-ar/windows-path.test Mon Aug 12 07:00:28 2019<br>
@@ -0,0 +1,44 @@<br>
+# Test that windows path seperators are handled correctly.<br>
+REQUIRES: system-windows<br>
+<br>
+# Note: many of these tests depend on relative paths, so we have to cd to a<br>
+# test directory first.<br>
+RUN: mkdir -p %t && cd %t<br>
+RUN: rm -rf a b && mkdir a b<br>
+RUN: echo hello-a      > a/foo.txt<br>
+RUN: echo hello-b      > b/foo.txt<br>
+RUN: echo hello-parent > foo.txt<br>
+<br>
+# P is implied when using thin archives.<br>
+# Create an archive.<br>
+RUN: rm -f archive.a<br>
+RUN: llvm-ar rcST archive.a a\..\a\foo.txt<br>
+RUN: llvm-ar rcST archive.a foo.txt<br>
+RUN: llvm-ar rcST archive.a b\foo.txt b/foo.txt<br>
+RUN: llvm-ar dT archive.a foo.txt<br>
+RUN: llvm-ar t archive.a | FileCheck %s --check-prefix=ARCHIVE --implicit-check-not {{.}}<br>
+<br>
+ARCHIVE:      a/foo.txt<br>
+ARCHIVE-NEXT: b/foo.txt<br>
+ARCHIVE-NEXT: b/foo.txt<br>
+<br>
+RUN: llvm-ar t archive.a | FileCheck %s --check-prefix=LIST-BOTH --implicit-check-not {{.}}<br>
+RUN: llvm-ar t archive.a a\foo.txt | FileCheck %s --check-prefix=LIST-A --implicit-check-not {{.}}<br>
+RUN: llvm-ar t archive.a b\foo.txt | FileCheck %s --check-prefix=LIST-B --implicit-check-not {{.}}<br>
+<br>
+LIST-BOTH:       a/foo.txt<br>
+LIST-BOTH-NEXT:  b/foo.txt<br>
+LIST-BOTH-NEXT:  b/foo.txt<br>
+LIST-A:          a/foo.txt<br>
+LIST-B:          b/foo.txt<br>
+<br>
+# Nesting a thin archive with a name conflict.<br>
+RUN: rm -f a\nested.a b\nested.a nested.a<br>
+RUN: llvm-ar rcST a\nested.a a\foo.txt<br>
+RUN: llvm-ar rcST b\nested.a b\foo.txt<br>
+RUN: llvm-ar rcST nested.a a\nested.a foo.txt b\nested.a<br>
+RUN: llvm-ar t nested.a | FileCheck %s --check-prefix=NESTED --implicit-check-not {{.}}<br>
+<br>
+NESTED:      a/foo.txt<br>
+NESTED-NEXT: foo.txt<br>
+NESTED-NEXT: b/foo.txt<br>
<br>
Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=368573&r1=368572&r2=368573&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=368573&r1=368572&r2=368573&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)<br>
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Mon Aug 12 07:00:28 2019<br>
@@ -474,8 +474,9 @@ static void doDisplayTable(StringRef Nam<br>
   outs() << Name << "\n";<br>
 }<br>
<br>
-static StringRef normalizePath(StringRef Path) {<br>
-  return CompareFullPath ? Path : sys::path::filename(Path);<br>
+static std::string normalizePath(StringRef Path) {<br>
+  return CompareFullPath ? sys::path::convert_to_slash(Path)<br>
+                         : sys::path::filename(Path);<br>
 }<br>
<br>
 // Implement the 'x' operation. This function extracts files back to the file<br>
@@ -698,9 +699,8 @@ static InsertAction computeInsertAction(<br>
     return IA_MoveOldMember;<br>
<br>
   if (Operation == ReplaceOrInsert) {<br>
-    StringRef PosName = normalizePath(RelPos);<br>
     if (!OnlyUpdate) {<br>
-      if (PosName.empty())<br>
+      if (RelPos.empty())<br>
         return IA_AddNewMember;<br>
       return IA_MoveNewMember;<br>
     }<br>
@@ -712,12 +712,12 @@ static InsertAction computeInsertAction(<br>
     auto ModTimeOrErr = Member.getLastModified();<br>
     failIfError(ModTimeOrErr.takeError());<br>
     if (Status.getLastModificationTime() < ModTimeOrErr.get()) {<br>
-      if (PosName.empty())<br>
+      if (RelPos.empty())<br>
         return IA_AddOldMember;<br>
       return IA_MoveOldMember;<br>
     }<br>
<br>
-    if (PosName.empty())<br>
+    if (RelPos.empty())<br>
       return IA_AddNewMember;<br>
     return IA_MoveNewMember;<br>
   }<br>
@@ -732,8 +732,8 @@ computeNewArchiveMembers(ArchiveOperatio<br>
   std::vector<NewArchiveMember> Ret;<br>
   std::vector<NewArchiveMember> Moved;<br>
   int InsertPos = -1;<br>
-  StringRef PosName = normalizePath(RelPos);<br>
   if (OldArchive) {<br>
+    std::string PosName = normalizePath(RelPos);<br>
     Error Err = Error::success();<br>
     StringMap<int> MemberCount;<br>
     for (auto &Child : OldArchive->children(Err)) {<br>
@@ -1009,7 +1009,7 @@ static void runMRIScript() {<br>
       ArchiveName = Rest;<br>
       break;<br>
     case MRICommand::Delete: {<br>
-      StringRef Name = normalizePath(Rest);<br>
+      std::string Name = normalizePath(Rest);<br>
       llvm::erase_if(NewMembers,<br>
                      [=](NewArchiveMember &M) { return M.MemberName == Name; });<br>
       break;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>