[PATCH] Add readability-remove-void-arg check to clang-tidy

Samuel Benzaquen sbenza at google.com
Mon Mar 2 10:22:47 PST 2015


================
Comment at: clang-tidy/readability/RemoveVoidArg.cpp:42
@@ +41,3 @@
+  if (const auto PT = QT->getAs<PointerType>()) {
+    if (const auto FP = PT->getPointeeType()->getAs<FunctionProtoType>()) {
+      return FP->getNumParams() == 0;
----------------
Remove the duplicate logic.
Could be something like:

```
if (const auto PT = QT->getAs<PointerType>()) {
  QT = PT->getPointeeType();
}
if (const auto *MPT = QT->getAs<MemberPointerType>()) {
  QT = MPT->getPointeeType();
}
if (const auto FP = QT->getAs<FunctionProtoType>()) {
    return FP->getNumParams() == 0;
}
```

http://reviews.llvm.org/D7639

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list