diff options
author | Sam Clegg <sbc@chromium.org> | 2018-05-22 20:20:25 +0000 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2018-05-22 20:20:25 +0000 |
commit | 3ad27e92bcd4b761a174eca003cfcad6ad36a436 (patch) | |
tree | af98612d7b081445091aa36b3de933150fcf600f /lld/include/lld | |
parent | a82ee182d4f1e98ac9aeaa1bea67d4034a54b5ae (diff) | |
download | bcm5719-llvm-3ad27e92bcd4b761a174eca003cfcad6ad36a436.tar.gz bcm5719-llvm-3ad27e92bcd4b761a174eca003cfcad6ad36a436.zip |
Code cleanup in preparation for adding LTO for wasm. NFC.
- Move some common code into Common/rrorHandler.cpp and
Common/Strings.h.
- Don't use `fatal` when incompatible bitcode files are
encountered.
- Rename NameRef variable to just Name
See D47162
Differential Revision: https://reviews.llvm.org/D47206
llvm-svn: 333021
Diffstat (limited to 'lld/include/lld')
-rw-r--r-- | lld/include/lld/Common/ErrorHandler.h | 7 | ||||
-rw-r--r-- | lld/include/lld/Common/Strings.h | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lld/include/lld/Common/ErrorHandler.h b/lld/include/lld/Common/ErrorHandler.h index 8ae6f46ac59..b6c78f1f150 100644 --- a/lld/include/lld/Common/ErrorHandler.h +++ b/lld/include/lld/Common/ErrorHandler.h @@ -34,6 +34,10 @@ #include "llvm/Support/Error.h" #include "llvm/Support/FileOutputBuffer.h" +namespace llvm { +class DiagnosticInfo; +} + namespace lld { class ErrorHandler { @@ -74,6 +78,9 @@ inline uint64_t errorCount() { return errorHandler().ErrorCount; } LLVM_ATTRIBUTE_NORETURN void exitLld(int Val); +void diagnosticHandler(const llvm::DiagnosticInfo &DI); +void checkError(Error E); + // check functions are convenient functions to strip errors // from error-or-value objects. template <class T> T check(ErrorOr<T> E) { diff --git a/lld/include/lld/Common/Strings.h b/lld/include/lld/Common/Strings.h index 177cc15449f..e17b2576378 100644 --- a/lld/include/lld/Common/Strings.h +++ b/lld/include/lld/Common/Strings.h @@ -26,6 +26,9 @@ llvm::Optional<std::string> demangleMSVC(llvm::StringRef S); std::vector<uint8_t> parseHex(llvm::StringRef S); bool isValidCIdentifier(llvm::StringRef S); +// Write the contents of the a buffer to a file +void saveBuffer(llvm::StringRef Buffer, const llvm::Twine &Path); + // This class represents multiple glob patterns. class StringMatcher { public: @@ -41,6 +44,6 @@ private: inline llvm::ArrayRef<uint8_t> toArrayRef(llvm::StringRef S) { return {reinterpret_cast<const uint8_t *>(S.data()), S.size()}; } -} +} // namespace lld #endif |