diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-05 19:40:47 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-05 19:40:47 +0000 |
commit | f4ba35d8096dd14c9064133015c84ee4e5a0e44f (patch) | |
tree | 0ec993ad7ce7bbaf9358b50459d72343a0dff406 /clang/lib/AST/CommentSema.cpp | |
parent | 7179e712dd0ac44edb79486080b31ffe3458a22e (diff) | |
download | bcm5719-llvm-f4ba35d8096dd14c9064133015c84ee4e5a0e44f.tar.gz bcm5719-llvm-f4ba35d8096dd14c9064133015c84ee4e5a0e44f.zip |
doc parsing. Add @method and @callback for
checkings and few other refactoring/cleanup.
// rdar://13094352.
llvm-svn: 176509
Diffstat (limited to 'clang/lib/AST/CommentSema.cpp')
-rw-r--r-- | clang/lib/AST/CommentSema.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp index 0cf7b5fd50d..8adaa9526f4 100644 --- a/clang/lib/AST/CommentSema.cpp +++ b/clang/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; |