[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
Thu Sep 24 10:37:22 PDT 2015
berenm updated this revision to Diff 35652.
berenm added a comment.
Update the diff with more context, thanks to arcanist.
http://reviews.llvm.org/D13090
Files:
clang-tidy/readability/IdentifierNamingCheck.cpp
test/clang-tidy/readability-identifier-naming.cpp
Index: test/clang-tidy/readability-identifier-naming.cpp
===================================================================
--- test/clang-tidy/readability-identifier-naming.cpp
+++ test/clang-tidy/readability-identifier-naming.cpp
@@ -77,8 +77,7 @@
#define BLA int FOO_bar
BLA;
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: invalid case style for global variable 'FOO_bar'
-// NO fix expected as FOO_bar is from macro expansion
+// NO warnings or fixes expected as FOO_bar is from macro expansion
enum my_enumeration {
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: invalid case style for enum 'my_enumeration'
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.35652.patch
Type: text/x-patch
Size: 1418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150924/592272de/attachment.bin>
More information about the cfe-commits
mailing list