Strings.h revision 360784
167754Smsmith//===- Strings.h ------------------------------------------------*- C++ -*-===// 267754Smsmith// 367754Smsmith// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 477424Smsmith// See https://llvm.org/LICENSE.txt for license information. 577424Smsmith// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 677424Smsmith// 767754Smsmith//===----------------------------------------------------------------------===// 867754Smsmith 967754Smsmith#ifndef LLD_STRINGS_H 1067754Smsmith#define LLD_STRINGS_H 1167754Smsmith 1267754Smsmith#include "llvm/ADT/ArrayRef.h" 1367754Smsmith#include "llvm/ADT/Optional.h" 1467754Smsmith#include "llvm/ADT/StringRef.h" 1591116Smsmith#include "llvm/Support/GlobPattern.h" 1670243Smsmith#include <string> 1767754Smsmith#include <vector> 1867754Smsmith 1967754Smsmithnamespace lld { 2067754Smsmith// Returns a demangled C++ symbol name. If Name is not a mangled 2167754Smsmith// name, it returns name. 2267754Smsmithstd::string demangleItanium(llvm::StringRef name); 2367754Smsmith 2467754Smsmithstd::vector<uint8_t> parseHex(llvm::StringRef s); 2567754Smsmithbool isValidCIdentifier(llvm::StringRef s); 2667754Smsmith 2767754Smsmith// Write the contents of the a buffer to a file 2867754Smsmithvoid saveBuffer(llvm::StringRef buffer, const llvm::Twine &path); 2967754Smsmith 3067754Smsmith// This class represents multiple glob patterns. 3167754Smsmithclass StringMatcher { 3267754Smsmithpublic: 3367754Smsmith StringMatcher() = default; 3467754Smsmith explicit StringMatcher(llvm::ArrayRef<llvm::StringRef> pat); 3567754Smsmith 3685756Smsmith bool match(llvm::StringRef s) const; 3785756Smsmith 3867754Smsmithprivate: 3967754Smsmith std::vector<llvm::GlobPattern> patterns; 4067754Smsmith}; 4167754Smsmith 4267754Smsmith} // namespace lld 4367754Smsmith 4467754Smsmith#endif 4567754Smsmith