LLDB mainline
StopCondition.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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 LLDB_BREAKPOINT_STOPCONDITION_H
10#define LLDB_BREAKPOINT_STOPCONDITION_H
11
12#include "lldb/lldb-private.h"
13#include "llvm/ADT/StringRef.h"
14
15namespace lldb_private {
16
18public:
19 StopCondition() = default;
20 StopCondition(std::string text,
22 : m_language(language) {
23 SetText(std::move(text));
24 }
25
26 explicit operator bool() const { return !m_text.empty(); }
27
28 llvm::StringRef GetText() const { return m_text; }
29
30 void SetText(std::string text) {
31 static std::hash<std::string> hasher;
32 m_text = std::move(text);
33 m_hash = hasher(text);
34 }
35
36 size_t GetHash() const { return m_hash; }
37
39
40 void SetLanguage(lldb::LanguageType language) { m_language = language; }
41
42private:
43 /// The condition to test.
44 std::string m_text;
45
46 /// Its hash, so that locations know when the condition is updated.
47 size_t m_hash = 0;
48
49 /// The language for this condition.
51};
52
53} // namespace lldb_private
54
55#endif // LLDB_BREAKPOINT_STOPCONDITION_H
lldb::LanguageType GetLanguage() const
size_t m_hash
Its hash, so that locations know when the condition is updated.
StopCondition(std::string text, lldb::LanguageType language=lldb::eLanguageTypeUnknown)
std::string m_text
The condition to test.
lldb::LanguageType m_language
The language for this condition.
void SetLanguage(lldb::LanguageType language)
void SetText(std::string text)
llvm::StringRef GetText() const
A class that represents a running process on the host machine.
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.