Author: Joachim Priesner Date: 2022-06-20T13:30:30+01:00 New Revision: 541a50e20702a8046fe5076742611354cb6dd0f3
URL: https://github.com/llvm/llvm-project/commit/541a50e20702a8046fe5076742611354cb6dd0f3 DIFF: https://github.com/llvm/llvm-project/commit/541a50e20702a8046fe5076742611354cb6dd0f3.diff LOG: [clang-tidy] bugprone-argument-comment: Ignore calls to user-defined literals Without this change, code such as "f(/*param=*/1_op)" will check the comment twice, once for the parameter of f (correct) and once for the parameter of operator""_op (likely incorrect). The change removes only the second check. Reviewed By: njames93, LegalizeAdulthood Differential Revision: https://reviews.llvm.org/D125885 Added: Modified: clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment-literals.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp index 3836e4cf3990d..396b36d6e9afe 100644 --- a/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp @@ -60,7 +60,7 @@ void ArgumentCommentCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { void ArgumentCommentCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( - callExpr(unless(cxxOperatorCallExpr()), + callExpr(unless(cxxOperatorCallExpr()), unless(userDefinedLiteral()), // NewCallback's arguments relate to the pointed function, // don't check them against NewCallback's parameter names. // FIXME: Make this configurable. diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment-literals.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment-literals.cpp index d1f98bd0857bb..d576c187b101f 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment-literals.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment-literals.cpp @@ -29,7 +29,7 @@ void h(double b); void i(const char *c); void j(int a, int b, int c); -double operator"" _km(long double); +double operator"" _km(long double value); void test() { A a; @@ -171,6 +171,8 @@ void test() { g((1)); // FIXME But we should not add argument comments here. g(_Generic(0, int : 0)); + + 402.0_km; } void f(bool _with_underscores_); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits