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 origin/main HEAD --extensions cpp,c,h --
clang/include/clang/Analysis/Analyses/LifetimeSafety/Facts.h
clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeSafety.h
clang/include/clang/Analysis/Analyses/LifetimeSafety/LoanPropagation.h
clang/lib/Analysis/LifetimeSafety/Checker.cpp
clang/lib/Analysis/LifetimeSafety/Facts.cpp
clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp
clang/lib/Sema/SemaLifetimeSafety.h
clang/test/Sema/LifetimeSafety/annotation-suggestions.cpp
clang/test/Sema/LifetimeSafety/safety-c.c
clang/test/Sema/LifetimeSafety/safety.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git
a/clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeSafety.h
b/clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeSafety.h
index c177e9e22..2b6c49479 100644
--- a/clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeSafety.h
+++ b/clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeSafety.h
@@ -70,11 +70,10 @@ public:
LifetimeSafetySemaHelper() = default;
virtual ~LifetimeSafetySemaHelper() = default;
- virtual void reportUseAfterScope(const Expr *IssueExpr, const Expr *UseExpr,
- const Expr *MovedExpr,
- SourceLocation FreeLoc,
-
llvm::ArrayRef<LifetimeSafetyAliasChainEntry>
- AliasChain) {}
+ virtual void reportUseAfterScope(
+ const Expr *IssueExpr, const Expr *UseExpr, const Expr *MovedExpr,
+ SourceLocation FreeLoc,
+ llvm::ArrayRef<LifetimeSafetyAliasChainEntry> AliasChain) {}
virtual void reportUseAfterReturn(const Expr *IssueExpr,
const Expr *ReturnExpr,
diff --git a/clang/lib/Analysis/LifetimeSafety/Checker.cpp
b/clang/lib/Analysis/LifetimeSafety/Checker.cpp
index 335ca2886..568fcdab6 100644
--- a/clang/lib/Analysis/LifetimeSafety/Checker.cpp
+++ b/clang/lib/Analysis/LifetimeSafety/Checker.cpp
@@ -529,7 +529,8 @@ public:
getAliasChain(llvm::ArrayRef<OriginFlowChainStep> OriginFlowChain) {
llvm::SmallVector<LifetimeSafetyAliasChainEntry> rs;
for (const OriginFlowChainStep &Step : OriginFlowChain) {
- const Expr *CurrExpr =
FactMgr.getOriginMgr().getOrigin(Step.OID).getExpr();
+ const Expr *CurrExpr =
+ FactMgr.getOriginMgr().getOrigin(Step.OID).getExpr();
if (!CurrExpr)
continue;
diff --git a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
index dd6838630..b5b6c92ea 100644
--- a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
+++ b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
@@ -1085,8 +1085,9 @@ void FactsGenerator::handleFunctionCall(const Expr *Call,
flow(CallList, getOriginsList(*Args[0]), /*Kill=*/true);
return;
}
- auto GetLifetimeBoundInfo = [FD, Call](unsigned I)
- -> std::optional<OriginFlowFact::LifetimeBoundInfo> {
+ auto GetLifetimeBoundInfo =
+ [FD,
+ Call](unsigned I) -> std::optional<OriginFlowFact::LifetimeBoundInfo> {
const ParmVarDecl *PVD = nullptr;
if (const auto *Method = dyn_cast<CXXMethodDecl>(FD);
Method && Method->isInstance() && !isa<CXXConstructorDecl>(FD)) {
@@ -1165,8 +1166,8 @@ void FactsGenerator::handleFunctionCall(const Expr *Call,
// FIXME: Handle origin-shape mismatches gracefully so we can also flow
// inner origins.
CurrentBlockFacts.push_back(FactMgr.createFact<OriginFlowFact>(
- CallList->getOuterOriginID(), ArgList->getOuterOriginID(),
- KillSrc, GetLifetimeBoundInfo(I)));
+ CallList->getOuterOriginID(), ArgList->getOuterOriginID(), KillSrc,
+ GetLifetimeBoundInfo(I)));
KillSrc = false;
}
} else if (shouldTrackPointerImplicitObjectArg(I)) {
diff --git a/clang/lib/Sema/SemaLifetimeSafety.h
b/clang/lib/Sema/SemaLifetimeSafety.h
index 3d8ca9e90..1828096de 100644
--- a/clang/lib/Sema/SemaLifetimeSafety.h
+++ b/clang/lib/Sema/SemaLifetimeSafety.h
@@ -101,10 +101,10 @@ class LifetimeSafetySemaHelperImpl : public
LifetimeSafetySemaHelper {
public:
LifetimeSafetySemaHelperImpl(Sema &S) : S(S) {}
- void reportUseAfterScope(const Expr *IssueExpr, const Expr *UseExpr,
- const Expr *MovedExpr, SourceLocation FreeLoc,
- llvm::ArrayRef<LifetimeSafetyAliasChainEntry>
- AliasChain) override {
+ void reportUseAfterScope(
+ const Expr *IssueExpr, const Expr *UseExpr, const Expr *MovedExpr,
+ SourceLocation FreeLoc,
+ llvm::ArrayRef<LifetimeSafetyAliasChainEntry> AliasChain) override {
unsigned DiagID = MovedExpr
? diag::warn_lifetime_safety_use_after_scope_moved
: diag::warn_lifetime_safety_use_after_scope;
``````````
</details>
https://github.com/llvm/llvm-project/pull/206337
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits