[PATCH] D10983: [lld] COFF: Set parent name for bitcode files.

Peter Collingbourne peter at pcc.me.uk
Wed Jul 8 12:14:58 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL241713: COFF: Set parent name for bitcode files. (authored by pcc).

Changed prior to commit:
  http://reviews.llvm.org/D10983?vs=29147&id=29277#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D10983

Files:
  lld/trunk/COFF/Symbols.cpp
  lld/trunk/test/COFF/lto.ll

Index: lld/trunk/test/COFF/lto.ll
===================================================================
--- lld/trunk/test/COFF/lto.ll
+++ lld/trunk/test/COFF/lto.ll
@@ -11,7 +11,7 @@
 ; RUN: lld -flavor link2 /out:%T/main.exe /entry:main /include:f2 /subsystem:console %T/main.lto.obj %T/foo.lto.obj
 ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-11 %s
 ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-11 %s
-; RUN: lld -flavor link2 /out:%T/main.exe /entry:main /include:f2 /subsystem:console %T/main.lto.obj %T/foo.lto.lib
+; RUN: lld -flavor link2 /out:%T/main.exe /entry:main /include:f2 /subsystem:console %T/main.lto.obj %T/foo.lto.lib /verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
 ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-11 %s
 ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-11 %s
 
@@ -29,6 +29,8 @@
 ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-10 %s
 ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-10 %s
 
+; VERBOSE: foo.lto.lib({{.*}}foo.lto.obj)
+
 ; HEADERS-11: AddressOfEntryPoint: 0x1000
 ; TEXT-11: Disassembly of section .text:
 ; TEXT-11-NEXT: .text:
Index: lld/trunk/COFF/Symbols.cpp
===================================================================
--- lld/trunk/COFF/Symbols.cpp
+++ lld/trunk/COFF/Symbols.cpp
@@ -221,17 +221,19 @@
     return std::unique_ptr<InputFile>(nullptr);
 
   file_magic Magic = identify_magic(MBRef.getBuffer());
-  if (Magic == file_magic::bitcode)
-    return std::unique_ptr<InputFile>(new BitcodeFile(MBRef));
   if (Magic == file_magic::coff_import_library)
     return std::unique_ptr<InputFile>(new ImportFile(MBRef));
 
-  if (Magic != file_magic::coff_object) {
+  std::unique_ptr<InputFile> Obj;
+  if (Magic == file_magic::coff_object) {
+    Obj.reset(new ObjectFile(MBRef));
+  } else if (Magic == file_magic::bitcode) {
+    Obj.reset(new BitcodeFile(MBRef));
+  } else {
     llvm::errs() << File->getName() << ": unknown file type\n";
     return make_error_code(LLDError::InvalidFile);
   }
 
-  std::unique_ptr<InputFile> Obj(new ObjectFile(MBRef));
   Obj->setParentName(File->getName());
   return std::move(Obj);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10983.29277.patch
Type: text/x-patch
Size: 2258 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150708/aaef2d30/attachment.bin>


More information about the llvm-commits mailing list