LLDB mainline
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
lldb_private::CPlusPlusNameParser Class Reference

#include <CPlusPlusNameParser.h>

Classes

class  Bookmark
 
struct  ParsedFunction
 
struct  ParsedName
 
struct  ParsedNameRanges
 
struct  Range
 

Public Member Functions

 CPlusPlusNameParser (llvm::StringRef text)
 
std::optional< ParsedFunctionParseAsFunctionDefinition ()
 
std::optional< ParsedNameParseAsFullName ()
 

Private Member Functions

bool HasMoreTokens ()
 
void Advance ()
 
void TakeBack ()
 
bool ConsumeToken (clang::tok::TokenKind kind)
 
template<typename... Ts>
bool ConsumeToken (Ts... kinds)
 
Bookmark SetBookmark ()
 
size_t GetCurrentPosition ()
 
clang::Token & Peek ()
 
bool ConsumeBrackets (clang::tok::TokenKind left, clang::tok::TokenKind right)
 
std::optional< ParsedFunctionParseFunctionImpl (bool expect_return_type)
 
std::optional< ParsedFunctionParseFuncPtr (bool expect_return_type)
 
bool ConsumeArguments ()
 
bool ConsumeTemplateArgs ()
 
bool ConsumeAnonymousNamespace ()
 
bool ConsumeLambda ()
 
bool ConsumeOperator ()
 
void SkipTypeQualifiers ()
 
void SkipFunctionQualifiers ()
 
bool ConsumeBuiltinType ()
 
bool ConsumeDecltype ()
 
void SkipPtrsAndRefs ()
 
bool ConsumePtrsAndRefs ()
 
bool ConsumeTypename ()
 
bool ConsumeAbiTag ()
 Consumes ABI tags enclosed within '[abi:' ... ']'.
 
std::optional< ParsedNameRangesParseFullNameImpl ()
 
llvm::StringRef GetTextForRange (const Range &range)
 
void ExtractTokens ()
 

Private Attributes

llvm::StringRef m_text
 
llvm::SmallVector< clang::Token, 30 > m_tokens
 
size_t m_next_token_index = 0
 

Detailed Description

Definition at line 23 of file CPlusPlusNameParser.h.

Constructor & Destructor Documentation

◆ CPlusPlusNameParser()

lldb_private::CPlusPlusNameParser::CPlusPlusNameParser ( llvm::StringRef  text)
inline

Definition at line 25 of file CPlusPlusNameParser.h.

References ExtractTokens().

Member Function Documentation

◆ Advance()

void CPlusPlusNameParser::Advance ( )
private

◆ ConsumeAbiTag()

bool CPlusPlusNameParser::ConsumeAbiTag ( )
private

Consumes ABI tags enclosed within '[abi:' ... ']'.

Since there is no restriction on what the ABI tag string may contain, this API supports parsing a small set of special characters.

The following regex describes the set of supported characters: [A-Za-z,.\s\d]+

Definition at line 302 of file CPlusPlusNameParser.cpp.

References Advance(), ConsumeToken(), HasMoreTokens(), Peek(), lldb_private::CPlusPlusNameParser::Bookmark::Remove(), and SetBookmark().

Referenced by ConsumeTemplateArgs(), and ParseFullNameImpl().

◆ ConsumeAnonymousNamespace()

bool CPlusPlusNameParser::ConsumeAnonymousNamespace ( )
private

◆ ConsumeArguments()

bool CPlusPlusNameParser::ConsumeArguments ( )
private

◆ ConsumeBrackets()

bool CPlusPlusNameParser::ConsumeBrackets ( clang::tok::TokenKind  left,
clang::tok::TokenKind  right 
)
private

◆ ConsumeBuiltinType()

bool CPlusPlusNameParser::ConsumeBuiltinType ( )
private

Definition at line 495 of file CPlusPlusNameParser.cpp.

References Advance(), HasMoreTokens(), and Peek().

Referenced by ConsumeTypename().

◆ ConsumeDecltype()

bool CPlusPlusNameParser::ConsumeDecltype ( )
private

◆ ConsumeLambda()

bool CPlusPlusNameParser::ConsumeLambda ( )
private

◆ ConsumeOperator()

bool CPlusPlusNameParser::ConsumeOperator ( )
private

◆ ConsumePtrsAndRefs()

