[clang-tools-extra] [clang-tidy] Fix assert in modernize-use-std-format/print (PR #94104)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 3 05:36:36 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 16397e8ec7ffbee2907dfec698356f67672086e8 574cc6ad99c622381eb0ba0e35f55efba52d32c9 -- clang-tools-extra/clang-tidy/modernize/UseStdFormatCheck.cpp clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp clang-tools-extra/clang-tidy/utils/Matchers.h clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format-custom.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print-custom.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-tidy/modernize/UseStdFormatCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseStdFormatCheck.cpp
index 5e02038433..d082faa786 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseStdFormatCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseStdFormatCheck.cpp
@@ -47,7 +47,8 @@ void UseStdFormatCheck::registerPPCallbacks(const SourceManager &SM,
}
void UseStdFormatCheck::registerMatchers(MatchFinder *Finder) {
- auto CharPointerType = hasType(pointerType(pointee(matchers::isSimpleChar())));
+ auto CharPointerType =
+ hasType(pointerType(pointee(matchers::isSimpleChar())));
Finder->addMatcher(
callExpr(
argumentCountAtLeast(1), hasArgument(0, stringLiteral(isOrdinary())),
diff --git a/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp
index a858ceb95d..1ea170c3cd 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp
@@ -95,7 +95,8 @@ unusedReturnValue(clang::ast_matchers::StatementMatcher MatchedCallExpr) {
}
void UseStdPrintCheck::registerMatchers(MatchFinder *Finder) {
- auto CharPointerType = hasType(pointerType(pointee(matchers::isSimpleChar())));
+ auto CharPointerType =
+ hasType(pointerType(pointee(matchers::isSimpleChar())));
if (!PrintfLikeFunctions.empty())
Finder->addMatcher(
unusedReturnValue(
diff --git a/clang-tools-extra/clang-tidy/utils/Matchers.h b/clang-tools-extra/clang-tidy/utils/Matchers.h
index a3dcd6de39..5fd98db967 100644
--- a/clang-tools-extra/clang-tidy/utils/Matchers.h
+++ b/clang-tools-extra/clang-tidy/utils/Matchers.h
@@ -52,8 +52,9 @@ AST_MATCHER_FUNCTION(ast_matchers::TypeMatcher, isPointerToConst) {
// Returns QualType matcher for target char type only.
AST_MATCHER(QualType, isSimpleChar) {
const auto ActualType = Node.getTypePtr();
- return ActualType && (ActualType->isSpecificBuiltinType(BuiltinType::Char_S) ||
- ActualType->isSpecificBuiltinType(BuiltinType::Char_U));
+ return ActualType &&
+ (ActualType->isSpecificBuiltinType(BuiltinType::Char_S) ||
+ ActualType->isSpecificBuiltinType(BuiltinType::Char_U));
}
AST_MATCHER(Expr, hasUnevaluatedContext) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/94104
More information about the cfe-commits
mailing list