[PATCH] D62437: [clang-tidy] Splits fuchsia-default-arguments
Julie Hockett via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 6 10:00:08 PDT 2019
juliehockett added a comment.
Sorry for the delay!
================
Comment at: clang-tools-extra/clang-tidy/fuchsia/DefaultArgumentsCallsCheck.cpp:24
+ const auto *S = Result.Nodes.getNodeAs<CXXDefaultArgExpr>("stmt");
+ if (S == nullptr)
+ return;
----------------
Just `if (!S)` should be sufficient here.
================
Comment at: clang-tools-extra/clang-tidy/fuchsia/DefaultArgumentsDeclarationsCheck.cpp:25
+ const auto *D = Result.Nodes.getNodeAs<ParmVarDecl>("decl");
+ if (D == nullptr)
+ return;
----------------
Same here for the `if` as above.
================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:118-122
+- New :doc:`fuchsia-default-arguments-declarations
+ <clang-tidy/checks/fuchsia-default-arguments-declarations>` check.
+
+ Warns if a function or method is declared with default parameters.
+
----------------
Also include a line about the addition of fuchsia-default-arguments-calls and the removal of fuchsia-default-arguments.
================
Comment at: clang-tools-extra/test/clang-tidy/fuchsia-default-arguments-declarations.cpp:59-60
int main() {
- S s;
- s.x();
- // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments]
- // CHECK-NOTES: [[@LINE-8]]:11: note: default parameter was declared here
- // CHECK-NEXT: void S::x(int i = 12) {}
- x();
- // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments]
- // CHECK-NOTES: [[@LINE-18]]:8: note: default parameter was declared here
- // CHECK-NEXT: void x(int i = 12);
}
----------------
Remove this
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62437/new/
https://reviews.llvm.org/D62437
More information about the cfe-commits
mailing list