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 {
111 for (StringRef::const_iterator I =
Text.begin(), E =
Text.end();
119 bool ParagraphComment::isWhitespaceNoCache()
const {
121 if (
const TextComment *TC = dyn_cast<TextComment>(*I)) {
122 if (!TC->isWhitespace())
135 return AttributeTL.getModifiedLoc();
147 return ATL.getOriginalLoc();
153 return ETL.getNamedTypeLoc();
160 while (PrevTL != TL) {
176 if (STL.getNumArgs() != 1)
201 llvm_unreachable(
"unknown PassDirection");
209 TemplateKind = NotTemplate;
210 IsObjCMethod =
false;
211 IsInstanceMethod =
false;
212 IsClassMethod =
false;
214 TemplateParameters =
nullptr;
221 CurrentDecl = CommentDecl;
229 case Decl::CXXMethod:
230 case Decl::CXXConstructor:
231 case Decl::CXXDestructor:
232 case Decl::CXXConversion: {
233 const FunctionDecl *FD = cast<FunctionDecl>(CommentDecl);
239 TemplateKind = TemplateSpecialization;
244 if (K == Decl::CXXMethod || K == Decl::CXXConstructor ||
245 K == Decl::CXXDestructor || K == Decl::CXXConversion) {
248 IsClassMethod = !IsInstanceMethod;
252 case Decl::ObjCMethod: {
259 IsClassMethod = !IsInstanceMethod;
262 case Decl::FunctionTemplate: {
265 TemplateKind = Template;
272 case Decl::ClassTemplate: {
275 TemplateKind = Template;
279 case Decl::ClassTemplatePartialSpecialization: {
281 cast<ClassTemplatePartialSpecializationDecl>(CommentDecl);
283 TemplateKind = TemplatePartialSpecialization;
287 case Decl::ClassTemplateSpecialization:
289 TemplateKind = TemplateSpecialization;
292 case Decl::CXXRecord:
297 case Decl::EnumConstant:
299 case Decl::ObjCAtDefsField:
300 case Decl::ObjCProperty: {
302 if (
const auto *VD = dyn_cast<DeclaratorDecl>(CommentDecl))
303 TSI = VD->getTypeSourceInfo();
304 else if (
const auto *PD = dyn_cast<ObjCPropertyDecl>(CommentDecl))
305 TSI = PD->getTypeSourceInfo();
319 case Decl::Namespace:
320 Kind = NamespaceKind;
322 case Decl::TypeAlias:
323 case Decl::Typedef: {
329 ? cast<TypedefDecl>(CommentDecl)->getTypeSourceInfo()
330 : cast<TypeAliasDecl>(CommentDecl)->getTypeSourceInfo();
342 case Decl::TypeAliasTemplate: {
345 TemplateKind = Template;
372 assert(isParamIndexValid());
379 assert(isPositionValid());
381 for (
unsigned i = 0, e = getDepth(); i != e; ++i) {
386 dyn_cast<TemplateTemplateParmDecl>(Param))
387 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