Re: [Clang-Tidy] Run a check failed because of getName
On Tue, May 24, 2016 at 2:23 PM, Mailis Cohen via cfe-dev
<[hidden email]> wrote:
> Dear all,
> I'm a very new user of Clang-tidy and the AST and I have to write some new checks with clang-tidy (Release 270030).
> I'm trying to run a check I added in a new module.
> First, I installed llvm, clang and clang-tidy with the help of this tutorial : http://clang.llvm.org/get_started.html >
> Then, I added my module, my checks and the checks' tests thanks to this article : http://bbannier.github.io/blog/2015/05/02/Writing-a-basic-clang-static-analysis-check.html#adding-scaffolding >
> I can run the tests without any problem (make check-clang-tools) and I installed clang-tidy (make install).
> But when I try to use my checks (clang-tidy '-checks=-,myModule-*' test.cpp) it return this error :
> "clang-llvm/llvm/tools/clang/include/clang/AST/Decl.h:238: llvm::StringRef clang::NamedDecl::getName() const: Assertion `Name.isIdentifier() && "Name is not a simple identifier"' failed.
> It's the same error if I run the default check and the default test add with the script "add_new_check.py".
> I'm running out of idea... Do you know what can I do to fix it ?
add_new_check.py just adds a dummy check, of course it has bugs. In
this case you have to use getNameAsString instead of getName to make
it work for all kinds of declarations. This is documented on the
cfe-dev mailing list
[hidden email] http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev