summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/CMakeLists.txt1
-rw-r--r--lib/Config/CMakeLists.txt9
-rw-r--r--lib/Config/Version.cpp43
-rw-r--r--lib/Core/CMakeLists.txt2
-rw-r--r--lib/Core/Reproduce.cpp66
-rw-r--r--lib/Core/Resolver.cpp6
-rw-r--r--lib/Core/SymbolTable.cpp2
-rw-r--r--lib/Core/TargetOptionsCommandFlags.cpp32
-rw-r--r--lib/Driver/CMakeLists.txt4
-rw-r--r--lib/Driver/DarwinLdDriver.cpp6
-rw-r--r--lib/ReaderWriter/CMakeLists.txt1
-rw-r--r--lib/ReaderWriter/FileArchive.cpp2
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler.h2
-rw-r--r--lib/ReaderWriter/MachO/CMakeLists.txt2
-rw-r--r--lib/ReaderWriter/MachO/CompactUnwindPass.cpp2
-rw-r--r--lib/ReaderWriter/MachO/FlatNamespaceFile.h2
-rw-r--r--lib/ReaderWriter/MachO/GOTPass.cpp2
-rw-r--r--lib/ReaderWriter/MachO/MachOLinkingContext.cpp2
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFile.h11
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp7
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h2
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp11
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp2
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp2
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp8
-rw-r--r--lib/ReaderWriter/MachO/ObjCPass.cpp2
-rw-r--r--lib/ReaderWriter/MachO/ShimPass.cpp2
-rw-r--r--lib/ReaderWriter/MachO/StubsPass.cpp2
-rw-r--r--lib/ReaderWriter/YAML/ReaderWriterYAML.cpp6
29 files changed, 41 insertions, 200 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 699f5e93f8af6..8884efcfe9ba9 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -1,4 +1,3 @@
-add_subdirectory(Config)
add_subdirectory(Core)
add_subdirectory(Driver)
add_subdirectory(ReaderWriter)
diff --git a/lib/Config/CMakeLists.txt b/lib/Config/CMakeLists.txt
deleted file mode 100644
index 3e142b66f5784..0000000000000
--- a/lib/Config/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-add_lld_library(lldConfig
- Version.cpp
-
- ADDITIONAL_HEADER_DIRS
- ${LLD_INCLUDE_DIR}/lld/Config
-
- LINK_COMPONENTS
- Support
- )
diff --git a/lib/Config/Version.cpp b/lib/Config/Version.cpp
deleted file mode 100644
index 25544756f8be5..0000000000000
--- a/lib/Config/Version.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//===- lib/Config/Version.cpp - LLD Version Number ---------------*- C++-=====//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines several version-related utility functions for LLD.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lld/Config/Version.h"
-
-using namespace llvm;
-
-// Returns an SVN repository path, which is usually "trunk".
-static std::string getRepositoryPath() {
- StringRef S = LLD_REPOSITORY_STRING;
- size_t Pos = S.find("lld/");
- if (Pos != StringRef::npos)
- return S.substr(Pos + 4);
- return S;
-}
-
-// Returns an SVN repository name, e.g., " (trunk 284614)"
-// or an empty string if no repository info is available.
-static std::string getRepository() {
- std::string Repo = getRepositoryPath();
- std::string Rev = LLD_REVISION_STRING;
-
- if (Repo.empty() && Rev.empty())
- return "";
- if (!Repo.empty() && !Rev.empty())
- return " (" + Repo + " " + Rev + ")";
- return " (" + Repo + Rev + ")";
-}
-
-// Returns a version string, e.g., "LLD 4.0 (lld/trunk 284614)".
-std::string lld::getLLDVersion() {
- return "LLD " + std::string(LLD_VERSION_STRING) + getRepository();
-}
diff --git a/lib/Core/CMakeLists.txt b/lib/Core/CMakeLists.txt
index 85046b93f34f7..2d4d9ded08862 100644
--- a/lib/Core/CMakeLists.txt
+++ b/lib/Core/CMakeLists.txt
@@ -8,10 +8,8 @@ add_lld_library(lldCore
File.cpp
LinkingContext.cpp
Reader.cpp
- Reproduce.cpp
Resolver.cpp
SymbolTable.cpp
- TargetOptionsCommandFlags.cpp
Writer.cpp
ADDITIONAL_HEADER_DIRS
diff --git a/lib/Core/Reproduce.cpp b/lib/Core/Reproduce.cpp
deleted file mode 100644
index e3629a93cbe39..0000000000000
--- a/lib/Core/Reproduce.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//===- Reproduce.cpp - Utilities for creating reproducers -----------------===//
-//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lld/Core/Reproduce.h"
-#include "llvm/Option/Arg.h"
-#include "llvm/Support/Error.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Path.h"
-
-using namespace lld;
-using namespace llvm;
-using namespace llvm::sys;
-
-// Makes a given pathname an absolute path first, and then remove
-// beginning /. For example, "../foo.o" is converted to "home/john/foo.o",
-// assuming that the current directory is "/home/john/bar".
-// Returned string is a forward slash separated path even on Windows to avoid
-// a mess with backslash-as-escape and backslash-as-path-separator.
-std::string lld::relativeToRoot(StringRef Path) {
- SmallString<128> Abs = Path;
- if (fs::make_absolute(Abs))
- return Path;
- path::remove_dots(Abs, /*remove_dot_dot=*/true);
-
- // This is Windows specific. root_name() returns a drive letter
- // (e.g. "c:") or a UNC name (//net). We want to keep it as part
- // of the result.
- SmallString<128> Res;
- StringRef Root = path::root_name(Abs);
- if (Root.endswith(":"))
- Res = Root.drop_back();
- else if (Root.startswith("//"))
- Res = Root.substr(2);
-
- path::append(Res, path::relative_path(Abs));
- return path::convert_to_slash(Res);
-}
-
-// Quote a given string if it contains a space character.
-std::string lld::quote(StringRef S) {
- if (S.find(' ') == StringRef::npos)
- return S;
- return ("\"" + S + "\"").str();
-}
-
-std::string lld::rewritePath(StringRef S) {
- if (fs::exists(S))
- return relativeToRoot(S);
- return S;
-}
-
-std::string lld::toString(opt::Arg *Arg) {
- std::string K = Arg->getSpelling();
- if (Arg->getNumValues() == 0)
- return K;
- std::string V = quote(Arg->getValue());
- if (Arg->getOption().getRenderStyle() == opt::Option::RenderJoinedStyle)
- return K + V;
- return K + " " + V;
-}
diff --git a/lib/Core/Resolver.cpp b/lib/Core/Resolver.cpp
index e7cfaaac7835b..9c51c6cdb19c1 100644
--- a/lib/Core/Resolver.cpp
+++ b/lib/Core/Resolver.cpp
@@ -7,13 +7,13 @@
//
//===----------------------------------------------------------------------===//
-#include "lld/Core/Atom.h"
+#include "lld/Core/Resolver.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/ArchiveLibraryFile.h"
+#include "lld/Core/Atom.h"
#include "lld/Core/File.h"
#include "lld/Core/Instrumentation.h"
-#include "lld/Core/LLVM.h"
#include "lld/Core/LinkingContext.h"
-#include "lld/Core/Resolver.h"
#include "lld/Core/SharedLibraryFile.h"
#include "lld/Core/SymbolTable.h"
#include "lld/Core/UndefinedAtom.h"
diff --git a/lib/Core/SymbolTable.cpp b/lib/Core/SymbolTable.cpp
index 583c65acb5d38..51ae8d17181dd 100644
--- a/lib/Core/SymbolTable.cpp
+++ b/lib/Core/SymbolTable.cpp
@@ -8,11 +8,11 @@
//===----------------------------------------------------------------------===//
#include "lld/Core/SymbolTable.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/AbsoluteAtom.h"
#include "lld/Core/Atom.h"
#include "lld/Core/DefinedAtom.h"
#include "lld/Core/File.h"
-#include "lld/Core/LLVM.h"
#include "lld/Core/LinkingContext.h"
#include "lld/Core/Resolver.h"
#include "lld/Core/SharedLibraryAtom.h"
diff --git a/lib/Core/TargetOptionsCommandFlags.cpp b/lib/Core/TargetOptionsCommandFlags.cpp
deleted file mode 100644
index e0f26761e705d..0000000000000
--- a/lib/Core/TargetOptionsCommandFlags.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//===-- TargetOptionsCommandFlags.cpp ---------------------------*- C++ -*-===//
-//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file exists as a place for global variables defined in LLVM's
-// CodeGen/CommandFlags.h. By putting the resulting object file in
-// an archive and linking with it, the definitions will automatically be
-// included when needed and skipped when already present.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lld/Core/TargetOptionsCommandFlags.h"
-
-#include "llvm/CodeGen/CommandFlags.h"
-#include "llvm/Target/TargetOptions.h"
-
-// Define an externally visible version of
-// InitTargetOptionsFromCodeGenFlags, so that its functionality can be
-// used without having to include llvm/CodeGen/CommandFlags.h, which
-// would lead to multiple definitions of the command line flags.
-llvm::TargetOptions lld::InitTargetOptionsFromCodeGenFlags() {
- return ::InitTargetOptionsFromCodeGenFlags();
-}
-
-llvm::CodeModel::Model lld::GetCodeModelFromCMModel() {
- return CMModel;
-}
diff --git a/lib/Driver/CMakeLists.txt b/lib/Driver/CMakeLists.txt
index be75872869e6e..097a8177ea1fe 100644
--- a/lib/Driver/CMakeLists.txt
+++ b/lib/Driver/CMakeLists.txt
@@ -9,14 +9,12 @@ add_lld_library(lldDriver
${LLD_INCLUDE_DIR}/lld/Driver
LINK_COMPONENTS
- Object
Option
Support
LINK_LIBS
- lldConfig
- lldMachO
lldCore
+ lldMachO
lldReaderWriter
lldYAML
)
diff --git a/lib/Driver/DarwinLdDriver.cpp b/lib/Driver/DarwinLdDriver.cpp
index f564d8cb8d7e9..a019e9c328006 100644
--- a/lib/Driver/DarwinLdDriver.cpp
+++ b/lib/Driver/DarwinLdDriver.cpp
@@ -13,11 +13,11 @@
///
//===----------------------------------------------------------------------===//
+#include "lld/Common/LLVM.h"
#include "lld/Core/ArchiveLibraryFile.h"
#include "lld/Core/Error.h"
#include "lld/Core/File.h"
#include "lld/Core/Instrumentation.h"
-#include "lld/Core/LLVM.h"
#include "lld/Core/LinkingContext.h"
#include "lld/Core/Node.h"
#include "lld/Core/PassManager.h"
@@ -74,7 +74,7 @@ enum {
#undef PREFIX
// Create table mapping all options defined in DarwinLdOptions.td
-static const llvm::opt::OptTable::Info infoTable[] = {
+static const llvm::opt::OptTable::Info InfoTable[] = {
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
HELPTEXT, METAVAR, VALUES) \
{PREFIX, NAME, HELPTEXT, \
@@ -88,7 +88,7 @@ static const llvm::opt::OptTable::Info infoTable[] = {
// Create OptTable class for parsing actual command line arguments
class DarwinLdOptTable : public llvm::opt::OptTable {
public:
- DarwinLdOptTable() : OptTable(infoTable) {}
+ DarwinLdOptTable() : OptTable(InfoTable) {}
};
static std::vector<std::unique_ptr<File>>
diff --git a/lib/ReaderWriter/CMakeLists.txt b/lib/ReaderWriter/CMakeLists.txt
index 8751d569b7543..bedb836d2c1e4 100644
--- a/lib/ReaderWriter/CMakeLists.txt
+++ b/lib/ReaderWriter/CMakeLists.txt
@@ -17,5 +17,4 @@ add_lld_library(lldReaderWriter
LINK_LIBS
lldCore
- lldYAML
)
diff --git a/lib/ReaderWriter/FileArchive.cpp b/lib/ReaderWriter/FileArchive.cpp
index 762d0871db063..04c0bee769890 100644
--- a/lib/ReaderWriter/FileArchive.cpp
+++ b/lib/ReaderWriter/FileArchive.cpp
@@ -7,9 +7,9 @@
//
//===----------------------------------------------------------------------===//
+#include "lld/Common/LLVM.h"
#include "lld/Core/ArchiveLibraryFile.h"
#include "lld/Core/File.h"
-#include "lld/Core/LLVM.h"
#include "lld/Core/Reader.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
diff --git a/lib/ReaderWriter/MachO/ArchHandler.h b/lib/ReaderWriter/MachO/ArchHandler.h
index 6028006ca9d9c..80840b561701c 100644
--- a/lib/ReaderWriter/MachO/ArchHandler.h
+++ b/lib/ReaderWriter/MachO/ArchHandler.h
@@ -13,7 +13,7 @@
#include "Atoms.h"
#include "File.h"
#include "MachONormalizedFile.h"
-#include "lld/Core/LLVM.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/Error.h"
#include "lld/Core/Reference.h"
#include "lld/Core/Simple.h"
diff --git a/lib/ReaderWriter/MachO/CMakeLists.txt b/lib/ReaderWriter/MachO/CMakeLists.txt
index 5a96d87f1f7a1..f2fc34772496c 100644
--- a/lib/ReaderWriter/MachO/CMakeLists.txt
+++ b/lib/ReaderWriter/MachO/CMakeLists.txt
@@ -21,9 +21,9 @@ add_lld_library(lldMachO
LINK_COMPONENTS
DebugInfoDWARF
+ Demangle
Object
Support
- Demangle
LINK_LIBS
lldCore
diff --git a/lib/ReaderWriter/MachO/CompactUnwindPass.cpp b/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
index 49d518456a459..1e210409237f8 100644
--- a/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
+++ b/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
@@ -17,9 +17,9 @@
#include "File.h"
#include "MachONormalizedFileBinaryUtils.h"
#include "MachOPasses.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/DefinedAtom.h"
#include "lld/Core/File.h"
-#include "lld/Core/LLVM.h"
#include "lld/Core/Reference.h"
#include "lld/Core/Simple.h"
#include "llvm/ADT/DenseMap.h"
diff --git a/lib/ReaderWriter/MachO/FlatNamespaceFile.h b/lib/ReaderWriter/MachO/FlatNamespaceFile.h
index 76d295841c9dc..7ccd4f19f834c 100644
--- a/lib/ReaderWriter/MachO/FlatNamespaceFile.h
+++ b/lib/ReaderWriter/MachO/FlatNamespaceFile.h
@@ -10,7 +10,9 @@
#ifndef LLD_READER_WRITER_MACHO_FLAT_NAMESPACE_FILE_H
#define LLD_READER_WRITER_MACHO_FLAT_NAMESPACE_FILE_H
+#include "Atoms.h"
#include "lld/Core/SharedLibraryFile.h"
+#include "lld/ReaderWriter/MachOLinkingContext.h"
#include "llvm/Support/Debug.h"
namespace lld {
diff --git a/lib/ReaderWriter/MachO/GOTPass.cpp b/lib/ReaderWriter/MachO/GOTPass.cpp
index 8458a1c79282a..49e6f88d4aa43 100644
--- a/lib/ReaderWriter/MachO/GOTPass.cpp
+++ b/lib/ReaderWriter/MachO/GOTPass.cpp
@@ -35,9 +35,9 @@
#include "ArchHandler.h"
#include "File.h"
#include "MachOPasses.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/DefinedAtom.h"
#include "lld/Core/File.h"
-#include "lld/Core/LLVM.h"
#include "lld/Core/Reference.h"
#include "lld/Core/Simple.h"
#include "llvm/ADT/DenseMap.h"
diff --git a/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
index 7e7b559b150ab..4ef7a62a8297d 100644
--- a/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
+++ b/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
@@ -14,11 +14,11 @@
#include "MachONormalizedFile.h"
#include "MachOPasses.h"
#include "SectCreateFile.h"
+#include "lld/Common/Driver.h"
#include "lld/Core/ArchiveLibraryFile.h"
#include "lld/Core/PassManager.h"
#include "lld/Core/Reader.h"
#include "lld/Core/Writer.h"
-#include "lld/Driver/Driver.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Triple.h"
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFile.h b/lib/ReaderWriter/MachO/MachONormalizedFile.h
index 31b24dfd10251..7eeb8adbd84f9 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFile.h
+++ b/lib/ReaderWriter/MachO/MachONormalizedFile.h
@@ -43,8 +43,8 @@
#define LLD_READER_WRITER_MACHO_NORMALIZE_FILE_H
#include "DebugInfo.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/Error.h"
-#include "lld/Core/LLVM.h"
#include "lld/ReaderWriter/MachOLinkingContext.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
@@ -124,15 +124,6 @@ struct Section {
ArrayRef<uint8_t> content;
Relocations relocations;
IndirectSymbols indirectSymbols;
-
-#ifndef NDEBUG
- raw_ostream& operator<<(raw_ostream &OS) const {
- dump(OS);
- return OS;
- }
-
- void dump(raw_ostream &OS = llvm::dbgs()) const;
-#endif
};
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
index b54054726dfe2..7c2e833c090f9 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
@@ -24,8 +24,8 @@
#include "ArchHandler.h"
#include "MachONormalizedFile.h"
#include "MachONormalizedFileBinaryUtils.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/Error.h"
-#include "lld/Core/LLVM.h"
#include "lld/Core/SharedLibraryFile.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
@@ -511,7 +511,8 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb,
const uint8_t *trieStart = reinterpret_cast<const uint8_t *>(
start + read32(&dyldInfo->export_off, isBig));
ArrayRef<uint8_t> trie(trieStart, read32(&dyldInfo->export_size, isBig));
- for (const ExportEntry &trieExport : MachOObjectFile::exports(trie)) {
+ Error Err = Error::success();
+ for (const ExportEntry &trieExport : MachOObjectFile::exports(Err, trie)) {
Export normExport;
normExport.name = trieExport.name().copy(f->ownedAllocations);
normExport.offset = trieExport.address();
@@ -522,6 +523,8 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb,
normExport.otherName = trieExport.otherName().copy(f->ownedAllocations);
f->exportInfo.push_back(normExport);
}
+ if (Err)
+ return std::move(Err);
}
}
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
index b38f7059228fd..407bd9b970205 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
@@ -11,8 +11,8 @@
#define LLD_READER_WRITER_MACHO_NORMALIZED_FILE_BINARY_UTILS_H
#include "MachONormalizedFile.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/Error.h"
-#include "lld/Core/LLVM.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Support/Casting.h"
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
index bac41d2a52bfb..7ef0237e8c36c 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
@@ -23,8 +23,8 @@
#include "MachONormalizedFile.h"
#include "MachONormalizedFileBinaryUtils.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/Error.h"
-#include "lld/Core/LLVM.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
@@ -1523,10 +1523,10 @@ llvm::Error MachOFileLayout::writeBinary(StringRef path) {
unsigned flags = 0;
if (_file.fileType != llvm::MachO::MH_OBJECT)
flags = llvm::FileOutputBuffer::F_executable;
- ErrorOr<std::unique_ptr<llvm::FileOutputBuffer>> fobOrErr =
+ Expected<std::unique_ptr<llvm::FileOutputBuffer>> fobOrErr =
llvm::FileOutputBuffer::create(path, size(), flags);
- if (std::error_code ec = fobOrErr.getError())
- return llvm::errorCodeToError(ec);
+ if (Error E = fobOrErr.takeError())
+ return E;
std::unique_ptr<llvm::FileOutputBuffer> &fob = *fobOrErr;
// Write content.
_buffer = fob->getBufferStart();
@@ -1535,7 +1535,8 @@ llvm::Error MachOFileLayout::writeBinary(StringRef path) {
return ec;
writeSectionContent();
writeLinkEditContent();
- fob->commit();
+ if (Error E = fob->commit())
+ return E;
return llvm::Error::success();
}
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp b/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
index f2e5ed7816788..e93ca86c3164a 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
@@ -24,8 +24,8 @@
#include "DebugInfo.h"
#include "MachONormalizedFile.h"
#include "MachONormalizedFileBinaryUtils.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/Error.h"
-#include "lld/Core/LLVM.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/BinaryFormat/MachO.h"
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
index 226a25d3c1ed9..3b07a40f9bf2d 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
@@ -25,8 +25,8 @@
#include "File.h"
#include "MachONormalizedFile.h"
#include "MachONormalizedFileBinaryUtils.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/Error.h"
-#include "lld/Core/LLVM.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp b/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
index 5233e42e5fc5d..92a646dab5e03 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
@@ -16,8 +16,8 @@
/// +------------+ +------+
#include "MachONormalizedFile.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/Error.h"
-#include "lld/Core/LLVM.h"
#include "lld/ReaderWriter/YamlContext.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
@@ -257,7 +257,7 @@ template <> struct ScalarTraits<SectionAlignment> {
return StringRef(); // returning empty string means success
}
- static bool mustQuote(StringRef) { return false; }
+ static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template <>
@@ -522,7 +522,7 @@ struct ScalarTraits<VMProtect> {
// Return the empty string on success,
return StringRef();
}
- static bool mustQuote(StringRef) { return false; }
+ static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
@@ -706,7 +706,7 @@ struct ScalarTraits<PackedVersion> {
// Return the empty string on success,
return StringRef();
}
- static bool mustQuote(StringRef) { return false; }
+ static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template <>
diff --git a/lib/ReaderWriter/MachO/ObjCPass.cpp b/lib/ReaderWriter/MachO/ObjCPass.cpp
index ccea081f053dc..23c71e0f5ecd9 100644
--- a/lib/ReaderWriter/MachO/ObjCPass.cpp
+++ b/lib/ReaderWriter/MachO/ObjCPass.cpp
@@ -13,9 +13,9 @@
#include "File.h"
#include "MachONormalizedFileBinaryUtils.h"
#include "MachOPasses.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/DefinedAtom.h"
#include "lld/Core/File.h"
-#include "lld/Core/LLVM.h"
#include "lld/Core/Reference.h"
#include "lld/Core/Simple.h"
#include "lld/ReaderWriter/MachOLinkingContext.h"
diff --git a/lib/ReaderWriter/MachO/ShimPass.cpp b/lib/ReaderWriter/MachO/ShimPass.cpp
index ff559d70eabe7..8a2d2e910cad8 100644
--- a/lib/ReaderWriter/MachO/ShimPass.cpp
+++ b/lib/ReaderWriter/MachO/ShimPass.cpp
@@ -26,9 +26,9 @@
#include "ArchHandler.h"
#include "File.h"
#include "MachOPasses.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/DefinedAtom.h"
#include "lld/Core/File.h"
-#include "lld/Core/LLVM.h"
#include "lld/Core/Reference.h"
#include "lld/Core/Simple.h"
#include "lld/ReaderWriter/MachOLinkingContext.h"
diff --git a/lib/ReaderWriter/MachO/StubsPass.cpp b/lib/ReaderWriter/MachO/StubsPass.cpp
index 19e2bc592f5c1..04c586df336c7 100644
--- a/lib/ReaderWriter/MachO/StubsPass.cpp
+++ b/lib/ReaderWriter/MachO/StubsPass.cpp
@@ -17,9 +17,9 @@
#include "ArchHandler.h"
#include "File.h"
#include "MachOPasses.h"
+#include "lld/Common/LLVM.h"
#include "lld/Core/DefinedAtom.h"
#include "lld/Core/File.h"
-#include "lld/Core/LLVM.h"
#include "lld/Core/Reference.h"
#include "lld/Core/Simple.h"
#include "lld/ReaderWriter/MachOLinkingContext.h"
diff --git a/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp b/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
index 4c88eb1d14762..59548684e6777 100644
--- a/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
+++ b/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
@@ -280,7 +280,7 @@ template <> struct ScalarTraits<RefKind> {
return StringRef("unknown reference kind");
}
- static bool mustQuote(StringRef) { return false; }
+ static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template <> struct ScalarEnumerationTraits<lld::File::Kind> {
@@ -495,7 +495,7 @@ template <> struct ScalarTraits<lld::DefinedAtom::Alignment> {
return StringRef(); // returning empty string means success
}
- static bool mustQuote(StringRef) { return false; }
+ static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
template <> struct ScalarEnumerationTraits<FileKinds> {
@@ -552,7 +552,7 @@ template <> struct ScalarTraits<ImplicitHex8> {
return StringRef(); // returning empty string means success
}
- static bool mustQuote(StringRef) { return false; }
+ static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
// YAML conversion for std::vector<const lld::File*>