LLDB mainline
DILEval.h
Go to the documentation of this file.
1//===-- DILEval.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 LLDB_VALUEOBJECT_DILEVAL_H
10#define LLDB_VALUEOBJECT_DILEVAL_H
11
14#include "llvm/ADT/StringRef.h"
15#include "llvm/Support/Error.h"
16#include <memory>
17#include <vector>
18
19namespace lldb_private::dil {
20
21/// Given the name of an identifier (variable name, member name, type name,
22/// etc.), find the ValueObject for that name (if it exists), excluding global
23/// variables, and create and return an IdentifierInfo object containing all
24/// the relevant information about that object (for DIL parsing and
25/// evaluating).
26lldb::ValueObjectSP LookupIdentifier(llvm::StringRef name_ref,
27 std::shared_ptr<StackFrame> frame_sp,
28 lldb::DynamicValueType use_dynamic);
29
30/// Given the name of an identifier, check to see if it matches the name of a
31/// global variable. If so, find the ValueObject for that global variable, and
32/// create and return an IdentifierInfo object containing all the relevant
33/// informatin about it.
34lldb::ValueObjectSP LookupGlobalIdentifier(llvm::StringRef name_ref,
35 std::shared_ptr<StackFrame> frame_sp,
36 lldb::TargetSP target_sp,
37 lldb::DynamicValueType use_dynamic);
38
40public:
41 Interpreter(lldb::TargetSP target, llvm::StringRef expr,
42 std::shared_ptr<StackFrame> frame_sp,
43 lldb::DynamicValueType use_dynamic, bool use_synthetic,
44 bool fragile_ivar, bool check_ptr_vs_member);
45
46 llvm::Expected<lldb::ValueObjectSP> Evaluate(const ASTNode *node);
47
48private:
49 llvm::Expected<lldb::ValueObjectSP>
50 Visit(const IdentifierNode *node) override;
51 llvm::Expected<lldb::ValueObjectSP> Visit(const MemberOfNode *node) override;
52 llvm::Expected<lldb::ValueObjectSP> Visit(const UnaryOpNode *node) override;
53 llvm::Expected<lldb::ValueObjectSP>
54 Visit(const ArraySubscriptNode *node) override;
55 llvm::Expected<lldb::ValueObjectSP>
56 Visit(const BitFieldExtractionNode *node) override;
57 llvm::Expected<lldb::ValueObjectSP>
58 Visit(const IntegerLiteralNode *node) override;
59 llvm::Expected<lldb::ValueObjectSP>
60 Visit(const FloatLiteralNode *node) override;
61 llvm::Expected<lldb::ValueObjectSP>
62 Visit(const BooleanLiteralNode *node) override;
63
64 llvm::Expected<CompilerType>
66 std::shared_ptr<ExecutionContextScope> ctx,
67 const IntegerLiteralNode *literal);
68
69 // Used by the interpreter to create objects, perform casts, etc.
71 llvm::StringRef m_expr;
73 std::shared_ptr<StackFrame> m_exe_ctx_scope;
78};
79
80} // namespace lldb_private::dil
81
82#endif // LLDB_VALUEOBJECT_DILEVAL_H
The rest of the classes in this file, except for the Visitor class at the very end,...
Definition DILAST.h:52
std::shared_ptr< StackFrame > m_exe_ctx_scope
Definition DILEval.h:73
llvm::Expected< lldb::ValueObjectSP > Visit(const IdentifierNode *node) override
Definition DILEval.cpp:156
llvm::Expected< lldb::ValueObjectSP > Evaluate(const ASTNode *node)
Definition DILEval.cpp:147
Interpreter(lldb::TargetSP target, llvm::StringRef expr, std::shared_ptr< StackFrame > frame_sp, lldb::DynamicValueType use_dynamic, bool use_synthetic, bool fragile_ivar, bool check_ptr_vs_member)
Definition DILEval.cpp:138
lldb::ValueObjectSP m_scope
Definition DILEval.h:72
lldb::DynamicValueType m_use_dynamic
Definition DILEval.h:74
llvm::Expected< CompilerType > PickIntegerType(lldb::TypeSystemSP type_system, std::shared_ptr< ExecutionContextScope > ctx, const IntegerLiteralNode *literal)
Definition DILEval.cpp:521
This class contains one Visit method for each specialized type of DIL AST node.
Definition DILAST.h:251
lldb::ValueObjectSP LookupGlobalIdentifier(llvm::StringRef name_ref, std::shared_ptr< StackFrame > frame_sp, lldb::TargetSP target_sp, lldb::DynamicValueType use_dynamic)
Given the name of an identifier, check to see if it matches the name of a global variable.
Definition DILEval.cpp:49
lldb::ValueObjectSP LookupIdentifier(llvm::StringRef name_ref, std::shared_ptr< StackFrame > frame_sp, lldb::DynamicValueType use_dynamic)
Given the name of an identifier (variable name, member name, type name, etc.), find the ValueObject f...
Definition DILEval.cpp:90
std::shared_ptr< lldb_private::TypeSystem > TypeSystemSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::Target > TargetSP