15#include "llvm/Support/ErrorHandling.h"
23#define ABSTRACT_COMMENT(COMMENT)
24#define COMMENT(CLASS, PARENT) \
25 static_assert(std::is_trivially_destructible<CLASS>::value, \
26 #CLASS " should be trivially destructible!");
27#include "clang/AST/CommentNodes.inc"
29#undef ABSTRACT_COMMENT
32static_assert(std::is_trivially_destructible_v<DeclInfo>,
33 "DeclInfo should be trivially destructible!");
39#define ABSTRACT_COMMENT(COMMENT)
40#define COMMENT(CLASS, PARENT) \
41 case CommentKind::CLASS: \
43#include "clang/AST/CommentNodes.inc"
45#undef ABSTRACT_COMMENT
47 llvm_unreachable(
"Unknown comment kind!");
60static inline bad implements_child_begin_end(
65#define ASSERT_IMPLEMENTS_child_begin(function) \
66 (void) good(implements_child_begin_end(function))
69static inline void CheckCommentASTNodes() {
70#define ABSTRACT_COMMENT(COMMENT)
71#define COMMENT(CLASS, PARENT) \
72 ASSERT_IMPLEMENTS_child_begin(&CLASS::child_begin); \
73 ASSERT_IMPLEMENTS_child_begin(&CLASS::child_end);
74#include "clang/AST/CommentNodes.inc"
76#undef ABSTRACT_COMMENT
79#undef ASSERT_IMPLEMENTS_child_begin
86 llvm_unreachable(
"comment without a kind");
87#define ABSTRACT_COMMENT(COMMENT)
88#define COMMENT(CLASS, PARENT) \
89 case CommentKind::CLASS: \
90 return static_cast<const CLASS *>(this)->child_begin();
91#include "clang/AST/CommentNodes.inc"
93#undef ABSTRACT_COMMENT
95 llvm_unreachable(
"Unknown comment kind!");
101 llvm_unreachable(
"comment without a kind");
102#define ABSTRACT_COMMENT(COMMENT)
103#define COMMENT(CLASS, PARENT) \
104 case CommentKind::CLASS: \
105 return static_cast<const CLASS *>(this)->child_end();
106#include "clang/AST/CommentNodes.inc"
108#undef ABSTRACT_COMMENT
110 llvm_unreachable(
"Unknown comment kind!");
113bool TextComment::isWhitespaceNoCache()
const {
117bool ParagraphComment::isWhitespaceNoCache()
const {
119 if (
const TextComment *TC = dyn_cast<TextComment>(*I)) {
120 if (!TC->isWhitespace())
133 return AttributeTL.getModifiedLoc();
145 return ATL.getOriginalLoc();
151 return ETL.getNamedTypeLoc();
158 while (PrevTL != TL) {
174 if (STL.getNumArgs() != 1)
200 llvm_unreachable(
"unknown PassDirection");
230 case Decl::CXXMethod:
231 case Decl::CXXConstructor:
232 case Decl::CXXDestructor:
233 case Decl::CXXConversion: {
245 if (K == Decl::CXXMethod || K == Decl::CXXConstructor ||
246 K == Decl::CXXDestructor || K == Decl::CXXConversion) {
255 case Decl::ObjCMethod: {
267 case Decl::FunctionTemplate: {
279 case Decl::ClassTemplate: {
286 case Decl::ClassTemplatePartialSpecialization: {
288 cast<ClassTemplatePartialSpecializationDecl>(
CommentDecl);
294 case Decl::ClassTemplateSpecialization:
299 case Decl::CXXRecord:
304 cast<VarDecl>(
CommentDecl)->getDescribedVarTemplate()) {
310 case Decl::EnumConstant:
312 case Decl::ObjCAtDefsField:
313 case Decl::ObjCProperty:
314 if (
const auto *VD = dyn_cast<DeclaratorDecl>(
CommentDecl))
315 TSI = VD->getTypeSourceInfo();
316 else if (
const auto *PD = dyn_cast<ObjCPropertyDecl>(
CommentDecl))
317 TSI = PD->getTypeSourceInfo();
320 case Decl::VarTemplate: {
326 TSI = VD->getTypeSourceInfo();
329 case Decl::Namespace:
332 case Decl::TypeAlias:
335 TSI = cast<TypedefNameDecl>(
CommentDecl)->getTypeSourceInfo();
337 case Decl::TypeAliasTemplate: {
343 TSI = TAD->getTypeSourceInfo();
359 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FTL.
getTypePtr()))
378 for (
unsigned i = 0, e =
getDepth(); i != e; ++i) {
379 assert(TPL &&
"Unknown TemplateParameterList");
383 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Param))
384 TPL = TTP->getTemplateParameters();
Defines the clang::ASTContext interface.
Defines the C++ template declaration subclasses.
Type source information for an attributed type.
Wrapper for source info for block pointers.
Represents a static or instance method of a struct/union/class.
Declaration of a class template.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
const TypeClass * getTypePtr() const
Kind
Lists the kind of concrete classes of Decl.
TemplateParameterList * getTemplateParameterList(unsigned index) const
unsigned getNumTemplateParameterLists() const
Represents a function declaration or definition.
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
bool isVariadic() const
Whether this function is variadic.
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Wrapper for source info for functions.
ArrayRef< ParmVarDecl * > getParams() const
TypeLoc getReturnLoc() const
Wrapper for source info for member pointers.
This represents a decl that may have a name.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
ObjCMethodDecl - Represents an instance or class method declaration.
ArrayRef< ParmVarDecl * > parameters() const
bool isInstanceMethod() const
QualType getReturnType() const
Wrapper for source info for pointers.
Wrapper of type source information for a type with non-trivial direct qualifiers.
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
TypeSourceInfo * getTypeSourceInfo() const
@ Type
The template argument is a type.
ArgKind getKind() const
Return the kind of stored template argument.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Declaration of an alias template.
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
TypeLoc IgnoreParens() const
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
Represents a variable declaration or definition.
Declaration of a variable template.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
The JSON file list parser is used to communicate input to InstallAPI.
LLVM_READONLY bool isWhitespace(unsigned char c)
Return true if this character is horizontal or vertical ASCII whitespace: ' ', '\t',...
const FunctionProtoType * T