clang 23.0.0git
CommentSema.cpp
Go to the documentation of this file.
1//===--- CommentSema.cpp - Doxygen comment semantic analysis --------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "clang/AST/Attr.h"
12#include "clang/AST/Decl.h"
15#include "clang/Basic/LLVM.h"
19#include "llvm/ADT/StringSwitch.h"
20
21namespace clang {
22namespace comments {
23
24namespace {
25#include "clang/AST/CommentHTMLTagsProperties.inc"
26} // end anonymous namespace
27
28Sema::Sema(llvm::BumpPtrAllocator &Allocator, const SourceManager &SourceMgr,
29 DiagnosticsEngine &Diags, CommandTraits &Traits,
30 const Preprocessor *PP) :
31 Allocator(Allocator), SourceMgr(SourceMgr), Diags(Diags), Traits(Traits),
32 PP(PP), ThisDeclInfo(nullptr), BriefCommand(nullptr),
33 HeaderfileCommand(nullptr) {
34}
35
36void Sema::setDecl(const Decl *D) {
37 if (!D)
38 return;
39
40 ThisDeclInfo = new (Allocator) DeclInfo;
41 ThisDeclInfo->CommentDecl = D;
42 ThisDeclInfo->IsFilled = false;
43}
44
49
51 SourceLocation LocBegin,
52 SourceLocation LocEnd,
53 unsigned CommandID,
54 CommandMarkerKind CommandMarker) {
55 BlockCommandComment *BC = new (Allocator) BlockCommandComment(LocBegin, LocEnd,
56 CommandID,
57 CommandMarker);
58 checkContainerDecl(BC);
59 return BC;
60}
61
66
68 ParagraphComment *Paragraph) {
69 Command->setParagraph(Paragraph);
70 checkBlockCommandEmptyParagraph(Command);
71 checkBlockCommandDuplicate(Command);
72 if (ThisDeclInfo) {
73 // These checks only make sense if the comment is attached to a
74 // declaration.
75 checkReturnsCommand(Command);
76 checkDeprecatedCommand(Command);
77 }
78}
79
81 SourceLocation LocBegin,
82 SourceLocation LocEnd,
83 unsigned CommandID,
84 CommandMarkerKind CommandMarker) {
85 ParamCommandComment *Command =
86 new (Allocator) ParamCommandComment(LocBegin, LocEnd, CommandID,
87 CommandMarker);
88
89 if (!involvesFunctionType())
90 Diag(Command->getLocation(),
91 diag::warn_doc_param_not_attached_to_a_function_decl)
92 << CommandMarker
93 << Command->getCommandNameRange(Traits);
94
95 return Command;
96}
97
98void Sema::checkFunctionDeclVerbatimLine(const BlockCommandComment *Comment) {
99 const CommandInfo *Info = Traits.getCommandInfo(Comment->getCommandID());
101 return;
102
103 std::optional<unsigned> DiagSelect;
104 switch (Comment->getCommandID()) {
105 case CommandTraits::KCI_function:
106 if (!isAnyFunctionDecl() && !isFunctionTemplateDecl())
107 DiagSelect = diag::CallableKind::Function;
108 break;
109 case CommandTraits::KCI_functiongroup:
110 if (!isAnyFunctionDecl() && !isFunctionTemplateDecl())
111 DiagSelect = diag::CallableKind::FunctionGroup;
112 break;
113 case CommandTraits::KCI_method:
114 DiagSelect = diag::CallableKind::Method;
115 break;
116 case CommandTraits::KCI_methodgroup:
117 DiagSelect = diag::CallableKind::MethodGroup;
118 break;
119 case CommandTraits::KCI_callback:
120 DiagSelect = diag::CallableKind::Callback;
121 break;
122 }
123 if (DiagSelect)
124 Diag(Comment->getLocation(), diag::warn_doc_function_method_decl_mismatch)
125 << Comment->getCommandMarker() << (*DiagSelect) << (*DiagSelect)
126 << Comment->getSourceRange();
127}
128
129void Sema::checkContainerDeclVerbatimLine(const BlockCommandComment *Comment) {
130 const CommandInfo *Info = Traits.getCommandInfo(Comment->getCommandID());
131 if (!Info->IsRecordLikeDeclarationCommand)
132 return;
133 std::optional<unsigned> DiagSelect;
134 switch (Comment->getCommandID()) {
135 case CommandTraits::KCI_class:
136 if (!isClassOrStructOrTagTypedefDecl() && !isClassTemplateDecl())
137 DiagSelect = diag::DeclContainerKind::Class;
138
139 // Allow @class command on @interface declarations.
140 // FIXME. Currently, \class and @class are indistinguishable. So,
141 // \class is also allowed on an @interface declaration
142 if (DiagSelect && Comment->getCommandMarker() && isObjCInterfaceDecl())
143 DiagSelect = std::nullopt;
144 break;
145 case CommandTraits::KCI_interface:
146 if (!isObjCInterfaceDecl())
147 DiagSelect = diag::DeclContainerKind::Interface;
148 break;
149 case CommandTraits::KCI_protocol:
150 if (!isObjCProtocolDecl())
151 DiagSelect = diag::DeclContainerKind::Protocol;
152 break;
153 case CommandTraits::KCI_struct:
154 if (!isClassOrStructOrTagTypedefDecl())
155 DiagSelect = diag::DeclContainerKind::Struct;
156 break;
157 case CommandTraits::KCI_union:
158 if (!isUnionDecl())
159 DiagSelect = diag::DeclContainerKind::Union;
160 break;
161 default:
162 DiagSelect = std::nullopt;
163 break;
164 }
165 if (DiagSelect)
166 Diag(Comment->getLocation(), diag::warn_doc_api_container_decl_mismatch)
167 << Comment->getCommandMarker() << (*DiagSelect) << (*DiagSelect)
168 << Comment->getSourceRange();
169}
170
171void Sema::checkContainerDecl(const BlockCommandComment *Comment) {
172 const CommandInfo *Info = Traits.getCommandInfo(Comment->getCommandID());
173 if (!Info->IsRecordLikeDetailCommand || isRecordLikeDecl())
174 return;
175 std::optional<unsigned> DiagSelect;
176 switch (Comment->getCommandID()) {
177 case CommandTraits::KCI_classdesign:
178 DiagSelect = diag::DocCommandKind::ClassDesign;
179 break;
180 case CommandTraits::KCI_coclass:
181 DiagSelect = diag::DocCommandKind::CoClass;
182 break;
183 case CommandTraits::KCI_dependency:
184 DiagSelect = diag::DocCommandKind::Dependency;
185 break;
186 case CommandTraits::KCI_helper:
187 DiagSelect = diag::DocCommandKind::Helper;
188 break;
189 case CommandTraits::KCI_helperclass:
190 DiagSelect = diag::DocCommandKind::HelperClass;
191 break;
192 case CommandTraits::KCI_helps:
193 DiagSelect = diag::DocCommandKind::Helps;
194 break;
195 case CommandTraits::KCI_instancesize:
196 DiagSelect = diag::DocCommandKind::InstanceSize;
197 break;
198 case CommandTraits::KCI_ownership:
199 DiagSelect = diag::DocCommandKind::Ownership;
200 break;
201 case CommandTraits::KCI_performance:
202 DiagSelect = diag::DocCommandKind::Performance;
203 break;
204 case CommandTraits::KCI_security:
205 DiagSelect = diag::DocCommandKind::Security;
206 break;
207 case CommandTraits::KCI_superclass:
208 DiagSelect = diag::DocCommandKind::Superclass;
209 break;
210 default:
211 DiagSelect = std::nullopt;
212 break;
213 }
214 if (DiagSelect)
215 Diag(Comment->getLocation(), diag::warn_doc_container_decl_mismatch)
216 << Comment->getCommandMarker() << (*DiagSelect)
217 << Comment->getSourceRange();
218}
219
220/// Turn a string into the corresponding PassDirection or -1 if it's not
221/// valid.
223 return llvm::StringSwitch<ParamCommandPassDirection>(Arg)
224 .Case("[in]", ParamCommandPassDirection::In)
225 .Case("[out]", ParamCommandPassDirection::Out)
226 .Cases({"[in,out]", "[out,in]"}, ParamCommandPassDirection::InOut)
227 .Default(static_cast<ParamCommandPassDirection>(-1));
228}
229
231 SourceLocation ArgLocBegin,
232 SourceLocation ArgLocEnd,
233 StringRef Arg) {
234 std::string ArgLower = Arg.lower();
236
237 if (Direction == static_cast<ParamCommandPassDirection>(-1)) {
238 // Try again with whitespace removed.
239 llvm::erase_if(ArgLower, clang::isWhitespace);
240 Direction = getParamPassDirection(ArgLower);
241
242 SourceRange ArgRange(ArgLocBegin, ArgLocEnd);
243 if (Direction != static_cast<ParamCommandPassDirection>(-1)) {
244 const char *FixedName =
246 Diag(ArgLocBegin, diag::warn_doc_param_spaces_in_direction)
247 << ArgRange << FixItHint::CreateReplacement(ArgRange, FixedName);
248 } else {
249 Diag(ArgLocBegin, diag::warn_doc_param_invalid_direction) << ArgRange;
250 Direction = ParamCommandPassDirection::In; // Sane fall back.
251 }
252 }
253 Command->setDirection(Direction,
254 /*Explicit=*/true);
255}
256
258 SourceLocation ArgLocBegin,
259 SourceLocation ArgLocEnd,
260 StringRef Arg) {
261 // Parser will not feed us more arguments than needed.
262 assert(Command->getNumArgs() == 0);
263
264 if (!Command->isDirectionExplicit()) {
265 // User didn't provide a direction argument.
267 /* Explicit = */ false);
268 }
269 auto *A = new (Allocator)
270 Comment::Argument{SourceRange(ArgLocBegin, ArgLocEnd), Arg};
271 Command->setArgs(ArrayRef(A, 1));
272}
273
275 ParagraphComment *Paragraph) {
276 Command->setParagraph(Paragraph);
277 checkBlockCommandEmptyParagraph(Command);
278}
279
281 SourceLocation LocBegin,
282 SourceLocation LocEnd,
283 unsigned CommandID,
284 CommandMarkerKind CommandMarker) {
285 TParamCommandComment *Command =
286 new (Allocator) TParamCommandComment(LocBegin, LocEnd, CommandID,
287 CommandMarker);
288
289 if (isExplicitFunctionTemplateInstantiation()) {
290 // Do not warn on explicit instantiations, since the documentation
291 // comments are on the primary template.
292 return Command;
293 }
294
295 if (!isTemplateOrSpecialization())
296 Diag(Command->getLocation(),
297 diag::warn_doc_tparam_not_attached_to_a_template_decl)
298 << CommandMarker
299 << Command->getCommandNameRange(Traits);
300
301 return Command;
302}
303
305 SourceLocation ArgLocBegin,
306 SourceLocation ArgLocEnd,
307 StringRef Arg) {
308 // Parser will not feed us more arguments than needed.
309 assert(Command->getNumArgs() == 0);
310
311 auto *A = new (Allocator)
312 Comment::Argument{SourceRange(ArgLocBegin, ArgLocEnd), Arg};
313 Command->setArgs(ArrayRef(A, 1));
314
315 if (!isTemplateOrSpecialization()) {
316 // We already warned that this \\tparam is not attached to a template decl.
317 return;
318 }
319
320 const TemplateParameterList *TemplateParameters =
321 ThisDeclInfo->TemplateParameters;
323 if (resolveTParamReference(Arg, TemplateParameters, &Position)) {
324 Command->setPosition(copyArray(ArrayRef(Position)));
325 TParamCommandComment *&PrevCommand = TemplateParameterDocs[Arg];
326 if (PrevCommand) {
327 SourceRange ArgRange(ArgLocBegin, ArgLocEnd);
328 Diag(ArgLocBegin, diag::warn_doc_tparam_duplicate)
329 << Arg << ArgRange;
330 Diag(PrevCommand->getLocation(), diag::note_doc_tparam_previous)
331 << PrevCommand->getParamNameRange();
332 }
333 PrevCommand = Command;
334 return;
335 }
336
337 SourceRange ArgRange(ArgLocBegin, ArgLocEnd);
338 Diag(ArgLocBegin, diag::warn_doc_tparam_not_found)
339 << Arg << ArgRange;
340
341 if (!TemplateParameters || TemplateParameters->size() == 0)
342 return;
343
344 StringRef CorrectedName;
345 if (TemplateParameters->size() == 1) {
346 const NamedDecl *Param = TemplateParameters->getParam(0);
347 const IdentifierInfo *II = Param->getIdentifier();
348 if (II)
349 CorrectedName = II->getName();
350 } else {
351 CorrectedName = correctTypoInTParamReference(Arg, TemplateParameters);
352 }
353
354 if (!CorrectedName.empty()) {
355 Diag(ArgLocBegin, diag::note_doc_tparam_name_suggestion)
356 << CorrectedName
357 << FixItHint::CreateReplacement(ArgRange, CorrectedName);
358 }
359}
360
362 ParagraphComment *Paragraph) {
363 Command->setParagraph(Paragraph);
364 checkBlockCommandEmptyParagraph(Command);
365}
366
369 SourceLocation CommandLocEnd, unsigned CommandID,
370 CommandMarkerKind CommandMarker,
372 StringRef CommandName = Traits.getCommandInfo(CommandID)->Name;
373
374 return new (Allocator) InlineCommandComment(
375 CommandLocBegin, CommandLocEnd, CommandID,
376 getInlineCommandRenderKind(CommandName), CommandMarker, Args);
377}
378
380 SourceLocation LocEnd,
381 StringRef CommandName) {
382 unsigned CommandID = Traits.registerUnknownCommand(CommandName)->getID();
383 return actOnUnknownCommand(LocBegin, LocEnd, CommandID);
384}
385
387 SourceLocation LocEnd,
388 unsigned CommandID) {
390 return new (Allocator) InlineCommandComment(
391 LocBegin, LocEnd, CommandID, InlineCommandRenderKind::Normal, Args);
392}
393
395 SourceLocation LocEnd,
396 StringRef Text) {
397 return new (Allocator) TextComment(LocBegin, LocEnd, Text);
398}
399
401 unsigned CommandID) {
402 StringRef CommandName = Traits.getCommandInfo(CommandID)->Name;
403 return new (Allocator) VerbatimBlockComment(
404 Loc,
405 Loc.getLocWithOffset(1 + CommandName.size()),
406 CommandID);
407}
408
410 StringRef Text) {
411 return new (Allocator) VerbatimBlockLineComment(Loc, Text);
412}
413
416 SourceLocation CloseNameLocBegin,
417 StringRef CloseName,
419 Block->setCloseName(CloseName, CloseNameLocBegin);
420 Block->setLines(Lines);
421}
422
424 unsigned CommandID,
425 SourceLocation TextBegin,
426 StringRef Text) {
427 VerbatimLineComment *VL = new (Allocator) VerbatimLineComment(
428 LocBegin,
429 TextBegin.getLocWithOffset(Text.size()),
430 CommandID,
431 TextBegin,
432 Text);
433 checkFunctionDeclVerbatimLine(VL);
434 checkContainerDeclVerbatimLine(VL);
435 return VL;
436}
437
439 StringRef TagName) {
440 return new (Allocator) HTMLStartTagComment(LocBegin, TagName);
441}
442
446 SourceLocation GreaterLoc,
447 bool IsSelfClosing) {
448 Tag->setAttrs(Attrs);
449 Tag->setGreaterLoc(GreaterLoc);
450 if (IsSelfClosing)
451 Tag->setSelfClosing();
452 else if (!isHTMLEndTagForbidden(Tag->getTagName()))
453 HTMLOpenTags.push_back(Tag);
454}
455
457 SourceLocation LocEnd,
458 StringRef TagName) {
459 HTMLEndTagComment *HET =
460 new (Allocator) HTMLEndTagComment(LocBegin, LocEnd, TagName);
461 if (isHTMLEndTagForbidden(TagName)) {
462 Diag(HET->getLocation(), diag::warn_doc_html_end_forbidden)
463 << TagName << HET->getSourceRange();
464 HET->setIsMalformed();
465 return HET;
466 }
467
468 bool FoundOpen = false;
470 I = HTMLOpenTags.rbegin(), E = HTMLOpenTags.rend();
471 I != E; ++I) {
472 if ((*I)->getTagName() == TagName) {
473 FoundOpen = true;
474 break;
475 }
476 }
477 if (!FoundOpen) {
478 Diag(HET->getLocation(), diag::warn_doc_html_end_unbalanced)
479 << HET->getSourceRange();
480 HET->setIsMalformed();
481 return HET;
482 }
483
484 while (!HTMLOpenTags.empty()) {
485 HTMLStartTagComment *HST = HTMLOpenTags.pop_back_val();
486 StringRef LastNotClosedTagName = HST->getTagName();
487 if (LastNotClosedTagName == TagName) {
488 // If the start tag is malformed, end tag is malformed as well.
489 if (HST->isMalformed())
490 HET->setIsMalformed();
491 break;
492 }
493
494 if (isHTMLEndTagOptional(LastNotClosedTagName))
495 continue;
496
497 bool OpenLineInvalid;
498 const unsigned OpenLine = SourceMgr.getPresumedLineNumber(
499 HST->getLocation(),
500 &OpenLineInvalid);
501 bool CloseLineInvalid;
502 const unsigned CloseLine = SourceMgr.getPresumedLineNumber(
503 HET->getLocation(),
504 &CloseLineInvalid);
505
506 if (OpenLineInvalid || CloseLineInvalid || OpenLine == CloseLine) {
507 Diag(HST->getLocation(), diag::warn_doc_html_start_end_mismatch)
508 << HST->getTagName() << HET->getTagName()
509 << HST->getSourceRange() << HET->getSourceRange();
510 HST->setIsMalformed();
511 } else {
512 Diag(HST->getLocation(), diag::warn_doc_html_start_end_mismatch)
513 << HST->getTagName() << HET->getTagName()
514 << HST->getSourceRange();
515 Diag(HET->getLocation(), diag::note_doc_html_end_tag)
516 << HET->getSourceRange();
517 HST->setIsMalformed();
518 }
519 }
520
521 return HET;
522}
523
526 FullComment *FC = new (Allocator) FullComment(Blocks, ThisDeclInfo);
527 resolveParamCommandIndexes(FC);
528
529 // Complain about HTML tags that are not closed.
530 while (!HTMLOpenTags.empty()) {
531 HTMLStartTagComment *HST = HTMLOpenTags.pop_back_val();
532 if (isHTMLEndTagOptional(HST->getTagName()))
533 continue;
534
535 Diag(HST->getLocation(), diag::warn_doc_html_missing_end_tag)
536 << HST->getTagName() << HST->getSourceRange();
537 HST->setIsMalformed();
538 }
539
540 return FC;
541}
542
543void Sema::checkBlockCommandEmptyParagraph(BlockCommandComment *Command) {
544 if (Traits.getCommandInfo(Command->getCommandID())->IsEmptyParagraphAllowed)
545 return;
546
547 ParagraphComment *Paragraph = Command->getParagraph();
548 if (Paragraph->isWhitespace()) {
549 SourceLocation DiagLoc;
550 if (Command->getNumArgs() > 0)
551 DiagLoc = Command->getArgRange(Command->getNumArgs() - 1).getEnd();
552 if (!DiagLoc.isValid())
553 DiagLoc = Command->getCommandNameRange(Traits).getEnd();
554 Diag(DiagLoc, diag::warn_doc_block_command_empty_paragraph)
555 << Command->getCommandMarker()
556 << Command->getCommandName(Traits)
557 << Command->getSourceRange();
558 }
559}
560
561void Sema::checkReturnsCommand(const BlockCommandComment *Command) {
562 if (!Traits.getCommandInfo(Command->getCommandID())->IsReturnsCommand)
563 return;
564
565 assert(ThisDeclInfo && "should not call this check on a bare comment");
566
567 // We allow the return command for all @properties because it can be used
568 // to document the value that the property getter returns.
569 if (isObjCPropertyDecl())
570 return;
571 if (involvesFunctionType()) {
572 assert(!ThisDeclInfo->ReturnType.isNull() &&
573 "should have a valid return type");
574 if (ThisDeclInfo->ReturnType->isVoidType()) {
575 unsigned DiagKind;
576 switch (ThisDeclInfo->CommentDecl->getKind()) {
577 default:
578 if (ThisDeclInfo->IsObjCMethod)
579 DiagKind = 3;
580 else
581 DiagKind = 0;
582 break;
583 case Decl::CXXConstructor:
584 DiagKind = 1;
585 break;
586 case Decl::CXXDestructor:
587 DiagKind = 2;
588 break;
589 }
590 Diag(Command->getLocation(),
591 diag::warn_doc_returns_attached_to_a_void_function)
592 << Command->getCommandMarker()
593 << Command->getCommandName(Traits)
594 << DiagKind
595 << Command->getSourceRange();
596 }
597 return;
598 }
599
600 Diag(Command->getLocation(),
601 diag::warn_doc_returns_not_attached_to_a_function_decl)
602 << Command->getCommandMarker()
603 << Command->getCommandName(Traits)
604 << Command->getSourceRange();
605}
606
607void Sema::checkBlockCommandDuplicate(const BlockCommandComment *Command) {
608 const CommandInfo *Info = Traits.getCommandInfo(Command->getCommandID());
609 const BlockCommandComment *PrevCommand = nullptr;
610 if (Info->IsBriefCommand) {
611 if (!BriefCommand) {
612 BriefCommand = Command;
613 return;
614 }
615 PrevCommand = BriefCommand;
616 } else if (Info->IsHeaderfileCommand) {
617 if (!HeaderfileCommand) {
618 HeaderfileCommand = Command;
619 return;
620 }
621 PrevCommand = HeaderfileCommand;
622 } else {
623 // We don't want to check this command for duplicates.
624 return;
625 }
626 StringRef CommandName = Command->getCommandName(Traits);
627 StringRef PrevCommandName = PrevCommand->getCommandName(Traits);
628 Diag(Command->getLocation(), diag::warn_doc_block_command_duplicate)
629 << Command->getCommandMarker()
630 << CommandName
631 << Command->getSourceRange();
632 if (CommandName == PrevCommandName)
633 Diag(PrevCommand->getLocation(), diag::note_doc_block_command_previous)
634 << PrevCommand->getCommandMarker()
635 << PrevCommandName
636 << PrevCommand->getSourceRange();
637 else
638 Diag(PrevCommand->getLocation(),
639 diag::note_doc_block_command_previous_alias)
640 << PrevCommand->getCommandMarker()
641 << PrevCommandName
642 << CommandName;
643}
644
645void Sema::checkDeprecatedCommand(const BlockCommandComment *Command) {
646 if (!Traits.getCommandInfo(Command->getCommandID())->IsDeprecatedCommand)
647 return;
648
649 assert(ThisDeclInfo && "should not call this check on a bare comment");
650
651 const Decl *D = ThisDeclInfo->CommentDecl;
652 if (!D)
653 return;
654
655 if (D->hasAttr<DeprecatedAttr>() ||
656 D->hasAttr<AvailabilityAttr>() ||
657 D->hasAttr<UnavailableAttr>())
658 return;
659
660 Diag(Command->getLocation(), diag::warn_doc_deprecated_not_sync)
661 << Command->getSourceRange() << Command->getCommandMarker();
662
663 // Try to emit a fixit with a deprecation attribute.
664 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
665 // Don't emit a Fix-It for non-member function definitions. GCC does not
666 // accept attributes on them.
667 const DeclContext *Ctx = FD->getDeclContext();
668 if ((!Ctx || !Ctx->isRecord()) &&
669 FD->doesThisDeclarationHaveABody())
670 return;
671
672 const LangOptions &LO = FD->getLangOpts();
673 const bool DoubleSquareBracket = LO.CPlusPlus14 || LO.C23;
674 StringRef AttributeSpelling =
675 DoubleSquareBracket ? "[[deprecated]]" : "__attribute__((deprecated))";
676 if (PP) {
677 // Try to find a replacement macro:
678 // - In C23/C++14 we prefer [[deprecated]].
679 // - If not found or an older C/C++ look for __attribute__((deprecated)).
680 StringRef MacroName;
681 if (DoubleSquareBracket) {
682 TokenValue Tokens[] = {tok::l_square, tok::l_square,
683 PP->getIdentifierInfo("deprecated"),
684 tok::r_square, tok::r_square};
685 MacroName = PP->getLastMacroWithSpelling(FD->getLocation(), Tokens);
686 if (!MacroName.empty())
687 AttributeSpelling = MacroName;
688 }
689
690 if (MacroName.empty()) {
691 TokenValue Tokens[] = {
692 tok::kw___attribute, tok::l_paren,
693 tok::l_paren, PP->getIdentifierInfo("deprecated"),
694 tok::r_paren, tok::r_paren};
695 StringRef MacroName =
696 PP->getLastMacroWithSpelling(FD->getLocation(), Tokens);
697 if (!MacroName.empty())
698 AttributeSpelling = MacroName;
699 }
700 }
701
702 SmallString<64> TextToInsert = AttributeSpelling;
703 TextToInsert += " ";
704 SourceLocation Loc = FD->getSourceRange().getBegin();
705 Diag(Loc, diag::note_add_deprecation_attr)
706 << FixItHint::CreateInsertion(Loc, TextToInsert);
707 }
708}
709
710void Sema::resolveParamCommandIndexes(const FullComment *FC) {
711 if (!involvesFunctionType()) {
712 // We already warned that \\param commands are not attached to a function
713 // decl.
714 return;
715 }
716
717 SmallVector<ParamCommandComment *, 8> UnresolvedParamCommands;
718
719 // Comment AST nodes that correspond to \c ParamVars for which we have
720 // found a \\param command or NULL if no documentation was found so far.
721 SmallVector<ParamCommandComment *, 8> ParamVarDocs;
722
723 ArrayRef<const ParmVarDecl *> ParamVars = getParamVars();
724 ParamVarDocs.resize(ParamVars.size(), nullptr);
725
726 // First pass over all \\param commands: resolve all parameter names.
727 for (Comment::child_iterator I = FC->child_begin(), E = FC->child_end();
728 I != E; ++I) {
729 ParamCommandComment *PCC = dyn_cast<ParamCommandComment>(*I);
730 if (!PCC || !PCC->hasParamName())
731 continue;
732 StringRef ParamName = PCC->getParamNameAsWritten();
733
734 // Check that referenced parameter name is in the function decl.
735 const unsigned ResolvedParamIndex = resolveParmVarReference(ParamName,
736 ParamVars);
737 if (ResolvedParamIndex == ParamCommandComment::VarArgParamIndex) {
738 PCC->setIsVarArgParam();
739 continue;
740 }
741 if (ResolvedParamIndex == ParamCommandComment::InvalidParamIndex) {
742 UnresolvedParamCommands.push_back(PCC);
743 continue;
744 }
745 PCC->setParamIndex(ResolvedParamIndex);
746 if (ParamVarDocs[ResolvedParamIndex]) {
747 SourceRange ArgRange = PCC->getParamNameRange();
748 Diag(ArgRange.getBegin(), diag::warn_doc_param_duplicate)
749 << ParamName << ArgRange;
750 ParamCommandComment *PrevCommand = ParamVarDocs[ResolvedParamIndex];
751 Diag(PrevCommand->getLocation(), diag::note_doc_param_previous)
752 << PrevCommand->getParamNameRange();
753 }
754 ParamVarDocs[ResolvedParamIndex] = PCC;
755 }
756
757 // Find parameter declarations that have no corresponding \\param.
758 SmallVector<const ParmVarDecl *, 8> OrphanedParamDecls;
759 for (unsigned i = 0, e = ParamVarDocs.size(); i != e; ++i) {
760 if (!ParamVarDocs[i])
761 OrphanedParamDecls.push_back(ParamVars[i]);
762 }
763
764 // Second pass over unresolved \\param commands: do typo correction.
765 // Suggest corrections from a set of parameter declarations that have no
766 // corresponding \\param.
767 for (unsigned i = 0, e = UnresolvedParamCommands.size(); i != e; ++i) {
768 const ParamCommandComment *PCC = UnresolvedParamCommands[i];
769
770 SourceRange ArgRange = PCC->getParamNameRange();
771 StringRef ParamName = PCC->getParamNameAsWritten();
772 Diag(ArgRange.getBegin(), diag::warn_doc_param_not_found)
773 << ParamName << ArgRange;
774
775 // All parameters documented -- can't suggest a correction.
776 if (OrphanedParamDecls.size() == 0)
777 continue;
778
779 unsigned CorrectedParamIndex = ParamCommandComment::InvalidParamIndex;
780 if (OrphanedParamDecls.size() == 1) {
781 // If one parameter is not documented then that parameter is the only
782 // possible suggestion.
783 CorrectedParamIndex = 0;
784 } else {
785 // Do typo correction.
786 CorrectedParamIndex = correctTypoInParmVarReference(ParamName,
787 OrphanedParamDecls);
788 }
789 if (CorrectedParamIndex != ParamCommandComment::InvalidParamIndex) {
790 const ParmVarDecl *CorrectedPVD = OrphanedParamDecls[CorrectedParamIndex];
791 if (const IdentifierInfo *CorrectedII = CorrectedPVD->getIdentifier())
792 Diag(ArgRange.getBegin(), diag::note_doc_param_name_suggestion)
793 << CorrectedII->getName()
794 << FixItHint::CreateReplacement(ArgRange, CorrectedII->getName());
795 }
796 }
797}
798
799bool Sema::involvesFunctionType() {
800 if (!ThisDeclInfo)
801 return false;
802 if (!ThisDeclInfo->IsFilled)
803 inspectThisDecl();
804 return ThisDeclInfo->involvesFunctionType();
805}
806
807bool Sema::isFunctionDecl() {
808 if (!ThisDeclInfo)
809 return false;
810 if (!ThisDeclInfo->IsFilled)
811 inspectThisDecl();
812 return ThisDeclInfo->getKind() == DeclInfo::FunctionKind;
813}
814
815bool Sema::isAnyFunctionDecl() {
816 return isFunctionDecl() && ThisDeclInfo->CurrentDecl &&
817 isa<FunctionDecl>(ThisDeclInfo->CurrentDecl);
818}
819
820bool Sema::isFunctionOrMethodVariadic() {
821 if (!ThisDeclInfo)
822 return false;
823 if (!ThisDeclInfo->IsFilled)
824 inspectThisDecl();
825 return ThisDeclInfo->IsVariadic;
826}
827
828bool Sema::isObjCMethodDecl() {
829 return isFunctionDecl() && ThisDeclInfo->CurrentDecl &&
830 isa<ObjCMethodDecl>(ThisDeclInfo->CurrentDecl);
831}
832
833bool Sema::isFunctionPointerVarDecl() {
834 if (!ThisDeclInfo)
835 return false;
836 if (!ThisDeclInfo->IsFilled)
837 inspectThisDecl();
838 if (ThisDeclInfo->getKind() == DeclInfo::VariableKind) {
839 if (const VarDecl *VD = dyn_cast_or_null<VarDecl>(ThisDeclInfo->CurrentDecl)) {
840 QualType QT = VD->getType();
841 return QT->isFunctionPointerType();
842 }
843 }
844 return false;
845}
846
847bool Sema::isObjCPropertyDecl() {
848 if (!ThisDeclInfo)
849 return false;
850 if (!ThisDeclInfo->IsFilled)
851 inspectThisDecl();
852 return ThisDeclInfo->CurrentDecl->getKind() == Decl::ObjCProperty;
853}
854
855bool Sema::isTemplateOrSpecialization() {
856 if (!ThisDeclInfo)
857 return false;
858 if (!ThisDeclInfo->IsFilled)
859 inspectThisDecl();
860 return ThisDeclInfo->getTemplateKind() != DeclInfo::NotTemplate;
861}
862
863bool Sema::isExplicitFunctionTemplateInstantiation() {
864 if (!ThisDeclInfo)
865 return false;
866 if (!ThisDeclInfo->IsFilled)
867 inspectThisDecl();
868 if (const auto *FD = dyn_cast<FunctionDecl>(ThisDeclInfo->CurrentDecl)) {
869 TemplateSpecializationKind TSK = FD->getTemplateSpecializationKind();
870 return (TSK == TSK_ExplicitInstantiationDeclaration) ||
872 }
873 return false;
874}
875
876bool Sema::isRecordLikeDecl() {
877 if (!ThisDeclInfo)
878 return false;
879 if (!ThisDeclInfo->IsFilled)
880 inspectThisDecl();
881 return isUnionDecl() || isClassOrStructDecl() || isObjCInterfaceDecl() ||
882 isObjCProtocolDecl();
883}
884
885bool Sema::isUnionDecl() {
886 if (!ThisDeclInfo)
887 return false;
888 if (!ThisDeclInfo->IsFilled)
889 inspectThisDecl();
890 if (const RecordDecl *RD =
891 dyn_cast_or_null<RecordDecl>(ThisDeclInfo->CurrentDecl))
892 return RD->isUnion();
893 return false;
894}
895static bool isClassOrStructDeclImpl(const Decl *D) {
896 if (auto *record = dyn_cast_or_null<RecordDecl>(D))
897 return !record->isUnion();
898
899 return false;
900}
901
902bool Sema::isClassOrStructDecl() {
903 if (!ThisDeclInfo)
904 return false;
905 if (!ThisDeclInfo->IsFilled)
906 inspectThisDecl();
907
908 if (!ThisDeclInfo->CurrentDecl)
909 return false;
910
911 return isClassOrStructDeclImpl(ThisDeclInfo->CurrentDecl);
912}
913
914bool Sema::isClassOrStructOrTagTypedefDecl() {
915 if (!ThisDeclInfo)
916 return false;
917 if (!ThisDeclInfo->IsFilled)
918 inspectThisDecl();
919
920 if (!ThisDeclInfo->CurrentDecl)
921 return false;
922
923 if (isClassOrStructDeclImpl(ThisDeclInfo->CurrentDecl))
924 return true;
925
926 if (auto *ThisTypedefDecl = dyn_cast<TypedefDecl>(ThisDeclInfo->CurrentDecl))
927 if (auto *D = ThisTypedefDecl->getUnderlyingType()->getAsRecordDecl())
928 return isClassOrStructDeclImpl(D);
929
930 return false;
931}
932
933bool Sema::isClassTemplateDecl() {
934 if (!ThisDeclInfo)
935 return false;
936 if (!ThisDeclInfo->IsFilled)
937 inspectThisDecl();
938 return ThisDeclInfo->CurrentDecl &&
939 (isa<ClassTemplateDecl>(ThisDeclInfo->CurrentDecl));
940}
941
942bool Sema::isFunctionTemplateDecl() {
943 if (!ThisDeclInfo)
944 return false;
945 if (!ThisDeclInfo->IsFilled)
946 inspectThisDecl();
947 return ThisDeclInfo->CurrentDecl &&
948 (isa<FunctionTemplateDecl>(ThisDeclInfo->CurrentDecl));
949}
950
951bool Sema::isObjCInterfaceDecl() {
952 if (!ThisDeclInfo)
953 return false;
954 if (!ThisDeclInfo->IsFilled)
955 inspectThisDecl();
956 return ThisDeclInfo->CurrentDecl &&
957 isa<ObjCInterfaceDecl>(ThisDeclInfo->CurrentDecl);
958}
959
960bool Sema::isObjCProtocolDecl() {
961 if (!ThisDeclInfo)
962 return false;
963 if (!ThisDeclInfo->IsFilled)
964 inspectThisDecl();
965 return ThisDeclInfo->CurrentDecl &&
966 isa<ObjCProtocolDecl>(ThisDeclInfo->CurrentDecl);
967}
968
969ArrayRef<const ParmVarDecl *> Sema::getParamVars() {
970 if (!ThisDeclInfo->IsFilled)
971 inspectThisDecl();
972 return ThisDeclInfo->ParamVars;
973}
974
975void Sema::inspectThisDecl() {
976 ThisDeclInfo->fill();
977}
978
979unsigned Sema::resolveParmVarReference(StringRef Name,
980 ArrayRef<const ParmVarDecl *> ParamVars) {
981 for (unsigned i = 0, e = ParamVars.size(); i != e; ++i) {
982 const IdentifierInfo *II = ParamVars[i]->getIdentifier();
983 if (II && II->getName() == Name)
984 return i;
985 }
986 if (Name == "..." && isFunctionOrMethodVariadic())
989}
990
991unsigned
992Sema::correctTypoInParmVarReference(StringRef Typo,
993 ArrayRef<const ParmVarDecl *> ParamVars) {
994 SimpleTypoCorrection STC(Typo);
995 for (unsigned i = 0, e = ParamVars.size(); i != e; ++i) {
996 const ParmVarDecl *Param = ParamVars[i];
997 if (!Param)
998 continue;
999
1000 STC.add(Param->getIdentifier());
1001 }
1002
1003 if (STC.hasCorrection())
1004 return STC.getCorrectionIndex();
1005
1007}
1008
1009namespace {
1010bool ResolveTParamReferenceHelper(
1011 StringRef Name,
1012 const TemplateParameterList *TemplateParameters,
1013 SmallVectorImpl<unsigned> *Position) {
1014 for (unsigned i = 0, e = TemplateParameters->size(); i != e; ++i) {
1015 const NamedDecl *Param = TemplateParameters->getParam(i);
1016 const IdentifierInfo *II = Param->getIdentifier();
1017 if (II && II->getName() == Name) {
1018 Position->push_back(i);
1019 return true;
1020 }
1021
1022 if (const TemplateTemplateParmDecl *TTP =
1023 dyn_cast<TemplateTemplateParmDecl>(Param)) {
1024 Position->push_back(i);
1025 if (ResolveTParamReferenceHelper(Name, TTP->getTemplateParameters(),
1026 Position))
1027 return true;
1028 Position->pop_back();
1029 }
1030 }
1031 return false;
1032}
1033} // end anonymous namespace
1034
1035bool Sema::resolveTParamReference(
1036 StringRef Name,
1037 const TemplateParameterList *TemplateParameters,
1038 SmallVectorImpl<unsigned> *Position) {
1039 Position->clear();
1040 if (!TemplateParameters)
1041 return false;
1042
1043 return ResolveTParamReferenceHelper(Name, TemplateParameters, Position);
1044}
1045
1046namespace {
1047void CorrectTypoInTParamReferenceHelper(
1048 const TemplateParameterList *TemplateParameters,
1049 SimpleTypoCorrection &STC) {
1050 for (unsigned i = 0, e = TemplateParameters->size(); i != e; ++i) {
1051 const NamedDecl *Param = TemplateParameters->getParam(i);
1052 if (!Param)
1053 continue;
1054
1055 STC.add(Param->getIdentifier());
1056
1057 if (const TemplateTemplateParmDecl *TTP =
1058 dyn_cast<TemplateTemplateParmDecl>(Param))
1059 CorrectTypoInTParamReferenceHelper(TTP->getTemplateParameters(), STC);
1060 }
1061}
1062} // end anonymous namespace
1063
1064StringRef Sema::correctTypoInTParamReference(
1065 StringRef Typo,
1066 const TemplateParameterList *TemplateParameters) {
1067 SimpleTypoCorrection STC(Typo);
1068 CorrectTypoInTParamReferenceHelper(TemplateParameters, STC);
1069
1070 if (auto CorrectedTParamReference = STC.getCorrection())
1071 return *CorrectedTParamReference;
1072
1073 return StringRef();
1074}
1075
1076InlineCommandRenderKind Sema::getInlineCommandRenderKind(StringRef Name) const {
1077 assert(Traits.getCommandInfo(Name)->IsInlineCommand);
1078
1079 return llvm::StringSwitch<InlineCommandRenderKind>(Name)
1081 .Cases({"c", "p"}, InlineCommandRenderKind::Monospaced)
1082 .Cases({"a", "e", "em"}, InlineCommandRenderKind::Emphasized)
1083 .Case("anchor", InlineCommandRenderKind::Anchor)
1085}
1086
1087} // end namespace comments
1088} // end namespace clang
Defines the C++ template declaration subclasses.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
Defines the clang::Preprocessor interface.
Defines the SourceManager interface.
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
Kind getKind() const
Definition DeclBase.h:450
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:233
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
Definition Diagnostic.h:141
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
Definition Diagnostic.h:104
One of these records is kept for each identifier that is lexed.
StringRef getName() const
Return the actual identifier string.
This represents a decl that may have a name.
Definition Decl.h:274
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition TypeBase.h:1004
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
bool isVoidType() const
Definition TypeBase.h:9039
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition Comment.h:625
SourceRange getCommandNameRange(const CommandTraits &Traits) const
Definition Comment.h:681
void setParagraph(ParagraphComment *PC)
Definition Comment.h:716
StringRef getCommandName(const CommandTraits &Traits) const
Definition Comment.h:673
void setArgs(ArrayRef< Argument > A)
Definition Comment.h:699
SourceRange getArgRange(unsigned Idx) const
Definition Comment.h:695
ParagraphComment * getParagraph() const LLVM_READONLY
Definition Comment.h:708
CommandMarkerKind getCommandMarker() const LLVM_READONLY
Definition Comment.h:723
This class provides information about commands that can be used in comments.
Any part of the comment.
Definition Comment.h:66
Comment *const * child_iterator
Definition Comment.h:257
child_iterator child_begin() const
Definition Comment.cpp:83
SourceLocation getLocation() const LLVM_READONLY
Definition Comment.h:255
SourceRange getSourceRange() const LLVM_READONLY
Definition Comment.h:249
A full comment attached to a declaration, contains block content.
Definition Comment.h:1104
An opening HTML tag with attributes.
Definition Comment.h:454
void setAttrs(ArrayRef< Attribute > Attrs)
Definition Comment.h:513
StringRef getTagName() const LLVM_READONLY
Definition Comment.h:436
A command with word-like arguments that is considered inline content.
Definition Comment.h:341
Inline content (contained within a block).
Definition Comment.h:271
A single paragraph that contains inline content.
Definition Comment.h:576
Doxygen \param command.
Definition Comment.h:732
bool isDirectionExplicit() const LLVM_READONLY
Definition Comment.h:764
static const char * getDirectionAsString(ParamCommandPassDirection D)
Definition Comment.cpp:189
void setDirection(ParamCommandPassDirection Direction, bool Explicit)
Definition Comment.h:768
FullComment * actOnFullComment(ArrayRef< BlockContentComment * > Blocks)
void actOnParamCommandDirectionArg(ParamCommandComment *Command, SourceLocation ArgLocBegin, SourceLocation ArgLocEnd, StringRef Arg)
InlineCommandComment * actOnInlineCommand(SourceLocation CommandLocBegin, SourceLocation CommandLocEnd, unsigned CommandID, CommandMarkerKind CommandMarker, ArrayRef< Comment::Argument > Args)
TParamCommandComment * actOnTParamCommandStart(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
void actOnTParamCommandFinish(TParamCommandComment *Command, ParagraphComment *Paragraph)
void actOnBlockCommandFinish(BlockCommandComment *Command, ParagraphComment *Paragraph)
TextComment * actOnText(SourceLocation LocBegin, SourceLocation LocEnd, StringRef Text)
void actOnBlockCommandArgs(BlockCommandComment *Command, ArrayRef< BlockCommandComment::Argument > Args)
BlockCommandComment * actOnBlockCommandStart(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
void actOnParamCommandParamNameArg(ParamCommandComment *Command, SourceLocation ArgLocBegin, SourceLocation ArgLocEnd, StringRef Arg)
HTMLEndTagComment * actOnHTMLEndTag(SourceLocation LocBegin, SourceLocation LocEnd, StringRef TagName)
VerbatimLineComment * actOnVerbatimLine(SourceLocation LocBegin, unsigned CommandID, SourceLocation TextBegin, StringRef Text)
void actOnVerbatimBlockFinish(VerbatimBlockComment *Block, SourceLocation CloseNameLocBegin, StringRef CloseName, ArrayRef< VerbatimBlockLineComment * > Lines)
VerbatimBlockLineComment * actOnVerbatimBlockLine(SourceLocation Loc, StringRef Text)
void actOnParamCommandFinish(ParamCommandComment *Command, ParagraphComment *Paragraph)
ArrayRef< T > copyArray(ArrayRef< T > Source)
Returns a copy of array, owned by Sema's allocator.
Definition CommentSema.h:80
HTMLStartTagComment * actOnHTMLStartTagStart(SourceLocation LocBegin, StringRef TagName)
void actOnHTMLStartTagFinish(HTMLStartTagComment *Tag, ArrayRef< HTMLStartTagComment::Attribute > Attrs, SourceLocation GreaterLoc, bool IsSelfClosing)
ParamCommandComment * actOnParamCommandStart(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
VerbatimBlockComment * actOnVerbatimBlockStart(SourceLocation Loc, unsigned CommandID)
void actOnTParamCommandParamNameArg(TParamCommandComment *Command, SourceLocation ArgLocBegin, SourceLocation ArgLocEnd, StringRef Arg)
void setDecl(const Decl *D)
InlineContentComment * actOnUnknownCommand(SourceLocation LocBegin, SourceLocation LocEnd, StringRef CommandName)
ParagraphComment * actOnParagraphComment(ArrayRef< InlineContentComment * > Content)
Doxygen \tparam command, describes a template parameter.
Definition Comment.h:814
void setPosition(ArrayRef< unsigned > NewPosition)
Definition Comment.h:868
SourceRange getParamNameRange() const
Definition Comment.h:850
A verbatim block command (e.
Definition Comment.h:900
A line of text contained in a verbatim block.
Definition Comment.h:875
A verbatim line command.
Definition Comment.h:951
static bool isClassOrStructDeclImpl(const Decl *D)
InlineCommandRenderKind
The most appropriate rendering mode for this command, chosen on command semantics in Doxygen.
Definition Comment.h:332
CommandMarkerKind
Describes the syntax that was used in a documentation command.
Definition Comment.h:39
static ParamCommandPassDirection getParamPassDirection(StringRef Arg)
Turn a string into the corresponding PassDirection or -1 if it's not valid.
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
Definition Address.h:330
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
LLVM_READONLY bool isWhitespace(unsigned char c)
Return true if this character is horizontal or vertical ASCII whitespace: ' ', '\t',...
Definition CharInfo.h:108
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition Specifiers.h:189
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition Specifiers.h:207
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition Specifiers.h:203
Information about a single command.
unsigned IsFunctionDeclarationCommand
True if verbatim-like line command is a function declaration.
Information about the declaration, useful to clients of FullComment.
Definition Comment.h:983
@ FunctionKind
Something that we consider a "function":
Definition Comment.h:1025
@ VariableKind
Something that we consider a "variable":
Definition Comment.h:1037
unsigned IsObjCMethod
Is CommentDecl an ObjCMethodDecl.
Definition Comment.h:1072
unsigned IsFilled
If false, only CommentDecl is valid.
Definition Comment.h:1060
const Decl * CommentDecl
Declaration the comment is actually attached to (in the source).
Definition Comment.h:986
const Decl * CurrentDecl
CurrentDecl is the declaration with which the FullComment is associated.
Definition Comment.h:996
QualType ReturnType
Function return type if CommentDecl is something that we consider a "function".
Definition Comment.h:1004