Doxygenify CompilerType.h (NFC)

This commit is contained in:
Adrian Prantl 2020-03-03 13:42:45 -08:00
parent f95095e9f6
commit a7fa8b022f
1 changed files with 79 additions and 70 deletions

View File

@ -46,25 +46,26 @@ public:
CompilerType() = default;
// Operators
/// Operators.
/// \{
const CompilerType &operator=(const CompilerType &rhs) {
m_type = rhs.m_type;
m_type_system = rhs.m_type_system;
return *this;
}
// Tests
explicit operator bool() const {
return m_type != nullptr && m_type_system != nullptr;
}
bool operator<(const CompilerType &rhs) const {
if (m_type_system == rhs.m_type_system)
return m_type < rhs.m_type;
return m_type_system < rhs.m_type_system;
}
/// \}
/// Tests.
/// \{
explicit operator bool() const {
return m_type != nullptr && m_type_system != nullptr;
}
bool IsValid() const { return m_type != nullptr && m_type_system != nullptr; }
@ -115,8 +116,9 @@ public:
bool IsPolymorphicClass() const;
bool IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
bool check_cplusplus, bool check_objc) const;
/// \param target_type Can pass nullptr.
bool IsPossibleDynamicType(CompilerType *target_type, bool check_cplusplus,
bool check_objc) const;
bool IsPointerToScalarType() const;
@ -136,17 +138,20 @@ public:
bool IsTypedefType() const;
bool IsVoidType() const;
/// \}
// Type Completion
/// Type Completion.
/// \{
bool GetCompleteType() const;
/// \}
// AST related queries
/// AST related queries.
/// \{
size_t GetPointerByteSize() const;
/// \}
// Accessors
/// Accessors.
/// \{
TypeSystem *GetTypeSystem() const { return m_type_system; }
ConstString GetTypeName() const;
@ -166,9 +171,10 @@ public:
lldb::opaque_compiler_type_t type);
unsigned GetTypeQualifiers() const;
/// \}
// Creating related types
/// Creating related types.
/// \{
CompilerType GetArrayElementType(uint64_t *stride = nullptr) const;
CompilerType GetArrayType(uint64_t size) const;
@ -177,8 +183,8 @@ public:
CompilerType GetFullyUnqualifiedType() const;
// Returns -1 if this isn't a function of if the function doesn't have a
// prototype Returns a value >= 0 if there is a prototype.
/// Returns -1 if this isn't a function of if the function doesn't
/// have a prototype Returns a value >= 0 if there is a prototype.
int GetFunctionArgumentCount() const;
CompilerType GetFunctionArgumentTypeAtIndex(size_t idx) const;
@ -189,62 +195,63 @@ public:
TypeMemberFunctionImpl GetMemberFunctionAtIndex(size_t idx);
// If this type is a reference to a type (L value or R value reference),
// return a new type with the reference removed, else return the current type
// itself.
/// If this type is a reference to a type (L value or R value reference),
/// return a new type with the reference removed, else return the current type
/// itself.
CompilerType GetNonReferenceType() const;
// If this type is a pointer type, return the type that the pointer points
// to, else return an invalid type.
/// If this type is a pointer type, return the type that the pointer points
/// to, else return an invalid type.
CompilerType GetPointeeType() const;
// Return a new CompilerType that is a pointer to this type
/// Return a new CompilerType that is a pointer to this type
CompilerType GetPointerType() const;
// Return a new CompilerType that is a L value reference to this type if this
// type is valid and the type system supports L value references, else return
// an invalid type.
/// Return a new CompilerType that is a L value reference to this type if this
/// type is valid and the type system supports L value references, else return
/// an invalid type.
CompilerType GetLValueReferenceType() const;
// Return a new CompilerType that is a R value reference to this type if this
// type is valid and the type system supports R value references, else return
// an invalid type.
/// Return a new CompilerType that is a R value reference to this type if this
/// type is valid and the type system supports R value references, else return
/// an invalid type.
CompilerType GetRValueReferenceType() const;
// Return a new CompilerType adds a const modifier to this type if this type
// is valid and the type system supports const modifiers, else return an
// invalid type.
/// Return a new CompilerType adds a const modifier to this type if this type
/// is valid and the type system supports const modifiers, else return an
/// invalid type.
CompilerType AddConstModifier() const;
// Return a new CompilerType adds a volatile modifier to this type if this
// type is valid and the type system supports volatile modifiers, else return
// an invalid type.
/// Return a new CompilerType adds a volatile modifier to this type if this
/// type is valid and the type system supports volatile modifiers, else return
/// an invalid type.
CompilerType AddVolatileModifier() const;
// Return a new CompilerType that is the atomic type of this type. If this
// type is not valid or the type system doesn't support atomic types, this
// returns an invalid type.
/// Return a new CompilerType that is the atomic type of this type. If this
/// type is not valid or the type system doesn't support atomic types, this
/// returns an invalid type.
CompilerType GetAtomicType() const;
// Return a new CompilerType adds a restrict modifier to this type if this
// type is valid and the type system supports restrict modifiers, else return
// an invalid type.
/// Return a new CompilerType adds a restrict modifier to this type if this
/// type is valid and the type system supports restrict modifiers, else return
/// an invalid type.
CompilerType AddRestrictModifier() const;
// Create a typedef to this type using "name" as the name of the typedef this
// type is valid and the type system supports typedefs, else return an
// invalid type.
/// Create a typedef to this type using "name" as the name of the typedef this
/// type is valid and the type system supports typedefs, else return an
/// invalid type.
CompilerType CreateTypedef(const char *name,
const CompilerDeclContext &decl_ctx) const;
// If the current object represents a typedef type, get the underlying type
/// If the current object represents a typedef type, get the underlying type
CompilerType GetTypedefedType() const;
// Create related types using the current type's AST
/// Create related types using the current type's AST
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const;
/// \}
// Exploring the type
/// Exploring the type.
/// \{
struct IntegralTemplateArgument;
/// Return the size of the type in bytes.
@ -256,7 +263,8 @@ public:
lldb::Format GetFormat() const;
llvm::Optional<size_t> GetTypeBitAlign(ExecutionContextScope *exe_scope) const;
llvm::Optional<size_t>
GetTypeBitAlign(ExecutionContextScope *exe_scope) const;
uint32_t GetNumChildren(bool omit_empty_base_classes,
const ExecutionContext *exe_ctx) const;
@ -265,12 +273,11 @@ public:
static lldb::BasicType GetBasicTypeEnumeration(ConstString name);
// If this type is an enumeration, iterate through all of its enumerators
// using a callback. If the callback returns true, keep iterating, else abort
// the iteration.
/// If this type is an enumeration, iterate through all of its enumerators
/// using a callback. If the callback returns true, keep iterating, else abort
/// the iteration.
void ForEachEnumerator(
std::function<bool(const CompilerType &integer_type,
ConstString name,
std::function<bool(const CompilerType &integer_type, ConstString name,
const llvm::APSInt &value)> const &callback) const;
uint32_t GetNumFields() const;
@ -305,17 +312,17 @@ public:
bool &child_is_deref_of_parent, ValueObject *valobj,
uint64_t &language_flags) const;
// Lookup a child given a name. This function will match base class names and
// member member names in "clang_type" only, not descendants.
/// Lookup a child given a name. This function will match base class names and
/// member member names in "clang_type" only, not descendants.
uint32_t GetIndexOfChildWithName(const char *name,
bool omit_empty_base_classes) const;
// Lookup a child member given a name. This function will match member names
// only and will descend into "clang_type" children in search for the first
// member in this class, or any base class that matches "name".
// TODO: Return all matches for a given name by returning a
// vector<vector<uint32_t>>
// so we catch all names that match a given child name, not just the first.
/// Lookup a child member given a name. This function will match member names
/// only and will descend into "clang_type" children in search for the first
/// member in this class, or any base class that matches "name".
/// TODO: Return all matches for a given name by returning a
/// vector<vector<uint32_t>>
/// so we catch all names that match a given child name, not just the first.
size_t
GetIndexOfChildMemberWithName(const char *name, bool omit_empty_base_classes,
std::vector<uint32_t> &child_indexes) const;
@ -325,7 +332,7 @@ public:
lldb::TemplateArgumentKind GetTemplateArgumentKind(size_t idx) const;
CompilerType GetTypeTemplateArgument(size_t idx) const;
// Returns the value of the template argument and its type.
/// Returns the value of the template argument and its type.
llvm::Optional<IntegralTemplateArgument>
GetIntegralTemplateArgument(size_t idx) const;
@ -334,9 +341,10 @@ public:
LazyBool ShouldPrintAsOneLiner(ValueObject *valobj) const;
bool IsMeaninglessWithoutDynamicResolution() const;
/// \}
// Dumping types
/// Dumping types.
/// \{
#ifndef NDEBUG
/// Convenience LLVM-style dump method for use in the debugger only.
/// Don't call this function from actual code.
@ -358,13 +366,14 @@ public:
const DataExtractor &data, lldb::offset_t data_offset,
size_t data_byte_size);
void DumpTypeDescription() const; // Dump to stdout
/// Dump to stdout.
void DumpTypeDescription() const;
void DumpTypeDescription(Stream *s) const;
/// \}
bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset,
size_t data_byte_size, Scalar &value) const;
void Clear() {
m_type = nullptr;
m_type_system = nullptr;