]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lld/include/lld/Common/Strings.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lld / include / lld / Common / Strings.h
1 //===- Strings.h ------------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLD_STRINGS_H
10 #define LLD_STRINGS_H
11
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Support/GlobPattern.h"
16 #include <string>
17 #include <vector>
18
19 namespace lld {
20 // Returns a demangled C++ symbol name. If Name is not a mangled
21 // name, it returns name.
22 std::string demangleItanium(llvm::StringRef name);
23
24 std::vector<uint8_t> parseHex(llvm::StringRef s);
25 bool isValidCIdentifier(llvm::StringRef s);
26
27 // Write the contents of the a buffer to a file
28 void saveBuffer(llvm::StringRef buffer, const llvm::Twine &path);
29
30 // This class represents multiple glob patterns.
31 class StringMatcher {
32 public:
33   StringMatcher() = default;
34   explicit StringMatcher(llvm::ArrayRef<llvm::StringRef> pat);
35
36   bool match(llvm::StringRef s) const;
37
38 private:
39   std::vector<llvm::GlobPattern> patterns;
40 };
41
42 } // namespace lld
43
44 #endif