llvm.org GIT mirror llvm / 51c5f77
Clean up some things in the WindowsResource changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305596 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Beckmann 2 years ago
4 changed file(s) with 99 addition(s) and 130 deletion(s). Raw diff Collapse all Expand all
2929 #define LLVM_INCLUDE_LLVM_OBJECT_RESFILE_H
3030
3131 #include "llvm/ADT/ArrayRef.h"
32 #include "llvm/ADT/STLExtras.h"
3332 #include "llvm/BinaryFormat/COFF.h"
3433 #include "llvm/Object/Binary.h"
3534 #include "llvm/Object/Error.h"
4342 #include
4443
4544 namespace llvm {
46
4745 namespace object {
4846
4947 class WindowsResource;
1111 //===----------------------------------------------------------------------===//
1212
1313 #include "llvm/Object/WindowsResource.h"
14 #include "llvm/BinaryFormat/COFF.h"
1514 #include "llvm/Object/COFF.h"
1615 #include "llvm/Support/FileOutputBuffer.h"
1716 #include "llvm/Support/MathExtras.h"
2120 #include
2221
2322 using namespace llvm;
23 using namespace object;
2424
2525 namespace llvm {
2626 namespace object {
247247 std::string NameString;
248248 ArrayRef CorrectedName;
249249 std::vector EndianCorrectedName;
250 if (llvm::sys::IsBigEndianHost) {
250 if (sys::IsBigEndianHost) {
251251 EndianCorrectedName.resize(NameRef.size() + 1);
252252 std::copy(NameRef.begin(), NameRef.end(), EndianCorrectedName.begin() + 1);
253253 EndianCorrectedName[0] = UNI_UTF16_BYTE_ORDER_MARK_SWAPPED;
254254 CorrectedName = makeArrayRef(EndianCorrectedName);
255255 } else
256256 CorrectedName = NameRef;
257 llvm::convertUTF16ToUTF8String(CorrectedName, NameString);
257 convertUTF16ToUTF8String(CorrectedName, NameString);
258258
259259 auto Child = StringChildren.find(NameString);
260260 if (Child == StringChildren.end()) {
283283 // the directory strings or the relocations of the .rsrc section.
284284 uint32_t WindowsResourceParser::TreeNode::getTreeSize() const {
285285 uint32_t Size = (IDChildren.size() + StringChildren.size()) *
286 sizeof(llvm::object::coff_resource_dir_entry);
286 sizeof(coff_resource_dir_entry);
287287
288288 // Reached a node pointing to a data entry.
289289 if (IsDataNode) {
290 Size += sizeof(llvm::object::coff_resource_data_entry);
290 Size += sizeof(coff_resource_data_entry);
291291 return Size;
292292 }
293293
294294 // If the node does not point to data, it must have a directory table pointing
295295 // to other nodes.
296 Size += sizeof(llvm::object::coff_resource_dir_table);
296 Size += sizeof(coff_resource_dir_table);
297297
298298 for (auto const &Child : StringChildren) {
299299 Size += Child.second->getTreeSize();
357357
358358 void WindowsResourceCOFFWriter::performFileLayout() {
359359 // Add size of COFF header.
360 FileSize = llvm::COFF::Header16Size;
360 FileSize = COFF::Header16Size;
361361
362362 // one .rsrc section header for directory tree, another for resource data.
363 FileSize += 2 * llvm::COFF::SectionSize;
363 FileSize += 2 * COFF::SectionSize;
364364
365365 performSectionOneLayout();
366366 performSectionTwoLayout();
368368 // We have reached the address of the symbol table.
369369 SymbolTableOffset = FileSize;
370370
371 FileSize += llvm::COFF::Symbol16Size; // size of the @feat.00 symbol.
372 FileSize += 4 * llvm::COFF::Symbol16Size; // symbol + aux for each section.
373 FileSize += Data.size() * llvm::COFF::Symbol16Size; // 1 symbol per resource.
371 FileSize += COFF::Symbol16Size; // size of the @feat.00 symbol.
372 FileSize += 4 * COFF::Symbol16Size; // symbol + aux for each section.
373 FileSize += Data.size() * COFF::Symbol16Size; // 1 symbol per resource.
374374 FileSize += 4; // four null bytes for the string table.
375375 }
376376
391391 // account for the relocations of section one.
392392 SectionOneRelocations = FileSize + SectionOneSize;
393393 FileSize += SectionOneSize;
394 FileSize += Data.size() *
395 llvm::COFF::RelocationSize; // one relocation for each resource.
394 FileSize +=
395 Data.size() * COFF::RelocationSize; // one relocation for each resource.
396396 FileSize = alignTo(FileSize, SECTION_ALIGNMENT);
397397 }
398398
403403 SectionTwoSize = 0;
404404 for (auto const &Entry : Data) {
405405 DataOffsets.push_back(SectionTwoSize);
406 SectionTwoSize += llvm::alignTo(Entry.size(), sizeof(uint64_t));
406 SectionTwoSize += alignTo(Entry.size(), sizeof(uint64_t));
407407 }
408408 FileSize += SectionTwoSize;
409409 FileSize = alignTo(FileSize, SECTION_ALIGNMENT);
432432
433433 void WindowsResourceCOFFWriter::writeCOFFHeader() {
434434 // Write the COFF header.
435 auto *Header =
436 reinterpret_castcoff_file_header *>(BufferStart);
435 auto *Header = reinterpret_cast<coff_file_header *>(BufferStart);
437436 switch (MachineType) {
438437 case COFF::IMAGE_FILE_MACHINE_ARMNT:
439 Header->Machine = llvm::COFF::IMAGE_FILE_MACHINE_ARMNT;
438 Header->Machine = COFF::IMAGE_FILE_MACHINE_ARMNT;
440439 break;
441440 case COFF::IMAGE_FILE_MACHINE_AMD64:
442 Header->Machine = llvm::COFF::IMAGE_FILE_MACHINE_AMD64;
441 Header->Machine = COFF::IMAGE_FILE_MACHINE_AMD64;
443442 break;
444443 case COFF::IMAGE_FILE_MACHINE_I386:
445 Header->Machine = llvm::COFF::IMAGE_FILE_MACHINE_I386;
444 Header->Machine = COFF::IMAGE_FILE_MACHINE_I386;
446445 break;
447446 default:
448 Header->Machine = llvm::COFF::IMAGE_FILE_MACHINE_UNKNOWN;
447 Header->Machine = COFF::IMAGE_FILE_MACHINE_UNKNOWN;
449448 }
450449 Header->NumberOfSections = 2;
451450 Header->TimeDateStamp = getTime();
453452 // One symbol for every resource plus 2 for each section and @feat.00
454453 Header->NumberOfSymbols = Data.size() + 5;
455454 Header->SizeOfOptionalHeader = 0;
456 Header->Characteristics = llvm::COFF::IMAGE_FILE_32BIT_MACHINE;
455 Header->Characteristics = COFF::IMAGE_FILE_32BIT_MACHINE;
457456 }
458457
459458 void WindowsResourceCOFFWriter::writeFirstSectionHeader() {
460459 // Write the first section header.
461 CurrentOffset += sizeof(llvm::object::coff_file_header);
462 auto *SectionOneHeader = reinterpret_cast(
463 BufferStart + CurrentOffset);
464 strncpy(SectionOneHeader->Name, ".rsrc$01", (size_t)llvm::COFF::NameSize);
460 CurrentOffset += sizeof(coff_file_header);
461 auto *SectionOneHeader =
462 reinterpret_cast(BufferStart + CurrentOffset);
463 strncpy(SectionOneHeader->Name, ".rsrc$01", (size_t)COFF::NameSize);
465464 SectionOneHeader->VirtualSize = 0;
466465 SectionOneHeader->VirtualAddress = 0;
467466 SectionOneHeader->SizeOfRawData = SectionOneSize;
470469 SectionOneHeader->PointerToLinenumbers = 0;
471470 SectionOneHeader->NumberOfRelocations = Data.size();
472471 SectionOneHeader->NumberOfLinenumbers = 0;
473 SectionOneHeader->Characteristics = llvm::COFF::IMAGE_SCN_ALIGN_1BYTES;
474 SectionOneHeader->Characteristics +=
475 llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA;
476 SectionOneHeader->Characteristics +=
477 llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA;
478 SectionOneHeader->Characteristics += llvm::COFF::IMAGE_SCN_MEM_READ;
472 SectionOneHeader->Characteristics = COFF::IMAGE_SCN_ALIGN_1BYTES;
473 SectionOneHeader->Characteristics += COFF::IMAGE_SCN_CNT_INITIALIZED_DATA;
474 SectionOneHeader->Characteristics += COFF::IMAGE_SCN_CNT_INITIALIZED_DATA;
475 SectionOneHeader->Characteristics += COFF::IMAGE_SCN_MEM_READ;
479476 }
480477
481478 void WindowsResourceCOFFWriter::writeSecondSectionHeader() {
482479 // Write the second section header.
483 CurrentOffset += sizeof(llvm::object::coff_section);
484 auto *SectionTwoHeader = reinterpret_cast(
485 BufferStart + CurrentOffset);
486 strncpy(SectionTwoHeader->Name, ".rsrc$02", (size_t)llvm::COFF::NameSize);
480 CurrentOffset += sizeof(coff_section);
481 auto *SectionTwoHeader =
482 reinterpret_cast(BufferStart + CurrentOffset);
483 strncpy(SectionTwoHeader->Name, ".rsrc$02", (size_t)COFF::NameSize);
487484 SectionTwoHeader->VirtualSize = 0;
488485 SectionTwoHeader->VirtualAddress = 0;
489486 SectionTwoHeader->SizeOfRawData = SectionTwoSize;
492489 SectionTwoHeader->PointerToLinenumbers = 0;
493490 SectionTwoHeader->NumberOfRelocations = 0;
494491 SectionTwoHeader->NumberOfLinenumbers = 0;
495 SectionTwoHeader->Characteristics =
496 llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA;
497 SectionTwoHeader->Characteristics += llvm::COFF::IMAGE_SCN_MEM_READ;
492 SectionTwoHeader->Characteristics = COFF::IMAGE_SCN_CNT_INITIALIZED_DATA;
493 SectionTwoHeader->Characteristics += COFF::IMAGE_SCN_MEM_READ;
498494 }
499495
500496 void WindowsResourceCOFFWriter::writeFirstSection() {
501497 // Write section one.
502 CurrentOffset += sizeof(llvm::object::coff_section);
498 CurrentOffset += sizeof(coff_section);
503499
504500 writeDirectoryTree();
505501 writeDirectoryStringTable();
522518 void WindowsResourceCOFFWriter::writeSymbolTable() {
523519 // Now write the symbol table.
524520 // First, the feat symbol.
525 auto *Symbol = reinterpret_cast(BufferStart +
526 CurrentOffset);
527 strncpy(Symbol->Name.ShortName, "@feat.00", (size_t)llvm::COFF::NameSize);
521 auto *Symbol = reinterpret_cast(BufferStart + CurrentOffset);
522 strncpy(Symbol->Name.ShortName, "@feat.00", (size_t)COFF::NameSize);
528523 Symbol->Value = 0x11;
529524 Symbol->SectionNumber = 0xffff;
530 Symbol->Type = llvm::COFF::IMAGE_SYM_DTYPE_NULL;
531 Symbol->StorageClass = llvm::COFF::IMAGE_SYM_CLASS_STATIC;
525 Symbol->Type = COFF::IMAGE_SYM_DTYPE_NULL;
526 Symbol->StorageClass = COFF::IMAGE_SYM_CLASS_STATIC;
532527 Symbol->NumberOfAuxSymbols = 0;
533 CurrentOffset += sizeof(llvm::object::coff_symbol16);
528 CurrentOffset += sizeof(coff_symbol16);
534529
535530 // Now write the .rsrc1 symbol + aux.
536 Symbol = reinterpret_cast(BufferStart +
537 CurrentOffset);
538 strncpy(Symbol->Name.ShortName, ".rsrc$01", (size_t)llvm::COFF::NameSize);
531 Symbol = reinterpret_cast(BufferStart + CurrentOffset);
532 strncpy(Symbol->Name.ShortName, ".rsrc$01", (size_t)COFF::NameSize);
539533 Symbol->Value = 0;
540534 Symbol->SectionNumber = 1;
541 Symbol->Type = llvm::COFF::IMAGE_SYM_DTYPE_NULL;
542 Symbol->StorageClass = llvm::COFF::IMAGE_SYM_CLASS_STATIC;
535 Symbol->Type = COFF::IMAGE_SYM_DTYPE_NULL;
536 Symbol->StorageClass = COFF::IMAGE_SYM_CLASS_STATIC;
543537 Symbol->NumberOfAuxSymbols = 1;
544 CurrentOffset += sizeof(llvm::object::coff_symbol16);
545 auto *Aux = reinterpret_cast(
546 BufferStart + CurrentOffset);
538 CurrentOffset += sizeof(coff_symbol16);
539 auto *Aux = reinterpret_cast(BufferStart +
540 CurrentOffset);
547541 Aux->Length = SectionOneSize;
548542 Aux->NumberOfRelocations = Data.size();
549543 Aux->NumberOfLinenumbers = 0;
550544 Aux->CheckSum = 0;
551545 Aux->NumberLowPart = 0;
552546 Aux->Selection = 0;
553 CurrentOffset += sizeof(llvm::object::coff_aux_section_definition);
547 CurrentOffset += sizeof(coff_aux_section_definition);
554548
555549 // Now write the .rsrc2 symbol + aux.
556 Symbol = reinterpret_cast(BufferStart +
557 CurrentOffset);
558 strncpy(Symbol->Name.ShortName, ".rsrc$02", (size_t)llvm::COFF::NameSize);
550 Symbol = reinterpret_cast(BufferStart + CurrentOffset);
551 strncpy(Symbol->Name.ShortName, ".rsrc$02", (size_t)COFF::NameSize);
559552 Symbol->Value = 0;
560553 Symbol->SectionNumber = 2;
561 Symbol->Type = llvm::COFF::IMAGE_SYM_DTYPE_NULL;
562 Symbol->StorageClass = llvm::COFF::IMAGE_SYM_CLASS_STATIC;
554 Symbol->Type = COFF::IMAGE_SYM_DTYPE_NULL;
555 Symbol->StorageClass = COFF::IMAGE_SYM_CLASS_STATIC;
563556 Symbol->NumberOfAuxSymbols = 1;
564 CurrentOffset += sizeof(llvm::object::coff_symbol16);
565 Aux = reinterpret_cast(
566 BufferStart + CurrentOffset);
557 CurrentOffset += sizeof(coff_symbol16);
558 Aux = reinterpret_cast(BufferStart +
559 CurrentOffset);
567560 Aux->Length = SectionTwoSize;
568561 Aux->NumberOfRelocations = 0;
569562 Aux->NumberOfLinenumbers = 0;
570563 Aux->CheckSum = 0;
571564 Aux->NumberLowPart = 0;
572565 Aux->Selection = 0;
573 CurrentOffset += sizeof(llvm::object::coff_aux_section_definition);
566 CurrentOffset += sizeof(coff_aux_section_definition);
574567
575568 // Now write a symbol for each relocation.
576569 for (unsigned i = 0; i < Data.size(); i++) {
577570 char RelocationName[9];
578571 sprintf(RelocationName, "$R%06X", DataOffsets[i]);
579 Symbol = reinterpret_cast(BufferStart +
580 CurrentOffset);
581 strncpy(Symbol->Name.ShortName, RelocationName,
582 (size_t)llvm::COFF::NameSize);
572 Symbol = reinterpret_cast(BufferStart + CurrentOffset);
573 strncpy(Symbol->Name.ShortName, RelocationName, (size_t)COFF::NameSize);
583574 Symbol->Value = DataOffsets[i];
584575 Symbol->SectionNumber = 1;
585 Symbol->Type = llvm::COFF::IMAGE_SYM_DTYPE_NULL;
586 Symbol->StorageClass = llvm::COFF::IMAGE_SYM_CLASS_STATIC;
576 Symbol->Type = COFF::IMAGE_SYM_DTYPE_NULL;
577 Symbol->StorageClass = COFF::IMAGE_SYM_CLASS_STATIC;
587578 Symbol->NumberOfAuxSymbols = 0;
588 CurrentOffset += sizeof(llvm::object::coff_symbol16);
579 CurrentOffset += sizeof(coff_symbol16);
589580 }
590581 }
591582
600591 // COFF objects.
601592 std::queue Queue;
602593 Queue.push(&Resources);
603 uint32_t NextLevelOffset = sizeof(llvm::object::coff_resource_dir_table) +
604 (Resources.getStringChildren().size() +
605 Resources.getIDChildren().size()) *
606 sizeof(llvm::object::coff_resource_dir_entry);
594 uint32_t NextLevelOffset =
595 sizeof(coff_resource_dir_table) + (Resources.getStringChildren().size() +
596 Resources.getIDChildren().size()) *
597 sizeof(coff_resource_dir_entry);
607598 std::vector DataEntriesTreeOrder;
608599 uint32_t CurrentRelativeOffset = 0;
609600
610601 while (!Queue.empty()) {
611602 auto CurrentNode = Queue.front();
612603 Queue.pop();
613 auto *Table = reinterpret_cast(
614 BufferStart + CurrentOffset);
604 auto *Table = reinterpret_cast(BufferStart +
605 CurrentOffset);
615606 Table->Characteristics = CurrentNode->getCharacteristics();
616607 Table->TimeDateStamp = 0;
617608 Table->MajorVersion = CurrentNode->getMajorVersion();
620611 auto &StringChildren = CurrentNode->getStringChildren();
621612 Table->NumberOfNameEntries = StringChildren.size();
622613 Table->NumberOfIDEntries = IDChildren.size();
623 CurrentOffset += sizeof(llvm::object::coff_resource_dir_table);
624 CurrentRelativeOffset += sizeof(llvm::object::coff_resource_dir_table);
614 CurrentOffset += sizeof(coff_resource_dir_table);
615 CurrentRelativeOffset += sizeof(coff_resource_dir_table);
625616
626617 // Write the directory entries immediately following each directory table.
627618 for (auto const &Child : StringChildren) {
628 auto *Entry = reinterpret_cast(
629 BufferStart + CurrentOffset);
619 auto *Entry = reinterpret_cast(BufferStart +
620 CurrentOffset);
630621 Entry->Identifier.NameOffset =
631622 StringTableOffsets[Child.second->getStringIndex()];
632623 if (Child.second->checkIsDataNode()) {
633624 Entry->Offset.DataEntryOffset = NextLevelOffset;
634 NextLevelOffset += sizeof(llvm::object::coff_resource_data_entry);
625 NextLevelOffset += sizeof(coff_resource_data_entry);
635626 DataEntriesTreeOrder.push_back(Child.second.get());
636627 } else {
637628 Entry->Offset.SubdirOffset = NextLevelOffset + (1 << 31);
638 NextLevelOffset += sizeof(llvm::object::coff_resource_dir_table) +
629 NextLevelOffset += sizeof(coff_resource_dir_table) +
639630 (Child.second->getStringChildren().size() +
640631 Child.second->getIDChildren().size()) *
641 sizeof(llvm::object::coff_resource_dir_entry);
632 sizeof(coff_resource_dir_entry);
642633 Queue.push(Child.second.get());
643634 }
644 CurrentOffset += sizeof(llvm::object::coff_resource_dir_entry);
645 CurrentRelativeOffset += sizeof(llvm::object::coff_resource_dir_entry);
635 CurrentOffset += sizeof(coff_resource_dir_entry);
636 CurrentRelativeOffset += sizeof(coff_resource_dir_entry);
646637 }
647638 for (auto const &Child : IDChildren) {
648 auto *Entry = reinterpret_cast(
649 BufferStart + CurrentOffset);
639 auto *Entry = reinterpret_cast(BufferStart +
640 CurrentOffset);
650641 Entry->Identifier.ID = Child.first;
651642 if (Child.second->checkIsDataNode()) {
652643 Entry->Offset.DataEntryOffset = NextLevelOffset;
653 NextLevelOffset += sizeof(llvm::object::coff_resource_data_entry);
644 NextLevelOffset += sizeof(coff_resource_data_entry);
654645 DataEntriesTreeOrder.push_back(Child.second.get());
655646 } else {
656647 Entry->Offset.SubdirOffset = NextLevelOffset + (1 << 31);
657 NextLevelOffset += sizeof(llvm::object::coff_resource_dir_table) +
648 NextLevelOffset += sizeof(coff_resource_dir_table) +
658649 (Child.second->getStringChildren().size() +
659650 Child.second->getIDChildren().size()) *
660 sizeof(llvm::object::coff_resource_dir_entry);
651 sizeof(coff_resource_dir_entry);
661652 Queue.push(Child.second.get());
662653 }
663 CurrentOffset += sizeof(llvm::object::coff_resource_dir_entry);
664 CurrentRelativeOffset += sizeof(llvm::object::coff_resource_dir_entry);
654 CurrentOffset += sizeof(coff_resource_dir_entry);
655 CurrentRelativeOffset += sizeof(coff_resource_dir_entry);
665656 }
666657 }
667658
668659 RelocationAddresses.resize(Data.size());
669660 // Now write all the resource data entries.
670661 for (auto DataNodes : DataEntriesTreeOrder) {
671 auto *Entry = reinterpret_cast(
672 BufferStart + CurrentOffset);
662 auto *Entry = reinterpret_cast(BufferStart +
663 CurrentOffset);
673664 RelocationAddresses[DataNodes->getDataIndex()] = CurrentRelativeOffset;
674665 Entry->DataRVA = 0; // Set to zero because it is a relocation.
675666 Entry->DataSize = Data[DataNodes->getDataIndex()].size();
676667 Entry->Codepage = 0;
677668 Entry->Reserved = 0;
678 CurrentOffset += sizeof(llvm::object::coff_resource_data_entry);
679 CurrentRelativeOffset += sizeof(llvm::object::coff_resource_data_entry);
669 CurrentOffset += sizeof(coff_resource_data_entry);
670 CurrentRelativeOffset += sizeof(coff_resource_data_entry);
680671 }
681672 }
682673
703694 // .rsrc section.
704695 uint32_t NextSymbolIndex = 5;
705696 for (unsigned i = 0; i < Data.size(); i++) {
706 auto *Reloc = reinterpret_cast(
707 BufferStart + CurrentOffset);
697 auto *Reloc =
698 reinterpret_cast(BufferStart + CurrentOffset);
708699 Reloc->VirtualAddress = RelocationAddresses[i];
709700 Reloc->SymbolTableIndex = NextSymbolIndex++;
710701 switch (MachineType) {
711702 case COFF::IMAGE_FILE_MACHINE_ARMNT:
712 Reloc->Type = llvm::COFF::IMAGE_REL_ARM_ADDR32NB;
703 Reloc->Type = COFF::IMAGE_REL_ARM_ADDR32NB;
713704 break;
714705 case COFF::IMAGE_FILE_MACHINE_AMD64:
715 Reloc->Type = llvm::COFF::IMAGE_REL_AMD64_ADDR32NB;
706 Reloc->Type = COFF::IMAGE_REL_AMD64_ADDR32NB;
716707 break;
717708 case COFF::IMAGE_FILE_MACHINE_I386:
718 Reloc->Type = llvm::COFF::IMAGE_REL_I386_DIR32NB;
709 Reloc->Type = COFF::IMAGE_REL_I386_DIR32NB;
719710 break;
720711 default:
721712 Reloc->Type = 0;
722713 }
723 CurrentOffset += sizeof(llvm::object::coff_relocation);
714 CurrentOffset += sizeof(coff_relocation);
724715 }
725716 }
726717
1010 // platform-independent port of Microsoft's cvtres.exe.
1111 //
1212 //===----------------------------------------------------------------------===//
13
14 #include "llvm-cvtres.h"
1513
1614 #include "llvm/ADT/StringSwitch.h"
1715 #include "llvm/Object/Binary.h"
2826 #include "llvm/Support/Signals.h"
2927 #include "llvm/Support/raw_ostream.h"
3028
29 #include
30
3131 using namespace llvm;
3232 using namespace object;
3333
141141 if (InputArgs.hasArg(OPT_OUT)) {
142142 OutputFile = InputArgs.getLastArgValue(OPT_OUT);
143143 } else {
144 OutputFile = llvm::sys::path::filename(StringRef(InputFiles[0]));
145 llvm::sys::path::replace_extension(OutputFile, ".obj");
144 OutputFile = sys::path::filename(StringRef(InputFiles[0]));
145 sys::path::replace_extension(OutputFile, ".obj");
146146 }
147147
148148 if (Verbose) {
162162 WindowsResourceParser Parser;
163163
164164 for (const auto &File : InputFiles) {
165 Expected> BinaryOrErr =
166 object::createBinary(File);
165 Expected> BinaryOrErr = createBinary(File);
167166 if (!BinaryOrErr)
168167 reportError(File, errorToErrorCode(BinaryOrErr.takeError()));
169168
192191
193192 if (Verbose) {
194193 Parser.printTree(outs());
195 Parser.printTree(errs());
196194 }
197195
198196 std::unique_ptr OutputBuffer;
208206 error(FileBuffer->commit());
209207
210208 if (Verbose) {
211 Expected> BinaryOrErr =
212 object::createBinary(OutputFile);
209 Expected> BinaryOrErr = createBinary(OutputFile);
213210 if (!BinaryOrErr)
214211 reportError(OutputFile, errorToErrorCode(BinaryOrErr.takeError()));
215212 Binary &Binary = *BinaryOrErr.get().getBinary();
+0
-17
tools/llvm-cvtres/llvm-cvtres.h less more
None //===- llvm-cvtres.h ------------------------------------------ *- C++ --*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_TOOLS_LLVMCVTRES_LLVMCVTRES_H
10 #define LLVM_TOOLS_LLVMCVTRES_LLVMCVTRES_H
11
12 #include
13
14 void error(std::error_code EC);
15
16 #endif