Skip to content

Commit 230f964

Browse files
committed
Move type checks for C-style, static, reinterpret casts. Remove dynamic cast checks.
1 parent a1f828e commit 230f964

File tree

5 files changed

+651
-775
lines changed

5 files changed

+651
-775
lines changed

lldb/include/lldb/ValueObject/DILAST.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ class BuiltinFunctionCallNode : public ASTNode {
317317

318318
class CStyleCastNode : public ASTNode {
319319
public:
320+
CStyleCastNode(uint32_t location, CompilerType type, ASTNodeUP operand,
321+
bool is_rvalue)
322+
: ASTNode(location, NodeKind::eCStyleCastNode), m_type(type),
323+
m_operand(std::move(operand)), m_is_rvalue(is_rvalue) {
324+
m_promo_kind = TypePromotionCastKind::eNone;
325+
}
320326
CStyleCastNode(uint32_t location, CompilerType type, ASTNodeUP operand,
321327
CStyleCastKind kind)
322328
: ASTNode(location, NodeKind::eCStyleCastNode), m_type(type),
@@ -332,9 +338,7 @@ class CStyleCastNode : public ASTNode {
332338
}
333339

334340
llvm::Expected<lldb::ValueObjectSP> Accept(Visitor *v) const override;
335-
bool is_rvalue() const override {
336-
return m_cast_kind != CStyleCastKind::eReference;
337-
}
341+
bool is_rvalue() const override { return m_is_rvalue; }
338342
CompilerType result_type() const override { return m_type; }
339343
ValueObject *valobj() const override { return m_operand->valobj(); }
340344

@@ -352,6 +356,7 @@ class CStyleCastNode : public ASTNode {
352356
ASTNodeUP m_operand;
353357
CStyleCastKind m_cast_kind;
354358
TypePromotionCastKind m_promo_kind;
359+
bool m_is_rvalue;
355360
};
356361

357362
class CxxStaticCastNode : public ASTNode {

lldb/include/lldb/ValueObject/DILEval.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ class Interpreter : Visitor {
131131
llvm::Error PrepareAssignment(lldb::ValueObjectSP &lhs,
132132
lldb::ValueObjectSP &rhs, uint32_t location);
133133
llvm::Error CheckCompositeAssignment(const BinaryOpNode *node);
134+
llvm::Error PrepareCxxStaticCastForInheritedTypes(
135+
CompilerType type, lldb::ValueObjectSP rhs, uint32_t location,
136+
std::vector<uint32_t> &idx, uint64_t &offset,
137+
CxxStaticCastKind &cast_kind);
134138

135139
lldb::ValueObjectSP EvaluateComparison(BinaryOpKind kind,
136140
lldb::ValueObjectSP lhs,

0 commit comments

Comments
 (0)