[clang-tools-extra] [clang-tidy] Support direct initialization in modernize smart pointer (PR #154732)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 21 04:05:26 PDT 2025
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 HEAD~1 HEAD --extensions cpp -- clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/make-shared.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
index b7e7d5fc0..b4b235988 100644
--- a/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
@@ -191,7 +191,8 @@ void MakeSmartPtrCheck::checkConstruct(SourceManager &SM, ASTContext *Ctx,
std::string FinalMakeSmartPtrFunctionName = MakeSmartPtrFunctionName.str();
auto Parents = Ctx->getParents(*Construct);
if (!Parents.empty() && Parents[0].get<clang::Decl>())
- FinalMakeSmartPtrFunctionName = ExprStr.str() + " = " + MakeSmartPtrFunctionName.str();
+ FinalMakeSmartPtrFunctionName =
+ ExprStr.str() + " = " + MakeSmartPtrFunctionName.str();
Diag << FixItHint::CreateReplacement(
CharSourceRange::getCharRange(ConstructCallStart, ConstructCallEnd),
``````````
</details>
https://github.com/llvm/llvm-project/pull/154732
More information about the cfe-commits
mailing list