LLDB mainline
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
lldb_private::ObjCLanguage::MethodName Class Reference

#include <ObjCLanguage.h>

Public Member Functions

bool IsClassMethod () const
 Determines if this method is a class method.
 
bool IsInstanceMethod () const
 Determines if this method is an instance method.
 
const std::string & GetFullName () const
 Returns the full name of the method.
 
std::string GetFullNameWithoutCategory () const
 Creates a variation of this method without the category.
 
llvm::StringRef GetClassName () const
 Returns a reference to the class name.
 
llvm::StringRef GetClassNameWithCategory () const
 Returns a reference to the class name with the category.
 
llvm::StringRef GetCategory () const
 Returns a reference to the category name.
 
llvm::StringRef GetSelector () const
 Returns a reference to the selector name.
 

Static Public Member Functions

static std::optional< const MethodNameCreate (llvm::StringRef name, bool strict)
 The static factory method for creating a MethodName.
 

Protected Types

enum  Type { eTypeUnspecified , eTypeClassMethod , eTypeInstanceMethod }
 

Protected Member Functions

 MethodName (llvm::StringRef name, Type type)
 

Protected Attributes

const std::string m_full
 
Type m_type
 

Detailed Description

Definition at line 26 of file ObjCLanguage.h.

Member Enumeration Documentation

◆ Type

Enumerator
eTypeUnspecified 
eTypeClassMethod 
eTypeInstanceMethod 

Definition at line 113 of file ObjCLanguage.h.

Constructor & Destructor Documentation

◆ MethodName()

lldb_private::ObjCLanguage::MethodName::MethodName ( llvm::StringRef  name,
Type  type 
)
inlineprotected

Definition at line 115 of file ObjCLanguage.h.

Member Function Documentation

◆ Create()

std::optional< const ObjCLanguage::MethodName > ObjCLanguage::MethodName::Create ( llvm::StringRef  name,
bool  strict 
)
static

The static factory method for creating a MethodName.

Parameters
[in]nameThe name of the method.
[in]strictControl whether or not the name parser is strict about +/- in the front of the name.
Returns
If the name failed to parse as a valid Objective-C method name, returns std::nullopt. Otherwise returns a const MethodName.

Definition at line 64 of file ObjCLanguage.cpp.

References eTypeClassMethod, eTypeInstanceMethod, and eTypeUnspecified.

Referenced by lldb_private::ObjCLanguage::GetMethodNameVariants(), lldb_private::plugin::dwarf::ManualDWARFIndex::IndexUnitImpl(), and DWARFASTParserClang::ParseSubroutine().

◆ GetCategory()

llvm::StringRef ObjCLanguage::MethodName::GetCategory ( ) const

Returns a reference to the category name.

Example: Full name: "+[NSString(my_additions) myStringWithCString:]" will give you "my_additions"

Returns
A StringRef to the category name of this method. If no category is present, the StringRef is empty.

Definition at line 132 of file ObjCLanguage.cpp.

◆ GetClassName()

llvm::StringRef ObjCLanguage::MethodName::GetClassName ( ) const

Returns a reference to the class name.

Example: Full name: "+[NSString(my_additions) myStringWithCString:]" will give you "NSString"

Returns
A StringRef to the class name of this method.

Definition at line 103 of file ObjCLanguage.cpp.

◆ GetClassNameWithCategory()

llvm::StringRef ObjCLanguage::MethodName::GetClassNameWithCategory ( ) const

Returns a reference to the class name with the category.

Example: Full name: "+[NSString(my_additions) myStringWithCString:]" will give you "NSString(my_additions)"

Note: If your method has no category, this will give the same output as GetClassName.

Returns
A StringRef to the class name (including the category) of this method. If there was no category, returns the same as GetClassName.

Definition at line 116 of file ObjCLanguage.cpp.

◆ GetFullName()

const std::string & lldb_private::ObjCLanguage::MethodName::GetFullName ( ) const
inline

Returns the full name of the method.

This includes the class name, the category name (if applicable), and the selector name.

Returns
The name of the method in the form of a const std::string reference.

Definition at line 60 of file ObjCLanguage.h.

References m_full.

◆ GetFullNameWithoutCategory()

std::string ObjCLanguage::MethodName::GetFullNameWithoutCategory ( ) const

Creates a variation of this method without the category.

If this method has no category, it returns an empty string.

Example: Full name: "+[NSString(my_additions) myStringWithCString:]" becomes "+[NSString myStringWithCString:]"

Returns
The method name without the category or an empty string if there was no category to begin with.

Definition at line 145 of file ObjCLanguage.cpp.

◆ GetSelector()

llvm::StringRef ObjCLanguage::MethodName::GetSelector ( ) const

Returns a reference to the selector name.

Example: Full name: "+[NSString(my_additions) myStringWithCString:]" will give you "myStringWithCString:"

Returns
A StringRef to the selector of this method.

Definition at line 123 of file ObjCLanguage.cpp.

◆ IsClassMethod()

bool lldb_private::ObjCLanguage::MethodName::IsClassMethod ( ) const
inline

Determines if this method is a class method.

Returns
Returns true if the method is a class method. False otherwise.

Definition at line 45 of file ObjCLanguage.h.

References eTypeClassMethod, and m_type.

◆ IsInstanceMethod()

bool lldb_private::ObjCLanguage::MethodName::IsInstanceMethod ( ) const
inline

Determines if this method is an instance method.

Returns
Returns true if the method is an instance method. False otherwise.

Definition at line 51 of file ObjCLanguage.h.

References eTypeInstanceMethod, and m_type.

Member Data Documentation

◆ m_full

const std::string lldb_private::ObjCLanguage::MethodName::m_full
protected

Definition at line 118 of file ObjCLanguage.h.

Referenced by GetFullName().

◆ m_type

Type lldb_private::ObjCLanguage::MethodName::m_type
protected

Definition at line 119 of file ObjCLanguage.h.

Referenced by IsClassMethod(), and IsInstanceMethod().


The documentation for this class was generated from the following files: