[PATCH] D21036: Misplaced const-qualification with typedef types

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 10:16:50 PDT 2016


aaron.ballman added inline comments.

================
Comment at: clang-tidy/misc/MisplacedConstCheck.cpp:22
@@ +21,3 @@
+  Finder->addMatcher(
+      valueDecl(allOf(hasType(isConstQualified()),
+                      hasType(typedefType(hasDeclaration(
----------------
sbenza wrote:
> allOf() is unnecessary
Good catch, that was a holdover from when I was using clang-query.

================
Comment at: clang-tidy/misc/MisplacedConstCheck.cpp:26
@@ +25,3 @@
+                                          isConstQualified(),
+                                          ignoringParens(functionType())))))))
+                              .bind("typedef"))))))
----------------
sbenza wrote:
> Should we ignore pointer to members?
> If not, we should add a test for those.
Pointer to members are not pointer types (they're a MemberPointerType which derives from Type, not PointerType), so they are ignored already. I think that's reasonable because we'd want the pointer to member function types to behave the same as function types. I'll add an explicit test case.


http://reviews.llvm.org/D21036





More information about the cfe-commits mailing list