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");
215 case Decl::CXXMethod:
216 case Decl::CXXConstructor:
217 case Decl::CXXDestructor:
218 case Decl::CXXConversion: {
230 if (K == Decl::CXXMethod || K == Decl::CXXConstructor ||
231 K == Decl::CXXDestructor || K == Decl::CXXConversion) {
238 case Decl::ObjCMethod: {
248 case Decl::FunctionTemplate: {
258 case Decl::ClassTemplate: {
265 case Decl::ClassTemplatePartialSpecialization: {
267 cast<ClassTemplatePartialSpecializationDecl>(
CommentDecl);
273 case Decl::ClassTemplateSpecialization:
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:
308 case Decl::TypeAlias:
309 case Decl::Typedef: {
315 ? cast<TypedefDecl>(
CommentDecl)->getTypeSourceInfo()
316 : cast<TypeAliasDecl>(
CommentDecl)->getTypeSourceInfo();
328 case Decl::TypeAliasTemplate: {
367 for (
unsigned i = 0, e =
getDepth(); i != e; ++i) {
372 dyn_cast<TemplateTemplateParmDecl>(Param))
373 TPL = TTP->getTemplateParameters();
Defines the clang::ASTContext interface.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
static LLVM_READONLY bool isWhitespace(unsigned char c)
Return true if this character is horizontal or vertical ASCII whitespace: ' ', '\t', '\f', '\v', '\n', '\r'.
Defines the C++ template declaration subclasses.
NamedDecl * getParam(unsigned Idx)
A container of type source information.
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.
QualType getReturnType() const
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
TypeSourceInfo * getTypeSourceInfo() const
Wrapper for source info for functions.
detail::InMemoryDirectory::const_iterator I
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
Type source information for an attributed type.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
ArgKind getKind() const
Return the kind of stored template argument.
QualType getType() const
Get the type for which this source info wrapper provides information.
bool isInstanceMethod() const
Declaration of an alias template.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
ArrayRef< ParmVarDecl * > parameters() const
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Represents a static or instance method of a struct/union/class.
ArrayRef< ParmVarDecl * > parameters() const
QualType getReturnType() const
TypeLoc getReturnLoc() const
TypeLoc IgnoreParens() const
detail::InMemoryDirectory::const_iterator E
Location wrapper for a TemplateArgument.
The template argument is a type.
Declaration of a class template.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
ArrayRef< ParmVarDecl * > getParams() const
Kind
Lists the kind of concrete classes of Decl.
TemplateParameterList * getTemplateParameterList(unsigned index) const
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
NamedDecl - This represents a decl with a name.
TypeSourceInfo * getTypeSourceInfo() const
const TemplateArgument & getArgument() const
Wrapper for source info for pointers.
Wrapper for source info for block pointers.
Declaration of a template function.
unsigned getNumTemplateParameterLists() const