xref: /freebsd/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionSourceCode.h (revision 9dba64be9536c28e4800e06512b7f29b43ade345)
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 
9 #ifndef liblldb_ExpressionSourceCode_h
10 #define liblldb_ExpressionSourceCode_h
11 
12 #include "lldb/lldb-enumerations.h"
13 #include "llvm/ADT/ArrayRef.h"
14 
15 #include <string>
16 
17 namespace lldb_private {
18 
19 class ExpressionSourceCode {
20 protected:
21   enum Wrapping : bool {
22     Wrap = true,
23     NoWrap = false,
24   };
25 
26 public:
27   bool NeedsWrapping() const { return m_wrap == Wrap; }
28 
29   const char *GetName() const { return m_name.c_str(); }
30 
31 protected:
32   ExpressionSourceCode(llvm::StringRef name, llvm::StringRef prefix,
33                        llvm::StringRef body, Wrapping wrap)
34       : m_name(name.str()), m_prefix(prefix.str()), m_body(body.str()),
35         m_wrap(wrap) {}
36 
37   std::string m_name;
38   std::string m_prefix;
39   std::string m_body;
40   Wrapping m_wrap;
41 };
42 
43 } // namespace lldb_private
44 
45 #endif
46