- clang-tidy 源码下新增一个类似于 Google 模块的 xxx模块 clang-tools-extra\clang-tidy\xxx xxxTidyModule.cpp
#include "../ClangTidy.h"
#include "../ClangTidyModule.h"
#include "../ClangTidyModuleRegistry.h"
#include "MutilvardeclCheck.h"
namespace clang {
namespace tidy {
namespace xxx {
class xxxModule : public ClangTidyModule {
public:
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
CheckFactories.registerCheck<MutilvardeclCheck>(
"xxx-mutilVarDecl");
}
};
// Register the xxxModule using this statically initialized variable.
static ClangTidyModuleRegistry::Add<xxxModule>
X("xxx-module", "Adds isoftstone lint checks.");
} // namespace xxx
volatile int IsoftstoneModuleAnchorSource = 0;
} // namespace tidy
} // namespace clang
编译成功,执行的时候遇到duan'y错误
执行命令:clang-tidy.exe -checks=-*,xxx-mutilVarDecl E:\test\test.cpp --
报错信息:
Assertion failed: Name.isIdentifier() && "Name is not a simple identifier", file E:\StaticCheck\llvm\clang\include\clang/AST/Decl.h, line 251