aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/CommentSema.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-03-05 19:40:47 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-03-05 19:40:47 +0000
commitbca9788dbaf5fcf241efdc82ddcda712cb22214e (patch)
tree3202fa56d48f01ba067e152f305d63934b6c7bca /lib/AST/CommentSema.cpp
parent971023066ce2a20aa693cc981412d015bac304b9 (diff)
doc parsing. Add @method and @callback for
checkings and few other refactoring/cleanup. // rdar://13094352. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176509 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/CommentSema.cpp')
-rw-r--r--lib/AST/CommentSema.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/AST/CommentSema.cpp b/lib/AST/CommentSema.cpp
index 0cf7b5fd50..8adaa9526f 100644
--- a/lib/AST/CommentSema.cpp
+++ b/lib/AST/CommentSema.cpp
@@ -1,4 +1,4 @@
-//===--- CommentSema.cpp - Doxygen comment semantic analysis --------------===//
+class//===--- CommentSema.cpp - Doxygen comment semantic analysis --------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -91,9 +91,11 @@ ParamCommandComment *Sema::actOnParamCommandStart(
void Sema::checkFunctionDeclVerbatimLine(const BlockCommandComment *Comment) {
const CommandInfo *Info = Traits.getCommandInfo(Comment->getCommandID());
if (Info->IsFunctionDeclarationCommand &&
- !isFunctionDecl())
+ !isFunctionDecl() && !isCallbackDecl())
Diag(Comment->getLocation(),
diag::warn_doc_function_not_attached_to_a_function_decl)
+ << Comment->getCommandMarker()
+ << Info->Name << Info->Name
<< Comment->getSourceRange();
}
@@ -346,12 +348,14 @@ VerbatimLineComment *Sema::actOnVerbatimLine(SourceLocation LocBegin,
unsigned CommandID,
SourceLocation TextBegin,
StringRef Text) {
- return new (Allocator) VerbatimLineComment(
+ VerbatimLineComment *VL = new (Allocator) VerbatimLineComment(
LocBegin,
TextBegin.getLocWithOffset(Text.size()),
CommandID,
TextBegin,
Text);
+ checkFunctionDeclVerbatimLine(VL);
+ return VL;
}
HTMLStartTagComment *Sema::actOnHTMLStartTagStart(SourceLocation LocBegin,
@@ -682,6 +686,20 @@ bool Sema::isFunctionDecl() {
return ThisDeclInfo->getKind() == DeclInfo::FunctionKind;
}
+bool Sema::isCallbackDecl() {
+ if (!ThisDeclInfo)
+ return false;
+ if (!ThisDeclInfo->IsFilled)
+ inspectThisDecl();
+ if (ThisDeclInfo->getKind() == DeclInfo::VariableKind) {
+ if (const VarDecl *VD = dyn_cast_or_null<VarDecl>(ThisDeclInfo->CurrentDecl)) {
+ QualType QT = VD->getType();
+ return QT->isFunctionPointerType();
+ }
+ }
+ return false;
+}
+
bool Sema::isObjCPropertyDecl() {
if (!ThisDeclInfo)
return false;