Peter Collingbourne | 35c3f61 | 2014-03-18 04:46:45 +0000 | [diff] [blame] | 1 | //===--- ArgumentCommentCheck.h - clang-tidy --------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ARG_COMMENT_CHECK_H |
| 11 | #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ARG_COMMENT_CHECK_H |
| 12 | |
| 13 | #include "../ClangTidy.h" |
| 14 | #include "llvm/Support/Regex.h" |
| 15 | |
| 16 | namespace clang { |
| 17 | namespace tidy { |
| 18 | |
| 19 | /// \brief Checks that argument comments match parameter names. |
| 20 | class ArgumentCommentCheck : public ClangTidyCheck { |
| 21 | public: |
Alexander Kornienko | 6e0cbc8 | 2014-09-12 08:53:36 +0000 | [diff] [blame^] | 22 | ArgumentCommentCheck(StringRef Name, ClangTidyContext *Context); |
NAKAMURA Takumi | afc4965 | 2014-03-18 07:22:43 +0000 | [diff] [blame] | 23 | |
Peter Collingbourne | 35c3f61 | 2014-03-18 04:46:45 +0000 | [diff] [blame] | 24 | void registerMatchers(ast_matchers::MatchFinder *Finder) override; |
| 25 | void check(const ast_matchers::MatchFinder::MatchResult &Result) override; |
| 26 | |
| 27 | private: |
NAKAMURA Takumi | afc4965 | 2014-03-18 07:22:43 +0000 | [diff] [blame] | 28 | llvm::Regex IdentRE; |
Peter Collingbourne | 35c3f61 | 2014-03-18 04:46:45 +0000 | [diff] [blame] | 29 | |
| 30 | bool isLikelyTypo(llvm::ArrayRef<ParmVarDecl *> Params, StringRef ArgName, |
| 31 | unsigned ArgIndex); |
| 32 | std::vector<std::pair<SourceLocation, StringRef>> |
| 33 | getCommentsInRange(ASTContext *Ctx, SourceRange Range); |
| 34 | void checkCallArgs(ASTContext *Ctx, const FunctionDecl *Callee, |
| 35 | SourceLocation ArgBeginLoc, |
| 36 | llvm::ArrayRef<const Expr *> Args); |
| 37 | }; |
| 38 | |
| 39 | } // namespace tidy |
| 40 | } // namespace clang |
| 41 | |
| 42 | #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ARG_COMMENT_CHECK_H |