15 #include "llvm/Support/ErrorHandling.h" 23 #define ABSTRACT_COMMENT(COMMENT) 24 #define COMMENT(CLASS, PARENT) \ 27 #include "clang/AST/CommentNodes.inc" 29 #undef ABSTRACT_COMMENT 31 llvm_unreachable(
"Unknown comment kind!");
44 static inline bad implements_child_begin_end(
49 #define ASSERT_IMPLEMENTS_child_begin(function) \ 50 (void) good(implements_child_begin_end(function)) 53 static inline void CheckCommentASTNodes() {
54 #define ABSTRACT_COMMENT(COMMENT) 55 #define COMMENT(CLASS, PARENT) \ 56 ASSERT_IMPLEMENTS_child_begin(&CLASS::child_begin); \ 57 ASSERT_IMPLEMENTS_child_begin(&CLASS::child_end); 58 #include "clang/AST/CommentNodes.inc" 60 #undef ABSTRACT_COMMENT 63 #undef ASSERT_IMPLEMENTS_child_begin 69 case NoCommentKind: llvm_unreachable(
"comment without a kind");
70 #define ABSTRACT_COMMENT(COMMENT) 71 #define COMMENT(CLASS, PARENT) \ 73 return static_cast<const CLASS *>(this)->child_begin(); 74 #include "clang/AST/CommentNodes.inc" 76 #undef ABSTRACT_COMMENT 78 llvm_unreachable(
"Unknown comment kind!");
83 case NoCommentKind: llvm_unreachable(
"comment without a kind");
84 #define ABSTRACT_COMMENT(COMMENT) 85 #define COMMENT(CLASS, PARENT) \ 87 return static_cast<const CLASS *>(this)->child_end(); 88 #include "clang/AST/CommentNodes.inc" 90 #undef ABSTRACT_COMMENT 92 llvm_unreachable(
"Unknown comment kind!");
95 bool TextComment::isWhitespaceNoCache()
const {
96 for (StringRef::const_iterator I =
Text.begin(), E =
Text.end();
104 bool ParagraphComment::isWhitespaceNoCache()
const {
106 if (
const TextComment *TC = dyn_cast<TextComment>(*I)) {
107 if (!TC->isWhitespace())
120 return AttributeTL.getModifiedLoc();
132 return ATL.getOriginalLoc();
138 return ETL.getNamedTypeLoc();
145 while (PrevTL != TL) {
161 if (STL.getNumArgs() != 1)
186 llvm_unreachable(
"unknown PassDirection");
194 TemplateKind = NotTemplate;
195 IsObjCMethod =
false;
196 IsInstanceMethod =
false;
197 IsClassMethod =
false;
199 TemplateParameters =
nullptr;
206 CurrentDecl = CommentDecl;
214 case Decl::CXXMethod:
215 case Decl::CXXConstructor:
216 case Decl::CXXDestructor:
217 case Decl::CXXConversion: {
218 const FunctionDecl *FD = cast<FunctionDecl>(CommentDecl);
224 TemplateKind = TemplateSpecialization;
229 if (K == Decl::CXXMethod || K == Decl::CXXConstructor ||
230 K == Decl::CXXDestructor || K == Decl::CXXConversion) {
233 IsClassMethod = !IsInstanceMethod;
237 case Decl::ObjCMethod: {
244 IsClassMethod = !IsInstanceMethod;
247 case Decl::FunctionTemplate: {
250 TemplateKind = Template;
257 case Decl::ClassTemplate: {
260 TemplateKind = Template;
264 case Decl::ClassTemplatePartialSpecialization: {
266 cast<ClassTemplatePartialSpecializationDecl>(CommentDecl);
268 TemplateKind = TemplatePartialSpecialization;
272 case Decl::ClassTemplateSpecialization:
274 TemplateKind = TemplateSpecialization;
277 case Decl::CXXRecord:
282 case Decl::EnumConstant:
284 case Decl::ObjCAtDefsField:
285 case Decl::ObjCProperty: {
287 if (
const auto *VD = dyn_cast<DeclaratorDecl>(CommentDecl))
288 TSI = VD->getTypeSourceInfo();
289 else if (
const auto *PD = dyn_cast<ObjCPropertyDecl>(CommentDecl))
290 TSI = PD->getTypeSourceInfo();
304 case Decl::Namespace:
305 Kind = NamespaceKind;
307 case Decl::TypeAlias:
308 case Decl::Typedef: {
314 ? cast<TypedefDecl>(CommentDecl)->getTypeSourceInfo()
315 : cast<TypeAliasDecl>(CommentDecl)->getTypeSourceInfo();
327 case Decl::TypeAliasTemplate: {
330 TemplateKind = Template;
357 assert(isParamIndexValid());
364 assert(isPositionValid());
366 for (
unsigned i = 0, e = getDepth();
i != e; ++
i) {
371 dyn_cast<TemplateTemplateParmDecl>(Param))
372 TPL = TTP->getTemplateParameters();
Defines the clang::ASTContext interface.
Represents a function declaration or definition.
Defines the C++ template declaration subclasses.
NamedDecl * getParam(unsigned Idx)
A container of type source information.
constexpr XRayInstrMask Function
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
QualType getReturnType() const
Wrapper for source info for member pointers.
Wrapper of type source information for a type with non-trivial direct qualifiers. ...
ObjCMethodDecl - Represents an instance or class method declaration.
Stores a list of template parameters for a TemplateDecl and its derived classes.
Base wrapper for a particular "section" of type source info.
TypeSourceInfo * getTypeSourceInfo() const
ArrayRef< ParmVarDecl * > parameters() const
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
LLVM_READONLY bool isWhitespace(unsigned char c)
Return true if this character is horizontal or vertical ASCII whitespace: ' ', '\t', '\f', '\v', '\n', '\r'.
Wrapper for source info for functions.
QualType getReturnType() const
Represents the declaration of a typedef-name via a C++11 alias-declaration.
TypeSourceInfo * getTypeSourceInfo() const
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Type source information for an attributed type.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
TemplateParameterList * getTemplateParameterList(unsigned index) const
Declaration of an alias template.
bool isInstanceMethod() const
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
TypeLoc getReturnLoc() const
TypeLoc IgnoreParens() const
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Represents a static or instance method of a struct/union/class.
ArrayRef< ParmVarDecl * > getParams() const
Dataflow Directional Tag Classes.
const TemplateArgument & getArgument() const
QualType getType() const
Get the type for which this source info wrapper provides information.
unsigned getNumTemplateParameterLists() const
Location wrapper for a TemplateArgument.
The template argument is a type.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
ArgKind getKind() const
Return the kind of stored template argument.
Declaration of a class template.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Kind
Lists the kind of concrete classes of Decl.
This represents a decl that may have a name.
Wrapper for source info for pointers.
Wrapper for source info for block pointers.
Declaration of a template function.
ArrayRef< ParmVarDecl * > parameters() const