[PATCH] D39363: [clang-tidy] Correctly classify constant arrays and constant strings as constants when checking identifiers naming

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 7 07:15:33 PST 2017


alexfh added a comment.

One nit. Otherwise seems fine.



================
Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:502
 
-    if (!Type.isNull() && Type.isLocalConstQualified() &&
+    if (!Type.isNull() && Type.isConstQualified() &&
         Decl->isStaticDataMember() && NamingStyles[SK_ClassConstant])
----------------
Can we check for `!Type.isNull() && Type.isConstQualified()` once here?

  if (!Type.isNull() && Type.isConstQualified()) {
    if (Decl->isStaticDataMember() && NamingStyles[SK_ClassConstant])
      return SK_ClassConstant;
    if (Decl->isFileVarDecl() && NamingStyles[SK_GlobalConstant])
      return SK_GlobalConstant;
    ...
  }


https://reviews.llvm.org/D39363





More information about the cfe-commits mailing list