Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 1 | //===-- ExpressionSourceCode.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 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 9 | #ifndef LLDB_EXPRESSION_EXPRESSIONSOURCECODE_H |
| 10 | #define LLDB_EXPRESSION_EXPRESSIONSOURCECODE_H |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 11 | |
| 12 | #include "lldb/lldb-enumerations.h" |
| 13 | #include "llvm/ADT/ArrayRef.h" |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 14 | #include "llvm/ADT/StringRef.h" |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 15 | |
| 16 | #include <string> |
| 17 | |
| 18 | namespace lldb_private { |
| 19 | |
| 20 | class ExpressionSourceCode { |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 21 | protected: |
| 22 | enum Wrapping : bool { |
| 23 | Wrap = true, |
| 24 | NoWrap = false, |
| 25 | }; |
| 26 | |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 27 | public: |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 28 | bool NeedsWrapping() const { return m_wrap == Wrap; } |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 29 | |
| 30 | const char *GetName() const { return m_name.c_str(); } |
| 31 | |
| 32 | protected: |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 33 | ExpressionSourceCode(llvm::StringRef name, llvm::StringRef prefix, |
| 34 | llvm::StringRef body, Wrapping wrap) |
| 35 | : m_name(name.str()), m_prefix(prefix.str()), m_body(body.str()), |
| 36 | m_wrap(wrap) {} |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 37 | |
| 38 | std::string m_name; |
| 39 | std::string m_prefix; |
| 40 | std::string m_body; |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 41 | Wrapping m_wrap; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | } // namespace lldb_private |
| 45 | |
| 46 | #endif |