2014-03-18 12:46:45 +08:00
|
|
|
//===--- ArgumentCommentCheck.h - clang-tidy --------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ARG_COMMENT_CHECK_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ARG_COMMENT_CHECK_H
|
|
|
|
|
|
|
|
#include "../ClangTidy.h"
|
|
|
|
#include "llvm/Support/Regex.h"
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
|
|
|
|
|
|
|
/// \brief Checks that argument comments match parameter names.
|
|
|
|
class ArgumentCommentCheck : public ClangTidyCheck {
|
|
|
|
public:
|
2014-09-12 16:53:36 +08:00
|
|
|
ArgumentCommentCheck(StringRef Name, ClangTidyContext *Context);
|
2014-03-18 15:22:43 +08:00
|
|
|
|
2014-03-18 12:46:45 +08:00
|
|
|
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
|
|
|
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
|
|
|
|
|
|
|
private:
|
2014-03-18 15:22:43 +08:00
|
|
|
llvm::Regex IdentRE;
|
2014-03-18 12:46:45 +08:00
|
|
|
|
|
|
|
bool isLikelyTypo(llvm::ArrayRef<ParmVarDecl *> Params, StringRef ArgName,
|
|
|
|
unsigned ArgIndex);
|
|
|
|
std::vector<std::pair<SourceLocation, StringRef>>
|
|
|
|
getCommentsInRange(ASTContext *Ctx, SourceRange Range);
|
|
|
|
void checkCallArgs(ASTContext *Ctx, const FunctionDecl *Callee,
|
|
|
|
SourceLocation ArgBeginLoc,
|
|
|
|
llvm::ArrayRef<const Expr *> Args);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|
|
|
|
|
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ARG_COMMENT_CHECK_H
|