18#ifndef LLVM_CLANG_EXTRACTAPI_API_H
19#define LLVM_CLANG_EXTRACTAPI_API_H
26#include "llvm/ADT/SmallPtrSet.h"
27#include "llvm/Support/Allocator.h"
28#include "llvm/Support/Casting.h"
29#include "llvm/TargetParser/Triple.h"
49 unsigned int Depth,
bool IsParameterPack)
50 :
Type(
Type), Name(Name), Index(Index), Depth(Depth),
51 IsParameterPack(IsParameterPack) {}
54 struct TemplateConstraint {
67 for (
auto *
const Parameter : *
Decl->getTemplateParameters()) {
68 const auto *Param = dyn_cast<TemplateTypeParmDecl>(
Parameter);
72 if (Param->hasTypeConstraint())
73 Type = Param->getTypeConstraint()->getNamedConcept()->getName().str();
74 else if (Param->wasDeclaredWithTypename())
80 Param->getDepth(), Param->isParameterPack());
85 for (
auto *
const Parameter : *
Decl->getTemplateParameters()) {
86 const auto *Param = dyn_cast<TemplateTypeParmDecl>(
Parameter);
90 if (Param->hasTypeConstraint())
91 Type = Param->getTypeConstraint()->getNamedConcept()->getName().str();
92 else if (Param->wasDeclaredWithTypename())
98 Param->getDepth(), Param->isParameterPack());
103 for (
auto *
const Parameter : *
Decl->getTemplateParameters()) {
104 const auto *Param = dyn_cast<TemplateTypeParmDecl>(
Parameter);
108 if (Param->hasTypeConstraint())
109 Type = Param->getTypeConstraint()->getNamedConcept()->getName().str();
110 else if (Param->wasDeclaredWithTypename())
116 Param->getDepth(), Param->isParameterPack());
129 unsigned int Index,
unsigned int Depth,
130 bool IsParameterPack) {
131 Parameters.emplace_back(
Type, Name, Index, Depth, IsParameterPack);
134 bool empty()
const {
return Parameters.empty() && Constraints.empty(); }
268 mutable APIRecord *NextInContext =
nullptr;
345 Current = Current->getNextInContext();
355 return x.Current == y.Current;
358 return x.Current != y.Current;
374 bool IsWellFormed()
const;
431 virtual void anchor();
512 virtual void anchor();
598 virtual void anchor();
645 virtual void anchor();
710 virtual void anchor();
729 virtual void anchor();
747 virtual void anchor();
766 virtual void anchor();
799 virtual void anchor();
859 virtual void anchor();
880 virtual void anchor();
901 virtual void anchor();
923 virtual void anchor();
1019 virtual void anchor();
1042 virtual void anchor();
1064 virtual void anchor();
1104 virtual void anchor();
1124 virtual void anchor();
1188 virtual void anchor();
1299 virtual void anchor();
1323 virtual void anchor();
1344 virtual void anchor();
1363 virtual void anchor();
1390 virtual void anchor();
1413 StringRef Source =
"");
1419 template <
typename RecordTy,
typename... CtorArgsContTy>
1420 typename std::enable_if_t<std::is_base_of_v<APIRecord, RecordTy>, RecordTy> *
1421 createRecord(StringRef USR, StringRef Name, CtorArgsContTy &&...CtorArgs);
1424 return llvm::iterator_range<decltype(TopLevelRecords)::iterator>(
1444 llvm::BumpPtrAllocator Allocator;
1446 const llvm::Triple
Target;
1449 struct APIRecordDeleter {
1456 using APIRecordStoredPtr = std::unique_ptr<APIRecord, APIRecordDeleter>;
1457 llvm::DenseMap<StringRef, APIRecordStoredPtr> USRBasedLookupTable;
1464template <
typename RecordTy,
typename... CtorArgsContTy>
1465typename std::enable_if_t<std::is_base_of_v<APIRecord, RecordTy>, RecordTy> *
1467 CtorArgsContTy &&...CtorArgs) {
1470 auto Result = USRBasedLookupTable.insert({USRString,
nullptr});
1475 Record =
new (Allocator) RecordTy(
1476 USRString,
copyString(Name), std::forward<CtorArgsContTy>(CtorArgs)...);
1480 if (
auto *ParentContext =
1481 dyn_cast_if_present<RecordContext>(
Record->Parent.Record))
1482 ParentContext->addToRecordChain(
Record);
1484 TopLevelRecords.insert(
Record);
1486 Record = dyn_cast<RecordTy>(
Result.first->second.get());
1494template <
typename FromTy,
1495 bool IsKnownSubType = std::is_base_of_v<RecordContext, FromTy>>
1497 static_assert(std::is_base_of_v<APIRecord, FromTy>,
1498 "Can only cast APIRecord and derived classes to RecordContext");
1509 static_assert(std::is_base_of_v<APIRecord, FromTy>,
1510 "Can only cast APIRecord and derived classes to RecordContext");
1519template <
typename ToTy,
1520 bool IsKnownSubType = std::is_base_of_v<RecordContext, ToTy>>
1523 std::is_base_of_v<APIRecord, ToTy>,
1524 "Can only class RecordContext to APIRecord and derived classes");
1527 return ToTy::classofKind(Ctx->
getKind());
1538 std::is_base_of_v<APIRecord, ToTy>,
1539 "Can only class RecordContext to APIRecord and derived classes");
1541 return ToTy::classof(Ctx->
getKind());
1544 return static_cast<ToTy *
>(Ctx);
1555template <
typename FromTy>
1559 ::clang::extractapi::RecordContext *, FromTy *,
1560 CastInfo<::clang::extractapi::RecordContext, FromTy *>> {
1562 return ::clang::extractapi::ToRecordContextCastInfoWrapper<
1563 FromTy>::isPossible(From);
1566 static inline ::clang::extractapi::RecordContext *
doCast(FromTy *From) {
1567 return ::clang::extractapi::ToRecordContextCastInfoWrapper<FromTy>::doCast(
1572template <
typename FromTy>
1575 ::clang::extractapi::RecordContext, const FromTy *,
1576 CastInfo<::clang::extractapi::RecordContext, FromTy *>> {};
1578template <
typename ToTy>
1582 ToTy *, ::clang::extractapi::RecordContext *,
1583 CastInfo<ToTy, ::clang::extractapi::RecordContext *>> {
1585 return ::clang::extractapi::FromRecordContextCastInfoWrapper<
1586 ToTy>::isPossible(Ctx);
1590 return ::clang::extractapi::FromRecordContextCastInfoWrapper<ToTy>::doCast(
1595template <
typename ToTy>
1598 ToTy, const ::clang::extractapi::RecordContext *,
1599 CastInfo<ToTy, ::clang::extractapi::RecordContext *>> {};
enum clang::sema::@1655::IndirectLocalPathEntry::EntryKind Kind
This file defines the Declaration Fragments related classes.
llvm::MachO::Target Target
llvm::MachO::Record Record
Defines the clang::SourceLocation class and associated facilities.
Decl - This represents one declaration (or definition), e.g.
Represents an unpacked "presumed" location which can be presented to the user.
The base class of all kinds of template declarations (e.g., class, function, etc.).
The base class of the type hierarchy.
The JSON file list parser is used to communicate input to InstallAPI.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Language
The language for the input, used to select and validate the language standard and possible actions.
@ Parameter
The parameter type of a method or function.
@ Result
The result type of a method or function.
llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
@ Other
Other implicit parameter.
Diagnostic wrappers for TextAPI types for error reporting.
Storage of availability attributes for a declaration.