aboutsummaryrefslogtreecommitdiffstats
path: root/include/lldb/Expression
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Expression')
-rw-r--r--include/lldb/Expression/DWARFExpression.h22
-rw-r--r--include/lldb/Expression/DiagnosticManager.h40
-rw-r--r--include/lldb/Expression/ExpressionSourceCode.h17
-rw-r--r--include/lldb/Expression/LLVMUserExpression.h16
-rw-r--r--include/lldb/Expression/Materializer.h2
-rw-r--r--include/lldb/Expression/REPL.h6
6 files changed, 29 insertions, 74 deletions
diff --git a/include/lldb/Expression/DWARFExpression.h b/include/lldb/Expression/DWARFExpression.h
index 21830a562800..44015b4e418f 100644
--- a/include/lldb/Expression/DWARFExpression.h
+++ b/include/lldb/Expression/DWARFExpression.h
@@ -50,15 +50,8 @@ public:
/// \param[in] data
/// A data extractor configured to read the DWARF location expression's
/// bytecode.
- ///
- /// \param[in] data_offset
- /// The offset of the location expression in the extractor.
- ///
- /// \param[in] data_length
- /// The byte length of the location expression.
DWARFExpression(lldb::ModuleSP module, const DataExtractor &data,
- const DWARFUnit *dwarf_cu, lldb::offset_t data_offset,
- lldb::offset_t data_length);
+ const DWARFUnit *dwarf_cu);
/// Destructor
virtual ~DWARFExpression();
@@ -211,12 +204,6 @@ public:
/// in the case where an expression needs to be evaluated while building
/// the stack frame list, this short-cut is available.
///
- /// \param[in] offset
- /// The offset of the location expression in the data extractor.
- ///
- /// \param[in] length
- /// The length in bytes of the location expression.
- ///
/// \param[in] reg_set
/// The call-frame-info style register kind.
///
@@ -236,8 +223,7 @@ public:
/// details of the failure are provided through it.
static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
- const DWARFUnit *dwarf_cu, const lldb::offset_t offset,
- const lldb::offset_t length,
+ const DWARFUnit *dwarf_cu,
const lldb::RegisterKind reg_set,
const Value *initial_value_ptr,
const Value *object_address_ptr, Value &result,
@@ -252,10 +238,6 @@ public:
lldb::addr_t loclist_base_load_addr,
lldb::addr_t address, ABI *abi);
- static size_t LocationListSize(const DWARFUnit *dwarf_cu,
- const DataExtractor &debug_loc_data,
- lldb::offset_t offset);
-
static bool PrintDWARFExpression(Stream &s, const DataExtractor &data,
int address_size, int dwarf_ref_size,
bool location_expression);
diff --git a/include/lldb/Expression/DiagnosticManager.h b/include/lldb/Expression/DiagnosticManager.h
index 7e3e2bb8606a..e5aecce08727 100644
--- a/include/lldb/Expression/DiagnosticManager.h
+++ b/include/lldb/Expression/DiagnosticManager.h
@@ -12,6 +12,7 @@
#include "lldb/lldb-defines.h"
#include "lldb/lldb-types.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include <string>
@@ -23,7 +24,6 @@ enum DiagnosticOrigin {
eDiagnosticOriginUnknown = 0,
eDiagnosticOriginLLDB,
eDiagnosticOriginClang,
- eDiagnosticOriginGo,
eDiagnosticOriginSwift,
eDiagnosticOriginLLVM
};
@@ -47,7 +47,6 @@ public:
switch (kind) {
case eDiagnosticOriginUnknown:
case eDiagnosticOriginLLDB:
- case eDiagnosticOriginGo:
case eDiagnosticOriginLLVM:
return true;
case eDiagnosticOriginClang:
@@ -89,7 +88,7 @@ protected:
uint32_t m_compiler_id; // Compiler-specific diagnostic ID
};
-typedef std::vector<Diagnostic *> DiagnosticList;
+typedef std::vector<std::unique_ptr<Diagnostic>> DiagnosticList;
class DiagnosticManager {
public:
@@ -98,45 +97,33 @@ public:
m_fixed_expression.clear();
}
- // The diagnostic manager holds a list of diagnostics, which are owned by the
- // manager.
const DiagnosticList &Diagnostics() { return m_diagnostics; }
- ~DiagnosticManager() {
- for (Diagnostic *diag : m_diagnostics) {
- delete diag;
- }
- }
-
- bool HasFixIts() {
- for (Diagnostic *diag : m_diagnostics) {
- if (diag->HasFixIts())
- return true;
- }
- return false;
+ bool HasFixIts() const {
+ return llvm::any_of(m_diagnostics,
+ [](const std::unique_ptr<Diagnostic> &diag) {
+ return diag->HasFixIts();
+ });
}
void AddDiagnostic(llvm::StringRef message, DiagnosticSeverity severity,
DiagnosticOrigin origin,
uint32_t compiler_id = LLDB_INVALID_COMPILER_ID) {
- m_diagnostics.push_back(
- new Diagnostic(message, severity, origin, compiler_id));
+ m_diagnostics.emplace_back(
+ std::make_unique<Diagnostic>(message, severity, origin, compiler_id));
}
- void AddDiagnostic(Diagnostic *diagnostic) {
- m_diagnostics.push_back(diagnostic);
+ void AddDiagnostic(std::unique_ptr<Diagnostic> diagnostic) {
+ m_diagnostics.push_back(std::move(diagnostic));
}
- void CopyDiagnostics(DiagnosticManager &otherDiagnostics);
-
size_t Printf(DiagnosticSeverity severity, const char *format, ...)
__attribute__((format(printf, 3, 4)));
- size_t PutString(DiagnosticSeverity severity, llvm::StringRef str);
+ void PutString(DiagnosticSeverity severity, llvm::StringRef str);
void AppendMessageToDiagnostic(llvm::StringRef str) {
- if (!m_diagnostics.empty()) {
+ if (!m_diagnostics.empty())
m_diagnostics.back()->AppendMessage(str);
- }
}
// Returns a string containing errors in this format:
@@ -153,7 +140,6 @@ public:
// Moves fixed_expression to the internal storage.
void SetFixedExpression(std::string fixed_expression) {
m_fixed_expression = std::move(fixed_expression);
- fixed_expression.clear();
}
protected:
diff --git a/include/lldb/Expression/ExpressionSourceCode.h b/include/lldb/Expression/ExpressionSourceCode.h
index d0d01b5f9b59..e7d39e7ca24a 100644
--- a/include/lldb/Expression/ExpressionSourceCode.h
+++ b/include/lldb/Expression/ExpressionSourceCode.h
@@ -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
diff --git a/include/lldb/Expression/LLVMUserExpression.h b/include/lldb/Expression/LLVMUserExpression.h
index c2af7239951b..c3b8ed506f17 100644
--- a/include/lldb/Expression/LLVMUserExpression.h
+++ b/include/lldb/Expression/LLVMUserExpression.h
@@ -103,22 +103,6 @@ protected:
/// when running the
/// expression.
lldb::ModuleWP m_jit_module_wp;
- bool m_enforce_valid_object; ///< True if the expression parser should enforce
- ///the presence of a valid class pointer
- /// in order to generate the expression as a method.
- bool m_in_cplusplus_method; ///< True if the expression is compiled as a C++
- ///member function (true if it was parsed
- /// when exe_ctx was in a C++ method).
- bool m_in_objectivec_method; ///< True if the expression is compiled as an
- ///Objective-C method (true if it was parsed
- /// when exe_ctx was in an Objective-C method).
- bool m_in_static_method; ///< True if the expression is compiled as a static
- ///(or class) method (currently true if it
- /// was parsed when exe_ctx was in an Objective-C class method).
- bool m_needs_object_ptr; ///< True if "this" or "self" must be looked up and
- ///passed in. False if the expression
- /// doesn't really use them and they can be NULL.
- bool m_const_object; ///< True if "this" is const.
Target *m_target; ///< The target for storing persistent data like types and
///variables.
diff --git a/include/lldb/Expression/Materializer.h b/include/lldb/Expression/Materializer.h
index 603b4e0066cd..70f622e7850b 100644
--- a/include/lldb/Expression/Materializer.h
+++ b/include/lldb/Expression/Materializer.h
@@ -115,8 +115,6 @@ public:
void SetOffset(uint32_t offset) { m_offset = offset; }
protected:
- void SetSizeAndAlignmentFromType(CompilerType &type);
-
uint32_t m_alignment;
uint32_t m_size;
uint32_t m_offset;
diff --git a/include/lldb/Expression/REPL.h b/include/lldb/Expression/REPL.h
index 850d2f6f961a..d34a792f58f1 100644
--- a/include/lldb/Expression/REPL.h
+++ b/include/lldb/Expression/REPL.h
@@ -103,10 +103,8 @@ public:
void IOHandlerInputComplete(IOHandler &io_handler,
std::string &line) override;
- int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
- const char *cursor, const char *last_char,
- int skip_first_n_matches, int max_matches,
- StringList &matches, StringList &descriptions) override;
+ void IOHandlerComplete(IOHandler &io_handler,
+ CompletionRequest &request) override;
protected:
static int CalculateActualIndentation(const StringList &lines);