aboutsummaryrefslogtreecommitdiffstats
path: root/include/lld
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:52:45 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:52:45 +0000
commitd2bd9e70b16db88a7808ee2280b0a107afbfdd3b (patch)
tree12612d2c593445b297ac656911c9db7cf9065bdd /include/lld
parentf1e1c239e31b467e17f1648b1f524fc9ab5b431a (diff)
downloadsrc-d2bd9e70b16db88a7808ee2280b0a107afbfdd3b.tar.gz
src-d2bd9e70b16db88a7808ee2280b0a107afbfdd3b.zip
Vendor import of stripped lld trunk r375505, the last commit before thevendor/lld/lld-trunk-r375505vendor/lld
upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/lld/trunk@375505
Notes
Notes: svn path=/vendor/lld/dist/; revision=353950 svn path=/vendor/lld/lld-r375505/; revision=353951; tag=vendor/lld/lld-trunk-r375505
Diffstat (limited to 'include/lld')
-rw-r--r--include/lld/Common/DWARF.h47
-rw-r--r--include/lld/Common/ErrorHandler.h7
-rw-r--r--include/lld/Common/LLVM.h1
-rw-r--r--include/lld/Common/Strings.h5
-rw-r--r--include/lld/Common/TargetOptionsCommandFlags.h1
-rw-r--r--include/lld/Core/File.h1
-rw-r--r--include/lld/ReaderWriter/MachOLinkingContext.h2
7 files changed, 58 insertions, 6 deletions
diff --git a/include/lld/Common/DWARF.h b/include/lld/Common/DWARF.h
new file mode 100644
index 000000000000..f0d3d2fbda77
--- /dev/null
+++ b/include/lld/Common/DWARF.h
@@ -0,0 +1,47 @@
+//===- DWARF.h --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_DWARF_H
+#define LLD_DWARF_H
+
+#include "lld/Common/LLVM.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/DWARF/DWARFContext.h"
+#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
+#include <memory>
+#include <string>
+
+namespace llvm {
+struct DILineInfo;
+} // namespace llvm
+
+namespace lld {
+
+class DWARFCache {
+public:
+ DWARFCache(std::unique_ptr<llvm::DWARFContext> dwarf);
+ llvm::Optional<llvm::DILineInfo> getDILineInfo(uint64_t offset,
+ uint64_t sectionIndex);
+ llvm::Optional<std::pair<std::string, unsigned>>
+ getVariableLoc(StringRef name);
+
+private:
+ std::unique_ptr<llvm::DWARFContext> dwarf;
+ std::vector<const llvm::DWARFDebugLine::LineTable *> lineTables;
+ struct VarLoc {
+ const llvm::DWARFDebugLine::LineTable *lt;
+ unsigned file;
+ unsigned line;
+ };
+ llvm::DenseMap<StringRef, VarLoc> variableLoc;
+};
+
+} // namespace lld
+
+#endif
diff --git a/include/lld/Common/ErrorHandler.h b/include/lld/Common/ErrorHandler.h
index 7126a7bf410a..5086fa9862da 100644
--- a/include/lld/Common/ErrorHandler.h
+++ b/include/lld/Common/ErrorHandler.h
@@ -87,7 +87,6 @@ public:
StringRef errorLimitExceededMsg = "too many errors emitted, stopping now";
StringRef logName = "lld";
llvm::raw_ostream *errorOS = &llvm::errs();
- bool colorDiagnostics = llvm::errs().has_colors();
bool exitEarly = true;
bool fatalWarnings = false;
bool verbose = false;
@@ -102,12 +101,16 @@ public:
std::unique_ptr<llvm::FileOutputBuffer> outputBuffer;
private:
- void printHeader(StringRef s, raw_ostream::Colors c, const Twine &msg);
+ using Colors = raw_ostream::Colors;
+
+ std::string getLocation(const Twine &msg);
};
/// Returns the default error handler.
ErrorHandler &errorHandler();
+void enableColors(bool enable);
+
inline void error(const Twine &msg) { errorHandler().error(msg); }
inline LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &msg) {
errorHandler().fatal(msg);
diff --git a/include/lld/Common/LLVM.h b/include/lld/Common/LLVM.h
index f7ed1d793ca7..34b7b0d194ab 100644
--- a/include/lld/Common/LLVM.h
+++ b/include/lld/Common/LLVM.h
@@ -17,6 +17,7 @@
// This should be the only #include, force #includes of all the others on
// clients.
#include "llvm/ADT/Hashing.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
#include <utility>
diff --git a/include/lld/Common/Strings.h b/include/lld/Common/Strings.h
index ded22dd769be..9d002bf336de 100644
--- a/include/lld/Common/Strings.h
+++ b/include/lld/Common/Strings.h
@@ -18,9 +18,8 @@
namespace lld {
// Returns a demangled C++ symbol name. If Name is not a mangled
-// name, it returns Optional::None.
-llvm::Optional<std::string> demangleItanium(llvm::StringRef name);
-llvm::Optional<std::string> demangleMSVC(llvm::StringRef s);
+// name, it returns name.
+std::string demangleItanium(llvm::StringRef name);
std::vector<uint8_t> parseHex(llvm::StringRef s);
bool isValidCIdentifier(llvm::StringRef s);
diff --git a/include/lld/Common/TargetOptionsCommandFlags.h b/include/lld/Common/TargetOptionsCommandFlags.h
index 9345e616f9a9..422bb630f9fe 100644
--- a/include/lld/Common/TargetOptionsCommandFlags.h
+++ b/include/lld/Common/TargetOptionsCommandFlags.h
@@ -16,6 +16,7 @@
namespace lld {
llvm::TargetOptions initTargetOptionsFromCodeGenFlags();
+llvm::Optional<llvm::Reloc::Model> getRelocModelFromCMModel();
llvm::Optional<llvm::CodeModel::Model> getCodeModelFromCMModel();
std::string getCPUStr();
std::vector<std::string> getMAttrs();
diff --git a/include/lld/Core/File.h b/include/lld/Core/File.h
index 492f35989f16..df014669eb62 100644
--- a/include/lld/Core/File.h
+++ b/include/lld/Core/File.h
@@ -16,6 +16,7 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Allocator.h"
#include "llvm/Support/ErrorHandling.h"
#include <functional>
#include <memory>
diff --git a/include/lld/ReaderWriter/MachOLinkingContext.h b/include/lld/ReaderWriter/MachOLinkingContext.h
index f48ad77053e5..a950fd5b18e5 100644
--- a/include/lld/ReaderWriter/MachOLinkingContext.h
+++ b/include/lld/ReaderWriter/MachOLinkingContext.h
@@ -101,7 +101,7 @@ public:
auto file = std::unique_ptr<T>(new T(std::forward<Args>(args)...));
auto *filePtr = file.get();
auto *ctx = const_cast<MachOLinkingContext *>(this);
- ctx->getNodes().push_back(llvm::make_unique<FileNode>(std::move(file)));
+ ctx->getNodes().push_back(std::make_unique<FileNode>(std::move(file)));
return filePtr;
}