Skip to content

Commit 42d669f

Browse files
authored
[LLDB] Add more helper functions to CompilerType class. (#73467)
This adds 23 new helper functions to LLDB's CompilerType class, things like IsSmartPtrType, IsPromotableIntegerType, GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a few). These helper functions are needed as part of the implementation for the Data Inspection Language, (see https://discourse.llvm.org/t/rfc-data-inspection-language/69893).
1 parent 8971414 commit 42d669f

File tree

2 files changed

+320
-21
lines changed

2 files changed

+320
-21
lines changed

lldb/include/lldb/Symbol/CompilerType.h

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ class CompilerType {
112112

113113
/// Tests.
114114
/// \{
115-
explicit operator bool() const {
116-
return m_type_system.lock() && m_type;
117-
}
115+
explicit operator bool() const { return m_type_system.lock() && m_type; }
118116

119117
bool IsValid() const { return (bool)*this; }
120118

@@ -194,6 +192,54 @@ class CompilerType {
194192
bool IsTypedefType() const;
195193

196194
bool IsVoidType() const;
195+
196+
bool IsSmartPtrType() const;
197+
198+
bool IsInteger() const;
199+
200+
bool IsFloat() const;
201+
202+
bool IsEnumerationType() const;
203+
204+
bool IsUnscopedEnumerationType() const;
205+
206+
bool IsIntegerOrUnscopedEnumerationType() const;
207+
208+
bool IsSigned() const;
209+
210+
bool IsNullPtrType() const;
211+
212+
bool IsBoolean() const;
213+
214+
bool IsEnumerationIntegerTypeSigned() const;
215+
216+
bool IsScalarOrUnscopedEnumerationType() const;
217+
218+
bool IsPromotableIntegerType() const;
219+
220+
bool IsPointerToVoid() const;
221+
222+
bool IsRecordType() const;
223+
224+
bool IsVirtualBase(CompilerType target_base, CompilerType *virtual_base,
225+
bool carry_virtual = false) const;
226+
227+
bool IsContextuallyConvertibleToBool() const;
228+
229+
bool IsBasicType() const;
230+
231+
std::string TypeDescription();
232+
233+
bool CompareTypes(CompilerType rhs) const;
234+
235+
const char *GetTypeTag();
236+
237+
uint32_t GetNumberOfNonEmptyBaseClasses();
238+
239+
CompilerType GetTemplateArgumentType(uint32_t idx);
240+
241+
CompilerType GetSmartPtrPointeeType();
242+
197243
/// \}
198244

199245
/// Type Completion.
@@ -436,8 +482,8 @@ class CompilerType {
436482
ExecutionContextScope *exe_scope);
437483

438484
/// Dump to stdout.
439-
void DumpTypeDescription(lldb::DescriptionLevel level =
440-
lldb::eDescriptionLevelFull) const;
485+
void DumpTypeDescription(
486+
lldb::DescriptionLevel level = lldb::eDescriptionLevelFull) const;
441487

442488
/// Print a description of the type to a stream. The exact implementation
443489
/// varies, but the expectation is that eDescriptionLevelFull returns a

0 commit comments

Comments
 (0)