[lld] r241713 - COFF: Set parent name for bitcode files.

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


Author: pcc
Date: Wed Jul  8 14:14:33 2015
New Revision: 241713

URL: http://llvm.org/viewvc/llvm-project?rev=241713&view=rev
Log:
COFF: Set parent name for bitcode files.

Differential Revision: http://reviews.llvm.org/D10983

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

Modified: lld/trunk/COFF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Symbols.cpp?rev=241713&r1=241712&r2=241713&view=diff
==============================================================================
--- lld/trunk/COFF/Symbols.cpp (original)
+++ lld/trunk/COFF/Symbols.cpp Wed Jul  8 14:14:33 2015
@@ -221,17 +221,19 @@ ErrorOr<std::unique_ptr<InputFile>> Lazy
     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);
 }

Modified: lld/trunk/test/COFF/lto.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/lto.ll?rev=241713&r1=241712&r2=241713&view=diff
==============================================================================
--- lld/trunk/test/COFF/lto.ll (original)
+++ lld/trunk/test/COFF/lto.ll Wed Jul  8 14:14:33 2015
@@ -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:





More information about the llvm-commits mailing list