alexfh added inline comments.

================
Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:537
@@ +536,3 @@
+      return;
+    Range.setBegin(Range.getBegin().getLocWithOffset(1));
+
----------------
There are cases where this will fail (`~ ClassName()` or `??-ClassName` or 
`~\<EOL>ClassName`), but I saw these only a couple of times in real code. In 
other similar cases I'd recommend using the lexer and skip to the next token, 
but here it seems to be an overkill.

================
Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:545
@@ +544,3 @@
+  if (const auto *Loc = Result.Nodes.getNodeAs<TypeLoc>("typeLoc")) {
+    if (const auto &Ref = Loc->getAs<TagTypeLoc>()) {
+      addUsage(NamingCheckFailures, Ref.getDecl(), Loc->getSourceRange(),
----------------
The four cases are too similar. It should be possible to write the code much 
shorter. This might work:

  if (isa<TagTypeLoc>(Loc) || isa<InjectedClassNameTypeLoc>(Loc) || ...)
    addUsage(NamingCheckFailures, Loc->getType()->getDecl(),
        Loc->getSourceRange(), Result.SourceManager);


================
Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:575
@@ +574,3 @@
+        return;
+      SourceRange Range = SourceRange(Ref.getTemplateNameLoc(),
+                                      Ref.getLAngleLoc().getLocWithOffset(-1));
----------------
Please remove ` = SourceRange`.

================
Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:578
@@ +577,3 @@
+
+      if (const auto *ClassDecl = dyn_cast<ClassTemplateDecl>(Decl)) {
+        addUsage(NamingCheckFailures, ClassDecl->getTemplatedDecl(), Range,
----------------
Can you just cast to `TemplateDecl` or `RedeclarableTemplateDecl`, whichever 
suits better?


http://reviews.llvm.org/D13081



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to