| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_ARGUMENTCOMMENTCHECK_H |
| 10 |
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_ARGUMENTCOMMENTCHECK_H |
| 11 |
|
| 12 |
#include "../ClangTidyCheck.h" |
| 13 |
#include "llvm/Support/Regex.h" |
| 14 |
|
| 15 |
namespace clang::tidy::bugprone { |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
class ArgumentCommentCheck : public ClangTidyCheck { |
| 33 |
public: |
| 34 |
ArgumentCommentCheck(StringRef Name, ClangTidyContext *Context); |
| 35 |
|
| 36 |
void registerMatchers(ast_matchers::MatchFinder *Finder) override; |
| 37 |
void check(const ast_matchers::MatchFinder::MatchResult &Result) override; |
| 38 |
void storeOptions(ClangTidyOptions::OptionMap &Opts) override; |
| 39 |
|
| 40 |
private: |
| 41 |
const unsigned StrictMode : 1; |
| 42 |
const unsigned IgnoreSingleArgument : 1; |
| 43 |
const unsigned CommentBoolLiterals : 1; |
| 44 |
const unsigned CommentIntegerLiterals : 1; |
| 45 |
const unsigned CommentFloatLiterals : 1; |
| 46 |
const unsigned CommentStringLiterals : 1; |
| 47 |
const unsigned CommentUserDefinedLiterals : 1; |
| 48 |
const unsigned CommentCharacterLiterals : 1; |
| 49 |
const unsigned CommentNullPtrs : 1; |
| 50 |
llvm::Regex IdentRE; |
| 51 |
|
| 52 |
void checkCallArgs(ASTContext *Ctx, const FunctionDecl *Callee, |
| 53 |
SourceLocation ArgBeginLoc, |
| 54 |
llvm::ArrayRef<const Expr *> Args); |
| 55 |
|
| 56 |
bool shouldAddComment(const Expr *Arg) const; |
| 57 |
}; |
| 58 |
|
| 59 |
} |
| 60 |
|
| 61 |
#endif |