[clang-tidy] Code factorization and cleanup in IdentifierNamingCheck

This is to level the ground a little bit, in preparation for the changes in http://reviews.llvm.org/D13081.

Code factorization replaces all insertions to NamingCheckFailures map with a unique addUsage function that does the job.
There is also no more difference between the declaration and the references to a given identifier, both cases are treated as ranges in the Usage vector. There is also a check to avoid duplicated ranges to be inserted, which sometimes triggered erroneous replacements.

References can now also be added before the declaration of the identifier is actually found; this looks to be the case for example when a templated class uses its parameters to specialize its templated base class.

Patch by Beren Minor!

Differential revision: http://reviews.llvm.org/D13079

llvm-svn: 248700
diff --git a/clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp b/clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp
index c72a6d8..6ac4cf0 100644
--- a/clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp
+++ b/clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp
@@ -68,6 +68,8 @@
 // FIXME: name, declaration contexts, forward declarations, etc, are correctly
 // FIXME: checked and renamed
 
+// clang-format off
+
 namespace FOO_NS {
 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: invalid case style for namespace 'FOO_NS' [readability-identifier-naming]
 // CHECK-FIXES: {{^}}namespace foo_ns {{{$}}