llvm.org GIT mirror llvm / 4daa23f
llvm-ar: print an error when the requested member is not found. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242156 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 4 years ago
2 changed file(s) with 16 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
4040 ; RUN: env TZ=GMT llvm-ar tv %t.a | FileCheck %s
4141
4242 CHECK: 1465 2004-11-19 03:01:31.000000000 very_long_bytecode_file_name.bc
43
44
45 RUN: not llvm-ar x %p/Inputs/GNU.a foo.o 2>&1 | FileCheck --check-prefix=NOTFOUND %s
46 NOTFOUND: foo.o was not found
390390
391391 static void performReadOperation(ArchiveOperation Operation,
392392 object::Archive *OldArchive) {
393 bool Filter = !Members.empty();
393394 for (const object::Archive::Child &C : OldArchive->children()) {
394395 ErrorOr NameOrErr = C.getName();
395396 failIfError(NameOrErr.getError());
396397 StringRef Name = NameOrErr.get();
397398
398 if (!Members.empty() &&
399 std::find(Members.begin(), Members.end(), Name) == Members.end())
400 continue;
399 if (Filter) {
400 auto I = std::find(Members.begin(), Members.end(), Name);
401 if (I == Members.end())
402 continue;
403 Members.erase(I);
404 }
401405
402406 switch (Operation) {
403407 default:
413417 break;
414418 }
415419 }
420 if (Members.empty())
421 return;
422 for (StringRef Name : Members)
423 errs() << Name << " was not found\n";
424 std::exit(1);
416425 }
417426
418427 template