#include "ArgumentCommentCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/Token.h"
#include "../utils/LexerUtils.h"
usingnamespaceclang::ast_matchers;
namespace clang::tidy::bugprone {
namespace {
AST_MATCHER(Decl, isFromStdNamespaceOrSystemHeader) { … }
}
ArgumentCommentCheck::ArgumentCommentCheck(StringRef Name,
ClangTidyContext *Context)
: … { … }
void ArgumentCommentCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { … }
void ArgumentCommentCheck::registerMatchers(MatchFinder *Finder) { … }
static std::vector<std::pair<SourceLocation, StringRef>>
getCommentsInRange(ASTContext *Ctx, CharSourceRange Range) { … }
static std::vector<std::pair<SourceLocation, StringRef>>
getCommentsBeforeLoc(ASTContext *Ctx, SourceLocation Loc) { … }
static bool isLikelyTypo(llvm::ArrayRef<ParmVarDecl *> Params,
StringRef ArgName, unsigned ArgIndex) { … }
static bool sameName(StringRef InComment, StringRef InDecl, bool StrictMode) { … }
static bool looksLikeExpectMethod(const CXXMethodDecl *Expect) { … }
static bool areMockAndExpectMethods(const CXXMethodDecl *Mock,
const CXXMethodDecl *Expect) { … }
static const CXXMethodDecl *findMockedMethod(const CXXMethodDecl *Method) { … }
static const FunctionDecl *resolveMocks(const FunctionDecl *Func) { … }
bool ArgumentCommentCheck::shouldAddComment(const Expr *Arg) const { … }
void ArgumentCommentCheck::checkCallArgs(ASTContext *Ctx,
const FunctionDecl *OriginalCallee,
SourceLocation ArgBeginLoc,
llvm::ArrayRef<const Expr *> Args) { … }
void ArgumentCommentCheck::check(const MatchFinder::MatchResult &Result) { … }
}