aboutsummaryrefslogtreecommitdiff
path: root/lld/include
diff options
context:
space:
mode:
Diffstat (limited to 'lld/include')
-rw-r--r--lld/include/lld/Common/Arrays.h32
-rw-r--r--lld/include/lld/Common/ErrorHandler.h8
-rw-r--r--lld/include/lld/Common/LLVM.h10
-rw-r--r--lld/include/lld/Common/Strings.h5
-rw-r--r--lld/include/lld/Common/TargetOptionsCommandFlags.h5
-rw-r--r--lld/include/lld/Common/Timer.h1
6 files changed, 49 insertions, 12 deletions
diff --git a/lld/include/lld/Common/Arrays.h b/lld/include/lld/Common/Arrays.h
new file mode 100644
index 000000000000..b4c25ec57ca8
--- /dev/null
+++ b/lld/include/lld/Common/Arrays.h
@@ -0,0 +1,32 @@
+//===- Arrays.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_ARRAYS_H
+#define LLD_ARRAYS_H
+
+#include "llvm/ADT/ArrayRef.h"
+
+#include <vector>
+
+namespace lld {
+// Split one uint8 array into small pieces of uint8 arrays.
+inline std::vector<llvm::ArrayRef<uint8_t>> split(llvm::ArrayRef<uint8_t> arr,
+ size_t chunkSize) {
+ std::vector<llvm::ArrayRef<uint8_t>> ret;
+ while (arr.size() > chunkSize) {
+ ret.push_back(arr.take_front(chunkSize));
+ arr = arr.drop_front(chunkSize);
+ }
+ if (!arr.empty())
+ ret.push_back(arr);
+ return ret;
+}
+
+} // namespace lld
+
+#endif
diff --git a/lld/include/lld/Common/ErrorHandler.h b/lld/include/lld/Common/ErrorHandler.h
index 44604524027d..95d92f3594ba 100644
--- a/lld/include/lld/Common/ErrorHandler.h
+++ b/lld/include/lld/Common/ErrorHandler.h
@@ -107,7 +107,7 @@ public:
void error(const Twine &msg);
void error(const Twine &msg, ErrorTag tag, ArrayRef<StringRef> args);
- LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &msg);
+ [[noreturn]] void fatal(const Twine &msg);
void log(const Twine &msg);
void message(const Twine &msg);
void warn(const Twine &msg);
@@ -133,15 +133,13 @@ inline void error(const Twine &msg) { errorHandler().error(msg); }
inline void error(const Twine &msg, ErrorTag tag, ArrayRef<StringRef> args) {
errorHandler().error(msg, tag, args);
}
-inline LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &msg) {
- errorHandler().fatal(msg);
-}
+[[noreturn]] inline void fatal(const Twine &msg) { errorHandler().fatal(msg); }
inline void log(const Twine &msg) { errorHandler().log(msg); }
inline void message(const Twine &msg) { errorHandler().message(msg); }
inline void warn(const Twine &msg) { errorHandler().warn(msg); }
inline uint64_t errorCount() { return errorHandler().errorCount; }
-LLVM_ATTRIBUTE_NORETURN void exitLld(int val);
+[[noreturn]] void exitLld(int val);
void diagnosticHandler(const llvm::DiagnosticInfo &di);
void checkError(Error e);
diff --git a/lld/include/lld/Common/LLVM.h b/lld/include/lld/Common/LLVM.h
index f6eca27b02ff..c19364ad9f6c 100644
--- a/lld/include/lld/Common/LLVM.h
+++ b/lld/include/lld/Common/LLVM.h
@@ -44,11 +44,12 @@ class WasmSymbol;
} // namespace object
namespace wasm {
-struct WasmEvent;
-struct WasmEventType;
+struct WasmTag;
+struct WasmTagType;
struct WasmFunction;
struct WasmGlobal;
struct WasmGlobalType;
+struct WasmInitExpr;
struct WasmLimits;
struct WasmRelocation;
struct WasmSignature;
@@ -86,16 +87,17 @@ using llvm::object::WasmObjectFile;
using llvm::object::WasmSection;
using llvm::object::WasmSegment;
using llvm::object::WasmSymbol;
-using llvm::wasm::WasmEvent;
-using llvm::wasm::WasmEventType;
using llvm::wasm::WasmFunction;
using llvm::wasm::WasmGlobal;
using llvm::wasm::WasmGlobalType;
+using llvm::wasm::WasmInitExpr;
using llvm::wasm::WasmLimits;
using llvm::wasm::WasmRelocation;
using llvm::wasm::WasmSignature;
using llvm::wasm::WasmTable;
using llvm::wasm::WasmTableType;
+using llvm::wasm::WasmTag;
+using llvm::wasm::WasmTagType;
} // end namespace lld.
namespace std {
diff --git a/lld/include/lld/Common/Strings.h b/lld/include/lld/Common/Strings.h
index 38d93e01c0b9..71126f615017 100644
--- a/lld/include/lld/Common/Strings.h
+++ b/lld/include/lld/Common/Strings.h
@@ -32,7 +32,7 @@ void saveBuffer(llvm::StringRef buffer, const llvm::Twine &path);
// glob pattern in the sense of GlobPattern.
class SingleStringMatcher {
public:
- // Create a StringPattern from Pattern to be matched exactly irregardless
+ // Create a StringPattern from Pattern to be matched exactly regardless
// of globbing characters if ExactMatch is true.
SingleStringMatcher(llvm::StringRef Pattern);
@@ -45,8 +45,7 @@ public:
}
private:
- // Whether to do an exact match irregardless of the presence of wildcard
- // character.
+ // Whether to do an exact match regardless of wildcard characters.
bool ExactMatch;
// GlobPattern object if not doing an exact match.
diff --git a/lld/include/lld/Common/TargetOptionsCommandFlags.h b/lld/include/lld/Common/TargetOptionsCommandFlags.h
index 422bb630f9fe..04428b500abd 100644
--- a/lld/include/lld/Common/TargetOptionsCommandFlags.h
+++ b/lld/include/lld/Common/TargetOptionsCommandFlags.h
@@ -10,6 +10,9 @@
//
//===----------------------------------------------------------------------===//
+#ifndef LLD_COMMON_TARGETOPTIONSCOMMANDFLAGS_H
+#define LLD_COMMON_TARGETOPTIONSCOMMANDFLAGS_H
+
#include "llvm/ADT/Optional.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Target/TargetOptions.h"
@@ -21,3 +24,5 @@ llvm::Optional<llvm::CodeModel::Model> getCodeModelFromCMModel();
std::string getCPUStr();
std::vector<std::string> getMAttrs();
}
+
+#endif
diff --git a/lld/include/lld/Common/Timer.h b/lld/include/lld/Common/Timer.h
index 95e811a2f9f0..b37388cd38c4 100644
--- a/lld/include/lld/Common/Timer.h
+++ b/lld/include/lld/Common/Timer.h
@@ -16,6 +16,7 @@
#include <chrono>
#include <map>
#include <memory>
+#include <vector>
namespace lld {