mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-29 08:19:01 -04:00

Summary: Each check can implement readOptions and storeOptions methods to read and store custom options. Each check's options are stored in a local namespace to avoid name collisions and provide some sort of context to the user. Reviewers: bkramer, klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5296 llvm-svn: 217661
43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
//===--- 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:
|
|
ArgumentCommentCheck(StringRef Name, ClangTidyContext *Context);
|
|
|
|
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
|
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
|
|
|
private:
|
|
llvm::Regex IdentRE;
|
|
|
|
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
|