[clang-tools-extra] [clang-tidy] Add `modernize-use-uniform-initializer` check (PR #91124)
via cfe-commits
cfe-commits at lists.llvm.org
Sun May 5 07:54:33 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 a415b4dfcc02e3e82b8c8a7836f7c04b9d65dc9b b46ceac9284c92b4ac55a5c489a0b7a8bff8d32e -- clang-tools-extra/clang-tidy/modernize/UseUniformInitializerCheck.cpp clang-tools-extra/clang-tidy/modernize/UseUniformInitializerCheck.h clang-tools-extra/test/clang-tidy/checkers/modernize/use-uniform-initializer.cpp clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp clang-tools-extra/clang-tidy/utils/LexerUtils.cpp clang-tools-extra/clang-tidy/utils/LexerUtils.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-tidy/modernize/UseUniformInitializerCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseUniformInitializerCheck.cpp
index 187470523c..204a42d8c8 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseUniformInitializerCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseUniformInitializerCheck.cpp
@@ -130,7 +130,8 @@ std::string buildReplacementString(const Expr *InitExpr,
const ASTContext &Context) {
// TODO: This function does not correctly handle the case where you have in
// 'ImplicitCastExpr' as an argument for a 'CXXConstructExpr'.
- // In that case the generated code will not compile due to missing explicit cast of the sub expression.
+ // In that case the generated code will not compile due to missing explicit
+ // cast of the sub expression.
const SourceManager &SM = Context.getSourceManager();
const LangOptions &LangOpts = Context.getLangOpts();
@@ -141,20 +142,21 @@ std::string buildReplacementString(const Expr *InitExpr,
const SourceRange ParenRange = ConstructExpr->getParenOrBraceRange();
if (ParenRange.isValid())
- return Lexer::getSourceText(CharSourceRange::getCharRange(
- ParenRange.getBegin().getLocWithOffset(1),
- ParenRange.getEnd()),
- SM, LangOpts)
- .trim();
+ return Lexer::getSourceText(
+ CharSourceRange::getCharRange(
+ ParenRange.getBegin().getLocWithOffset(1),
+ ParenRange.getEnd()),
+ SM, LangOpts)
+ .trim();
// In case the ParenRange is invalid we use Begin/EndLoc
const SourceLocation BeginLocation = ConstructExpr->getBeginLoc();
const SourceLocation EndLocation = ConstructExpr->getEndLoc();
- return Lexer::getSourceText(CharSourceRange::getCharRange(
- BeginLocation,
- EndLocation.getLocWithOffset(1)),
- SM, LangOpts)
+ return Lexer::getSourceText(
+ CharSourceRange::getCharRange(BeginLocation,
+ EndLocation.getLocWithOffset(1)),
+ SM, LangOpts)
.trim();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/91124
More information about the cfe-commits
mailing list