ExpressionSourceCode.h 1.2 KB

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