clang 17.0.0git
|
DeclarationFragments is a vector of tagged important parts of a symbol's declaration. More...
#include "clang/ExtractAPI/DeclarationFragments.h"
Classes | |
struct | Fragment |
Fragment holds information of a single fragment. More... | |
Public Types | |
enum class | FragmentKind { None , Keyword , Attribute , NumberLiteral , StringLiteral , Identifier , TypeIdentifier , GenericParameter , ExternalParam , InternalParam , Text } |
The kind of a fragment. More... | |
Public Member Functions | |
DeclarationFragments ()=default | |
const std::vector< Fragment > & | getFragments () const |
DeclarationFragments & | appendFront (StringRef Spelling, FragmentKind Kind, StringRef PreciseIdentifier="", const Decl *Declaration=nullptr) |
DeclarationFragments & | appendFront (DeclarationFragments &&Other) |
void | removeLast () |
DeclarationFragments & | append (StringRef Spelling, FragmentKind Kind, StringRef PreciseIdentifier="", const Decl *Declaration=nullptr) |
Append a new Fragment to the end of the Fragments. | |
DeclarationFragments & | append (DeclarationFragments &&Other) |
Append another DeclarationFragments to the end. | |
DeclarationFragments & | appendSpace () |
Append a text Fragment of a space character. | |
Static Public Member Functions | |
static StringRef | getFragmentKindString (FragmentKind Kind) |
Get the string description of a FragmentKind Kind . | |
static FragmentKind | parseFragmentKindFromString (StringRef S) |
Get the corresponding FragmentKind from string S . | |
DeclarationFragments is a vector of tagged important parts of a symbol's declaration.
The fragments sequence can be joined to form spans of declaration text, with attached information useful for purposes like syntax-highlighting etc. For example:
Definition at line 43 of file DeclarationFragments.h.
|
strong |
The kind of a fragment.
Enumerator | |
---|---|
None | Unknown fragment kind. |
Keyword | |
Attribute | |
NumberLiteral | |
StringLiteral | |
Identifier | |
TypeIdentifier | Identifier that refers to a type in the context. |
GenericParameter | Parameter that's used as generics in the context. For example template parameters. |
ExternalParam | External parameters in Objective-C methods. For example, - (void) setValue:(Value)value forKey(Key)key
Definition: Value.h:92 |
InternalParam | Internal/local parameters in Objective-C methods. For example, - (void) setValue:(Value)value forKey(Key)key
|
Text |
Definition at line 48 of file DeclarationFragments.h.
|
default |
|
inline |
Append another DeclarationFragments to the end.
Note: Other
is moved from and cannot be used after a call to this method.
Definition at line 146 of file DeclarationFragments.h.
|
inline |
Append a new Fragment to the end of the Fragments.
Definition at line 125 of file DeclarationFragments.h.
References clang::Declaration, and Text.
Referenced by appendSpace(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForEnum(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForEnumConstant(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForField(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForFunction(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForMacro(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCCategory(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCInterface(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCMethod(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCProperty(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCProtocol(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForStruct(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForTypedef(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForVar(), clang::extractapi::DeclarationFragmentsBuilder::getFunctionSignature(), clang::extractapi::DeclarationFragmentsBuilder::getSubHeading(), and clang::extractapi::DeclarationFragmentsBuilder::getSubHeadingForMacro().
|
inline |
Definition at line 111 of file DeclarationFragments.h.
|
inline |
Definition at line 103 of file DeclarationFragments.h.
References clang::Declaration.
DeclarationFragments & DeclarationFragments::appendSpace | ( | ) |
Append a text Fragment of a space character.
Definition at line 22 of file DeclarationFragments.cpp.
References append(), clang::Last, and Text.
Referenced by clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForEnum(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForField(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForFunction(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForMacro(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCCategory(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCInterface(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCMethod(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCProperty(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCProtocol(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForStruct(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForTypedef(), and clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForVar().
|
static |
Get the string description of a FragmentKind Kind
.
Definition at line 39 of file DeclarationFragments.cpp.
References Attribute, ExternalParam, GenericParameter, Identifier, InternalParam, Keyword, None, NumberLiteral, StringLiteral, Text, and TypeIdentifier.
|
inline |
Definition at line 100 of file DeclarationFragments.h.
Referenced by clang::extractapi::FunctionSignature::empty().
|
static |
Get the corresponding FragmentKind from string S
.
Definition at line 70 of file DeclarationFragments.cpp.
References Attribute, ExternalParam, GenericParameter, Identifier, InternalParam, Keyword, None, NumberLiteral, StringLiteral, Text, and TypeIdentifier.
|
inline |
Definition at line 119 of file DeclarationFragments.h.