18#ifndef LLVM_CLANG_EXTRACTAPI_DECLARATION_FRAGMENTS_H
19#define LLVM_CLANG_EXTRACTAPI_DECLARATION_FRAGMENTS_H
108 const std::vector<Fragment> &
getFragments()
const {
return Fragments; }
139 StringRef PreciseIdentifier =
"",
145 Fragments.back().Spelling.append(Spelling.data(), Spelling.size());
147 Fragments.emplace_back(Spelling,
Kind, PreciseIdentifier,
Declaration);
158 if (
Other.Fragments.empty())
161 if (Fragments.empty()) {
162 Fragments = std::move(
Other.Fragments);
166 const auto &OtherFrags =
Other.Fragments;
167 auto ToInsertBegin = std::make_move_iterator(
Other.begin());
168 auto ToInsertEnd = std::make_move_iterator(
Other.end());
174 auto &TheirBackSpelling = OtherFrags.back().Spelling;
175 It->Spelling.reserve(It->Spelling.size() + TheirBackSpelling.size());
176 It->Spelling.insert(It->Spelling.begin(), TheirBackSpelling.begin(),
177 TheirBackSpelling.end());
185 auto PrevIt = std::prev(It);
186 auto &TheirFrontSpelling = OtherFrags.front().Spelling;
187 PrevIt->Spelling.reserve(PrevIt->Spelling.size() +
188 TheirFrontSpelling.size());
189 PrevIt->Spelling.append(TheirFrontSpelling);
193 Fragments.insert(It, ToInsertBegin, ToInsertEnd);
198 Fragments.pop_back();
203 Fragments.at(Position).Spelling = NewSpelling;
238 std::vector<Fragment> Fragments;
248 bool empty()
const {
return Access.empty(); }
274 Parameters.emplace_back(Name, Fragments);
285 return Parameters.empty() && ReturnType.
getFragments().empty();
289 std::vector<Parameter> Parameters;
302 template <
typename FunctionT>
315 llvm_unreachable(
"Unhandled access control");
460template <
typename FunctionT>
466 ReturnType = getFragmentsForType(
Function->getReturnType(),
469 dyn_cast<FunctionDecl>(
Function)->getDescribedFunctionTemplate() &&
470 StringRef(ReturnType.
begin()->Spelling).starts_with(
"type-parameter")) {
471 std::string ProperArgName =
Function->getReturnType().getAsString();
472 ReturnType.
begin()->Spelling.swap(ProperArgName);
474 ReturnType.
append(std::move(After));
477 for (
const auto *Param :
Function->parameters())
478 Signature.
addParameter(Param->getName(), getFragmentsForParam(Param));
Defines the clang::ASTContext interface.
enum clang::sema::@1655::IndirectLocalPathEntry::EntryKind Kind
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::MacroInfo and clang::MacroDirective classes.
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TypeLoc interface and its subclasses.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Represents a C++ conversion function within a class.
Represents a static or instance method of a struct/union/class.
Represents a C++ struct/union/class.
Represents a class template specialization, which refers to a class template with a given set of temp...
Declaration of a C++20 concept.
Decl - This represents one declaration (or definition), e.g.
AccessSpecifier getAccess() const
An instance of this object exists for each enum constant that is defined.
Represents a member of a struct/union/class.
Represents a function declaration or definition.
Declaration of a template function.
Wrapper for source info for functions.
Encapsulates changes to the "macros namespace" (the location where the macro name became active,...
This represents a decl that may have a name.
Represent a C++ namespace.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
ObjCCategoryDecl - Represents a category declaration.
Represents an ObjC class declaration.
ObjCMethodDecl - Represents an instance or class method declaration.
Represents one property declaration in an Objective-C interface.
Represents an Objective-C protocol declaration.
Represents a parameter to a function.
A (possibly-)qualified type.
The collection of all-type qualifiers we support.
Represents a struct/union/class.
Declaration of a redeclarable template.
The base class of the type hierarchy.
Base class for declarations which introduce a typedef-name.
Represents a variable declaration or definition.
Represents a variable template specialization, which refers to a variable template with a given set o...
The JSON file list parser is used to communicate input to InstallAPI.
@ Other
Other implicit parameter.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.