16 #include "llvm/Support/ErrorHandling.h" 24 #define ABSTRACT_COMMENT(COMMENT) 25 #define COMMENT(CLASS, PARENT) \ 28 #include "clang/AST/CommentNodes.inc" 30 #undef ABSTRACT_COMMENT 32 llvm_unreachable(
"Unknown comment kind!");
45 static inline bad implements_child_begin_end(
50 #define ASSERT_IMPLEMENTS_child_begin(function) \ 51 (void) good(implements_child_begin_end(function)) 54 static inline void CheckCommentASTNodes() {
55 #define ABSTRACT_COMMENT(COMMENT) 56 #define COMMENT(CLASS, PARENT) \ 57 ASSERT_IMPLEMENTS_child_begin(&CLASS::child_begin); \ 58 ASSERT_IMPLEMENTS_child_begin(&CLASS::child_end); 59 #include "clang/AST/CommentNodes.inc" 61 #undef ABSTRACT_COMMENT 64 #undef ASSERT_IMPLEMENTS_child_begin 70 case NoCommentKind: llvm_unreachable(
"comment without a kind");
71 #define ABSTRACT_COMMENT(COMMENT) 72 #define COMMENT(CLASS, PARENT) \ 74 return static_cast<const CLASS *>(this)->child_begin(); 75 #include "clang/AST/CommentNodes.inc" 77 #undef ABSTRACT_COMMENT 79 llvm_unreachable(
"Unknown comment kind!");
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_end(); 89 #include "clang/AST/CommentNodes.inc" 91 #undef ABSTRACT_COMMENT 93 llvm_unreachable(
"Unknown comment kind!");
96 bool TextComment::isWhitespaceNoCache()
const {
97 for (StringRef::const_iterator I =
Text.begin(), E =
Text.end();
105 bool ParagraphComment::isWhitespaceNoCache()
const {
107 if (
const TextComment *TC = dyn_cast<TextComment>(*I)) {
108 if (!TC->isWhitespace())
121 return AttributeTL.getModifiedLoc();
133 return ATL.getOriginalLoc();
139 return ETL.getNamedTypeLoc();
146 while (PrevTL != TL) {
162 if (STL.getNumArgs() != 1)
187 llvm_unreachable(
"unknown PassDirection");
195 TemplateKind = NotTemplate;
196 IsObjCMethod =
false;
197 IsInstanceMethod =
false;
198 IsClassMethod =
false;
200 TemplateParameters =
nullptr;
207 CurrentDecl = CommentDecl;
215 case Decl::CXXMethod:
216 case Decl::CXXConstructor:
217 case Decl::CXXDestructor:
218 case Decl::CXXConversion: {
219 const FunctionDecl *FD = cast<FunctionDecl>(CommentDecl);
225 TemplateKind = TemplateSpecialization;
230 if (K == Decl::CXXMethod || K == Decl::CXXConstructor ||
231 K == Decl::CXXDestructor || K == Decl::CXXConversion) {
234 IsClassMethod = !IsInstanceMethod;
238 case Decl::ObjCMethod: {
245 IsClassMethod = !IsInstanceMethod;
248 case Decl::FunctionTemplate: {
251 TemplateKind = Template;
258 case Decl::ClassTemplate: {
261 TemplateKind = Template;
265 case Decl::ClassTemplatePartialSpecialization: {
267 cast<ClassTemplatePartialSpecializationDecl>(CommentDecl);
269 TemplateKind = TemplatePartialSpecialization;
273 case Decl::ClassTemplateSpecialization:
275 TemplateKind = TemplateSpecialization;
278 case Decl::CXXRecord:
283 case Decl::EnumConstant:
285 case Decl::ObjCAtDefsField:
286 case Decl::ObjCProperty: {
288 if (
const auto *VD = dyn_cast<DeclaratorDecl>(CommentDecl))
289 TSI = VD->getTypeSourceInfo();
290 else if (
const auto *PD = dyn_cast<ObjCPropertyDecl>(CommentDecl))
291 TSI = PD->getTypeSourceInfo();
305 case Decl::Namespace:
306 Kind = NamespaceKind;
308 case Decl::TypeAlias:
309 case Decl::Typedef: {
315 ? cast<TypedefDecl>(CommentDecl)->getTypeSourceInfo()
316 : cast<TypeAliasDecl>(CommentDecl)->getTypeSourceInfo();
328 case Decl::TypeAliasTemplate: {
331 TemplateKind = Template;
358 assert(isParamIndexValid());
365 assert(isPositionValid());
367 for (
unsigned i = 0, e = getDepth(); i != e; ++i) {
372 dyn_cast<TemplateTemplateParmDecl>(Param))
373 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