aboutsummaryrefslogtreecommitdiffstats
path: root/include/lld/Common/Strings.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 11:08:33 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 11:08:33 +0000
commit20d35e67e67f106f617c939725101223211659f0 (patch)
tree64eb963cbf5ba58765e0a6b64a440965d66a7a4d /include/lld/Common/Strings.h
parentae1a339de31cf4065777531959a11e55a2e5fa00 (diff)
downloadsrc-20d35e67e67f106f617c939725101223211659f0.tar.gz
src-20d35e67e67f106f617c939725101223211659f0.zip
Vendor import of lld trunk r338150:vendor/lld/lld-trunk-r338150
Notes
Notes: svn path=/vendor/lld/dist/; revision=336821 svn path=/vendor/lld/lld-trunk-r338150/; revision=336822; tag=vendor/lld/lld-trunk-r338150
Diffstat (limited to 'include/lld/Common/Strings.h')
-rw-r--r--include/lld/Common/Strings.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/lld/Common/Strings.h b/include/lld/Common/Strings.h
index 1a63f75f9ecf..e17b25763781 100644
--- a/include/lld/Common/Strings.h
+++ b/include/lld/Common/Strings.h
@@ -10,14 +10,40 @@
#ifndef LLD_STRINGS_H
#define LLD_STRINGS_H
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/GlobPattern.h"
#include <string>
+#include <vector>
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);
+
+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:
+ StringMatcher() = default;
+ explicit StringMatcher(llvm::ArrayRef<llvm::StringRef> Pat);
+
+ bool match(llvm::StringRef S) const;
+
+private:
+ std::vector<llvm::GlobPattern> Patterns;
+};
+
+inline llvm::ArrayRef<uint8_t> toArrayRef(llvm::StringRef S) {
+ return {reinterpret_cast<const uint8_t *>(S.data()), S.size()};
}
+} // namespace lld
#endif