|
@@ -68,8 +68,12 @@ void Sema::actOnBlockCommandFinish(BlockCommandComment *Command,
|
|
Command->setParagraph(Paragraph);
|
|
Command->setParagraph(Paragraph);
|
|
checkBlockCommandEmptyParagraph(Command);
|
|
checkBlockCommandEmptyParagraph(Command);
|
|
checkBlockCommandDuplicate(Command);
|
|
checkBlockCommandDuplicate(Command);
|
|
- checkReturnsCommand(Command);
|
|
|
|
- checkDeprecatedCommand(Command);
|
|
|
|
|
|
+ if (ThisDeclInfo) {
|
|
|
|
+ // These checks only make sense if the comment is attached to a
|
|
|
|
+ // declaration.
|
|
|
|
+ checkReturnsCommand(Command);
|
|
|
|
+ checkDeprecatedCommand(Command);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
ParamCommandComment *Sema::actOnParamCommandStart(
|
|
ParamCommandComment *Sema::actOnParamCommandStart(
|
|
@@ -558,6 +562,9 @@ void Sema::checkBlockCommandEmptyParagraph(BlockCommandComment *Command) {
|
|
void Sema::checkReturnsCommand(const BlockCommandComment *Command) {
|
|
void Sema::checkReturnsCommand(const BlockCommandComment *Command) {
|
|
if (!Traits.getCommandInfo(Command->getCommandID())->IsReturnsCommand)
|
|
if (!Traits.getCommandInfo(Command->getCommandID())->IsReturnsCommand)
|
|
return;
|
|
return;
|
|
|
|
+
|
|
|
|
+ assert(ThisDeclInfo && "should not call this check on a bare comment");
|
|
|
|
+
|
|
if (isFunctionDecl()) {
|
|
if (isFunctionDecl()) {
|
|
if (ThisDeclInfo->ReturnType->isVoidType()) {
|
|
if (ThisDeclInfo->ReturnType->isVoidType()) {
|
|
unsigned DiagKind;
|
|
unsigned DiagKind;
|
|
@@ -636,6 +643,8 @@ void Sema::checkDeprecatedCommand(const BlockCommandComment *Command) {
|
|
if (!Traits.getCommandInfo(Command->getCommandID())->IsDeprecatedCommand)
|
|
if (!Traits.getCommandInfo(Command->getCommandID())->IsDeprecatedCommand)
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
+ assert(ThisDeclInfo && "should not call this check on a bare comment");
|
|
|
|
+
|
|
const Decl *D = ThisDeclInfo->CommentDecl;
|
|
const Decl *D = ThisDeclInfo->CommentDecl;
|
|
if (!D)
|
|
if (!D)
|
|
return;
|
|
return;
|