Coverage Report

Created: 2022-01-15 10:30

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Interpreter/OptionValueRegex.h
Line
Count
Source (jump to first uncovered line)
1
//===-- OptionValueRegex.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 LLDB_INTERPRETER_OPTIONVALUEREGEX_H
10
#define LLDB_INTERPRETER_OPTIONVALUEREGEX_H
11
12
#include "lldb/Interpreter/OptionValue.h"
13
#include "lldb/Utility/RegularExpression.h"
14
15
namespace lldb_private {
16
17
class OptionValueRegex : public Cloneable<OptionValueRegex, OptionValue> {
18
public:
19
  OptionValueRegex(const char *value = nullptr)
20
3.40k
      : m_regex(value), m_default_regex_str(value) {}
21
22
0
  ~OptionValueRegex() override = default;
23
24
  // Virtual subclass pure virtual overrides
25
26
291
  OptionValue::Type GetType() const override { return eTypeRegex; }
27
28
  void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
29
                 uint32_t dump_mask) override;
30
31
  Status
32
  SetValueFromString(llvm::StringRef value,
33
                     VarSetOperationType op = eVarSetOperationAssign) override;
34
35
3.39k
  void Clear() override {
36
3.39k
    m_regex = RegularExpression(m_default_regex_str);
37
3.39k
    m_value_was_set = false;
38
3.39k
  }
39
40
  // Subclass specific functions
41
258
  const RegularExpression *GetCurrentValue() const {
42
258
    return (m_regex.IsValid() ? &m_regex : 
nullptr0
);
43
258
  }
44
45
0
  void SetCurrentValue(const char *value) {
46
0
    if (value && value[0])
47
0
      m_regex = RegularExpression(llvm::StringRef(value));
48
0
    else
49
0
      m_regex = RegularExpression();
50
0
  }
51
52
0
  bool IsValid() const { return m_regex.IsValid(); }
53
54
protected:
55
  RegularExpression m_regex;
56
  std::string m_default_regex_str;
57
};
58
59
} // namespace lldb_private
60
61
#endif // LLDB_INTERPRETER_OPTIONVALUEREGEX_H