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);
 


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);
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to