Go to the documentation of this file.
15 #include "llvm/Support/ErrorHandling.h"
16 #include <type_traits>
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
32 static_assert(std::is_trivially_destructible<DeclInfo>::value,
33 "DeclInfo should be trivially destructible!");
38 #define ABSTRACT_COMMENT(COMMENT)
39 #define COMMENT(CLASS, PARENT) \
42 #include "clang/AST/CommentNodes.inc"
44 #undef ABSTRACT_COMMENT
46 llvm_unreachable(
"Unknown comment kind!");
59 static inline bad implements_child_begin_end(
64 #define ASSERT_IMPLEMENTS_child_begin(function) \
65 (void) good(implements_child_begin_end(function))
68 static inline void CheckCommentASTNodes() {
69 #define ABSTRACT_COMMENT(COMMENT)
70 #define COMMENT(CLASS, PARENT) \
71 ASSERT_IMPLEMENTS_child_begin(&CLASS::child_begin); \
72 ASSERT_IMPLEMENTS_child_begin(&CLASS::child_end);
73 #include "clang/AST/CommentNodes.inc"
75 #undef ABSTRACT_COMMENT
78 #undef ASSERT_IMPLEMENTS_child_begin
84 case NoCommentKind: llvm_unreachable(
"comment without a kind");
85 #define ABSTRACT_COMMENT(COMMENT)
86 #define COMMENT(CLASS, PARENT) \
88 return static_cast<const CLASS *>(this)->child_begin();
89 #include "clang/AST/CommentNodes.inc"
91 #undef ABSTRACT_COMMENT
93 llvm_unreachable(
"Unknown comment kind!");
98 case NoCommentKind: llvm_unreachable(
"comment without a kind");
99 #define ABSTRACT_COMMENT(COMMENT)
100 #define COMMENT(CLASS, PARENT) \
102 return static_cast<const CLASS *>(this)->child_end();
103 #include "clang/AST/CommentNodes.inc"
105 #undef ABSTRACT_COMMENT
107 llvm_unreachable(
"Unknown comment kind!");
110 bool TextComment::isWhitespaceNoCache()
const {
114 bool ParagraphComment::isWhitespaceNoCache()
const {
116 if (
const TextComment *TC = dyn_cast<TextComment>(*I)) {
117 if (!TC->isWhitespace())
130 return AttributeTL.getModifiedLoc();
142 return ATL.getOriginalLoc();
148 return ETL.getNamedTypeLoc();
155 while (PrevTL != TL) {
171 if (STL.getNumArgs() != 1)
196 llvm_unreachable(
"unknown PassDirection");
226 case Decl::CXXMethod:
227 case Decl::CXXConstructor:
228 case Decl::CXXDestructor:
229 case Decl::CXXConversion: {
241 if (K == Decl::CXXMethod || K == Decl::CXXConstructor ||
242 K == Decl::CXXDestructor || K == Decl::CXXConversion) {
251 case Decl::ObjCMethod: {
263 case Decl::FunctionTemplate: {
275 case Decl::ClassTemplate: {
282 case Decl::ClassTemplatePartialSpecialization: {
284 cast<ClassTemplatePartialSpecializationDecl>(
CommentDecl);
290 case Decl::ClassTemplateSpecialization:
295 case Decl::CXXRecord:
300 cast<VarDecl>(
CommentDecl)->getDescribedVarTemplate()) {
306 case Decl::EnumConstant:
308 case Decl::ObjCAtDefsField:
309 case Decl::ObjCProperty:
310 if (
const auto *VD = dyn_cast<DeclaratorDecl>(
CommentDecl))
311 TSI = VD->getTypeSourceInfo();
312 else if (
const auto *PD = dyn_cast<ObjCPropertyDecl>(
CommentDecl))
313 TSI = PD->getTypeSourceInfo();
316 case Decl::VarTemplate: {
322 TSI = VD->getTypeSourceInfo();
325 case Decl::Namespace:
328 case Decl::TypeAlias:
331 TSI = cast<TypedefNameDecl>(
CommentDecl)->getTypeSourceInfo();
333 case Decl::TypeAliasTemplate: {
339 TSI = TAD->getTypeSourceInfo();
355 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FTL.
getTypePtr()))
374 for (
unsigned i = 0, e =
getDepth(); i != e; ++i) {
375 assert(TPL &&
"Unknown TemplateParameterList");
379 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Param))
380 TPL = TTP->getTemplateParameters();
ArrayRef< ParmVarDecl * > getParams() const
QualType getReturnType() const
Wrapper for source info for block pointers.
Wrapper for source info for pointers.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
This represents a decl that may have a name.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
const TypeClass * getTypePtr() const
TypeSourceInfo * getTypeSourceInfo() const
Wrapper for source info for functions.
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Declaration of a template function.
Kind
Lists the kind of concrete classes of Decl.
ArgKind getKind() const
Return the kind of stored template argument.
NamedDecl * getParam(unsigned Idx)
TemplateParameterList * getTemplateParameterList(unsigned index) const
Wrapper of type source information for a type with non-trivial direct qualifiers.
Location wrapper for a TemplateArgument.
Represents a variable declaration or definition.
const TemplateArgument & getArgument() const
QualType getReturnType() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
Type source information for an attributed type.
Wrapper for source info for member pointers.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
LLVM_READONLY bool isWhitespace(unsigned char c)
Return true if this character is horizontal or vertical ASCII whitespace: ' ', '\t',...
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
Declaration of a class template.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
Base wrapper for a particular "section" of type source info.
bool isInstanceMethod() const
QualType getType() const
Get the type for which this source info wrapper provides information.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
TypeLoc IgnoreParens() const
ObjCMethodDecl - Represents an instance or class method declaration.
@ Type
The template argument is a type.
A container of type source information.
bool isVariadic() const
Whether this function is variadic.
Declaration of an alias template.
TypeLoc getReturnLoc() const
unsigned getNumTemplateParameterLists() const
ArrayRef< ParmVarDecl * > parameters() const
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Declaration of a variable template.
ArrayRef< ParmVarDecl * > parameters() const
Represents a function declaration or definition.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
Represents a static or instance method of a struct/union/class.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.