Path: blob/main/contrib/llvm-project/lldb/source/Utility/NameMatches.cpp
39587 views
//===-- NameMatches.cpp ---------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7#include "lldb/Utility/NameMatches.h"8#include "lldb/Utility/RegularExpression.h"910#include "llvm/ADT/StringRef.h"1112using namespace lldb_private;1314bool lldb_private::NameMatches(llvm::StringRef name, NameMatch match_type,15llvm::StringRef match) {16switch (match_type) {17case NameMatch::Ignore:18return true;19case NameMatch::Equals:20return name == match;21case NameMatch::Contains:22return name.contains(match);23case NameMatch::StartsWith:24return name.starts_with(match);25case NameMatch::EndsWith:26return name.ends_with(match);27case NameMatch::RegularExpression: {28RegularExpression regex(match);29return regex.Execute(name);30}31}32return false;33}343536