[clang] Revert "[NFC] Avoid potential null dereference." (PR #127228)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 14 09:06:45 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-format
Author: None (schittir)
<details>
<summary>Changes</summary>
Reverts llvm/llvm-project#<!-- -->126872
---
Full diff: https://github.com/llvm/llvm-project/pull/127228.diff
1 Files Affected:
- (modified) clang/lib/Format/UnwrappedLineFormatter.cpp (+1-1)
``````````diff
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index dd667a9944515..14e984529d640 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -1610,7 +1610,7 @@ static auto computeNewlines(const AnnotatedLine &Line,
if (Line.startsWith(TT_NamespaceRBrace)) {
if (Style.WrapNamespaceBodyWithEmptyLines == FormatStyle::WNBWELS_Never)
Newlines = 1;
- else if (PreviousLine && !PreviousLine->startsWith(TT_NamespaceRBrace))
+ else if (!PreviousLine->startsWith(TT_NamespaceRBrace))
Newlines = std::max(Newlines, 2u);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/127228
More information about the cfe-commits
mailing list