[PATCH] D13090: [clang-tidy] IdentifierNamingCheck should only emit warnings when declaration or usage is outside of macros

Beren Minor via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 23 00:25:34 PDT 2015


berenm created this revision.
berenm added a reviewer: alexfh.
berenm added a subscriber: cfe-commits.

This fixes https://llvm.org/bugs/show_bug.cgi?id=24835.

The patch might be slightly different after http://reviews.llvm.org/D13079 and http://reviews.llvm.org/D13081, but the idea is the same.

http://reviews.llvm.org/D13090

Files:
  clang-tidy/readability/IdentifierNamingCheck.cpp

Index: clang-tidy/readability/IdentifierNamingCheck.cpp
===================================================================
--- clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -567,10 +567,11 @@
     SourceRange DeclRange =
         DeclarationNameInfo(Decl.getDeclName(), Decl.getLocation())
             .getSourceRange();
-    auto Diag = diag(Decl.getLocStart(), "invalid case style for %0 '%1'")
-                << Failure.KindName << Decl.getName();
 
     if (Failure.ShouldFix) {
+      auto Diag = diag(Decl.getLocStart(), "invalid case style for %0 '%1'")
+                  << Failure.KindName << Decl.getName();
+
       Diag << FixItHint::CreateReplacement(
           CharSourceRange::getTokenRange(DeclRange), Failure.Fixup);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13090.35467.patch
Type: text/x-patch
Size: 801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150923/e19d12bb/attachment-0001.bin>


More information about the cfe-commits mailing list