[Lldb-commits] [lldb] r368082 - [lldb][NFC] Minor refactorings to (Clang)ExpressionSourceCode
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 6 13:25:02 PDT 2019
Author: teemperor
Date: Tue Aug 6 13:25:02 2019
New Revision: 368082
URL: http://llvm.org/viewvc/llvm-project?rev=368082&view=rev
Log:
[lldb][NFC] Minor refactorings to (Clang)ExpressionSourceCode
Modified:
lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h
Modified: lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h?rev=368082&r1=368081&r2=368082&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h (original)
+++ lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h Tue Aug 6 13:25:02 2019
@@ -17,20 +17,27 @@
namespace lldb_private {
class ExpressionSourceCode {
+protected:
+ enum Wrapping : bool {
+ Wrap = true,
+ NoWrap = false,
+ };
+
public:
- bool NeedsWrapping() const { return m_wrap; }
+ bool NeedsWrapping() const { return m_wrap == Wrap; }
const char *GetName() const { return m_name.c_str(); }
protected:
- ExpressionSourceCode(const char *name, const char *prefix, const char *body,
- bool wrap)
- : m_name(name), m_prefix(prefix), m_body(body), m_wrap(wrap) {}
+ ExpressionSourceCode(llvm::StringRef name, llvm::StringRef prefix,
+ llvm::StringRef body, Wrapping wrap)
+ : m_name(name.str()), m_prefix(prefix.str()), m_body(body.str()),
+ m_wrap(wrap) {}
std::string m_name;
std::string m_prefix;
std::string m_body;
- bool m_wrap;
+ Wrapping m_wrap;
};
} // namespace lldb_private
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h?rev=368082&r1=368081&r2=368082&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h Tue Aug 6 13:25:02 2019
@@ -25,9 +25,9 @@ class ClangExpressionSourceCode : public
public:
static const char *g_expression_prefix;
- static ClangExpressionSourceCode *CreateWrapped(const char *prefix,
- const char *body) {
- return new ClangExpressionSourceCode("$__lldb_expr", prefix, body, true);
+ static ClangExpressionSourceCode *CreateWrapped(llvm::StringRef prefix,
+ llvm::StringRef body) {
+ return new ClangExpressionSourceCode("$__lldb_expr", prefix, body, Wrap);
}
/// Generates the source code that will evaluate the expression.
@@ -59,9 +59,9 @@ public:
size_t &start_loc, size_t &end_loc);
protected:
- ClangExpressionSourceCode(const char *name, const char *prefix, const char *body,
- bool wrap) :
- ExpressionSourceCode(name, prefix, body, wrap) {}
+ ClangExpressionSourceCode(llvm::StringRef name, llvm::StringRef prefix,
+ llvm::StringRef body, Wrapping wrap)
+ : ExpressionSourceCode(name, prefix, body, wrap) {}
};
} // namespace lldb_private
More information about the lldb-commits
mailing list