[Lldb-commits] [lldb] [LLDB] Add `ScalarLiteralNode` and literal parsing in DIL (PR #152308)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 14 06:06:23 PDT 2025
================
@@ -178,6 +179,54 @@ class BitFieldExtractionNode : public ASTNode {
int64_t m_last_index;
};
+class IntegerLiteralNode : public ASTNode {
+public:
+ IntegerLiteralNode(uint32_t location, llvm::APInt value, uint32_t radix,
+ bool is_unsigned, bool is_long, bool is_longlong)
+ : ASTNode(location, NodeKind::eScalarLiteralNode), m_value(value),
+ m_radix(radix), m_is_unsigned(is_unsigned), m_is_long(is_long),
+ m_is_longlong(is_longlong) {}
+
+ llvm::Expected<lldb::ValueObjectSP> Accept(Visitor *v) const override;
+
+ llvm::APInt GetValue() const { return m_value; }
+ uint32_t GetRadix() const { return m_radix; }
+ bool IsUnsigned() const { return m_is_unsigned; }
+ bool IsLong() const { return m_is_long; }
+ bool IsLongLong() const { return m_is_longlong; }
+
+ static bool classof(const ASTNode *node) {
+ return node->GetKind() == NodeKind::eScalarLiteralNode;
+ }
+
+private:
+ llvm::APInt m_value;
+ uint32_t m_radix;
+ bool m_is_unsigned;
----------------
labath wrote:
Optional, as I don't know if this will look cleaner, but I am tempted to merge m_value and m_is_unsigned into an `llvm::APSInt` (which is basically an APInt+bool pair)
https://github.com/llvm/llvm-project/pull/152308
More information about the lldb-commits
mailing list