bool CPlusPlusNameParser::ConsumePtrsAndRefs ( )
private

Definition at line 536 of file CPlusPlusNameParser.cpp.

References ConsumeToken(), and SkipTypeQualifiers().

Referenced by ParseFuncPtr(), and SkipPtrsAndRefs().

◆ ConsumeTemplateArgs()

bool CPlusPlusNameParser::ConsumeTemplateArgs ( )
private

◆ ConsumeToken() [1/2]

bool lldb_private::CPlusPlusNameParser::ConsumeToken ( clang::tok::TokenKind  kind)
private

◆ ConsumeToken() [2/2]

template<typename... Ts>
bool CPlusPlusNameParser::ConsumeToken ( Ts...  kinds)
private

Definition at line 82 of file CPlusPlusNameParser.cpp.

References Advance(), HasMoreTokens(), and Peek().

◆ ConsumeTypename()

bool CPlusPlusNameParser::ConsumeTypename ( )
private

◆ ExtractTokens()

void CPlusPlusNameParser::ExtractTokens ( )
private

Definition at line 767 of file CPlusPlusNameParser.cpp.

References GetKeywordsMap(), GetLangOptions(), m_text, and m_tokens.

Referenced by CPlusPlusNameParser().

◆ GetCurrentPosition()

size_t CPlusPlusNameParser::GetCurrentPosition ( )
private

Definition at line 97 of file CPlusPlusNameParser.cpp.

References m_next_token_index.

Referenced by ParseFullNameImpl(), and ParseFunctionImpl().

◆ GetTextForRange()

llvm::StringRef CPlusPlusNameParser::GetTextForRange ( const Range range)
private

◆ HasMoreTokens()

bool CPlusPlusNameParser::HasMoreTokens ( )
private

◆ ParseAsFullName()

std::optional< ParsedName > CPlusPlusNameParser::ParseAsFullName ( )

◆ ParseAsFunctionDefinition()

std::optional< ParsedFunction > CPlusPlusNameParser::ParseAsFunctionDefinition ( )

◆ ParseFullNameImpl()

std::optional< CPlusPlusNameParser::ParsedNameRanges > CPlusPlusNameParser::ParseFullNameImpl ( )
private

◆ ParseFuncPtr()

std::optional< ParsedFunction > CPlusPlusNameParser::ParseFuncPtr ( bool  expect_return_type)
private

◆ ParseFunctionImpl()

std::optional< ParsedFunction > CPlusPlusNameParser::ParseFunctionImpl ( bool  expect_return_type)
private

◆ Peek()

clang::Token & CPlusPlusNameParser::Peek ( )
private

◆ SetBookmark()

CPlusPlusNameParser::Bookmark CPlusPlusNameParser::SetBookmark ( )
private

◆ SkipFunctionQualifiers()

void CPlusPlusNameParser::SkipFunctionQualifiers ( )
private

Definition at line 490 of file CPlusPlusNameParser.cpp.

References ConsumeToken().

Referenced by ParseFullNameImpl(), ParseFuncPtr(), and ParseFunctionImpl().

◆ SkipPtrsAndRefs()

void CPlusPlusNameParser::SkipPtrsAndRefs ( )
private

Definition at line 531 of file CPlusPlusNameParser.cpp.

References ConsumePtrsAndRefs().

Referenced by ConsumeTypename().

◆ SkipTypeQualifiers()

void CPlusPlusNameParser::SkipTypeQualifiers ( )
private

Definition at line 485 of file CPlusPlusNameParser.cpp.

References ConsumeToken().

Referenced by ConsumePtrsAndRefs(), and ConsumeTypename().

◆ TakeBack()

void CPlusPlusNameParser::TakeBack ( )
private

Definition at line 69 of file CPlusPlusNameParser.cpp.

References m_next_token_index.

Referenced by ConsumeLambda(), and ParseFullNameImpl().

Member Data Documentation

◆ m_next_token_index

size_t lldb_private::CPlusPlusNameParser::m_next_token_index = 0
private

◆ m_text

llvm::StringRef lldb_private::CPlusPlusNameParser::m_text
private

Definition at line 62 of file CPlusPlusNameParser.h.

Referenced by ExtractTokens(), and GetTextForRange().

◆ m_tokens

llvm::SmallVector<clang::Token, 30> lldb_private::CPlusPlusNameParser::m_tokens
private

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