[PATCH] D10933: Add new IdentifierNaming check

Beren Minor via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 17 06:41:30 PDT 2015


berenm updated this revision to Diff 32294.
berenm added a comment.

Indeed, I probably don't have rights on Clang/LLVM repositories.

I have updated the patch with stricter tests - and found a missing break statement (`clang-tidy/readability/IdentifierNamingCheck.cpp:201`).

I also realized that the DeclRefExpr matcher used to find references to declared identifiers is only matching references to values and not to classes.

For example, when referencing the class in the out-of-line class static member declaration (`test/clang-tidy/readability-identifier-naming.cpp:133` and `test/clang-tidy/readability-identifier-naming.cpp:136`), or  when using a class identifier as the type of a typedef, (`test/clang-tidy/readability-identifier-naming.cpp:243`). Or even when declaring a variable of a type whose name must be fixed.

Is there any matcher that could be used for finding references to a TypeDecl? Should I go through calls to `getDeclContext`, `getType`, or `getUnderlyingType` depending on the context? Any easier way I don't know about?


http://reviews.llvm.org/D10933

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tidy/readability/IdentifierNamingCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  test/clang-tidy/readability-identifier-naming.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10933.32294.patch
Type: text/x-patch
Size: 36532 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150817/8a105ec4/attachment-0001.bin>


More information about the cfe-commits mailing list