[llvm] r184448 - Use only the filename when deciding if a file is a duplicate.

Rafael Espindola rafael.espindola at gmail.com
Thu Jun 20 11:30:37 PDT 2013


Author: rafael
Date: Thu Jun 20 13:30:37 2013
New Revision: 184448

URL: http://llvm.org/viewvc/llvm-project?rev=184448&view=rev
Log:
Use only the filename when deciding if a file is a duplicate.

Matches gnu ar behavior.

Modified:
    llvm/trunk/test/Archive/directory.ll
    llvm/trunk/tools/llvm-ar/llvm-ar.cpp

Modified: llvm/trunk/test/Archive/directory.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Archive/directory.ll?rev=184448&r1=184447&r2=184448&view=diff
==============================================================================
--- llvm/trunk/test/Archive/directory.ll (original)
+++ llvm/trunk/test/Archive/directory.ll Thu Jun 20 13:30:37 2013
@@ -4,7 +4,9 @@
 ;RUN: rm -f %T/test.a
 ;RUN: touch %T/a-very-long-file-name
 ;RUN: llvm-ar r %T/test.a %s %T/a-very-long-file-name
+;RUN: llvm-ar r %T/test.a %T/a-very-long-file-name
 ;RUN: llvm-ar t %T/test.a | FileCheck -check-prefix=MEMBERS %s
 ;MEMBERS-NOT: /
 ;MEMBERS: a-very-long-file-name
 ;MEMBERS: directory.ll
+;MEMBERS-NOT: a-very-long-file-name

Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=184448&r1=184447&r2=184448&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Thu Jun 20 13:30:37 2013
@@ -563,7 +563,7 @@ doReplaceOrInsert(std::string* ErrMsg) {
     std::set<std::string>::iterator found = remaining.end();
     for (std::set<std::string>::iterator RI = remaining.begin(),
          RE = remaining.end(); RI != RE; ++RI ) {
-      std::string compare(*RI);
+      std::string compare(sys::path::filename(*RI));
       if (TruncateNames && compare.length() > 15) {
         const char* nm = compare.c_str();
         unsigned len = compare.length();





More information about the llvm-commits mailing list