Skip to content

Revert "[NFC] Avoid potential null dereference." #127228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

schittir
Copy link
Contributor

Reverts #126872

@llvmbot
Copy link
Member

llvmbot commented Feb 14, 2025

@llvm/pr-subscribers-clang-format

Author: None (schittir)

Changes

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 --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);
     }
   }

@schittir schittir merged commit a8aa256 into main Feb 14, 2025
10 checks passed
@schittir schittir deleted the revert-126872-static_analyzer_concerns branch February 14, 2025 17:33
joaosaffran pushed a commit to joaosaffran/llvm-project that referenced this pull request Feb 14, 2025
Reverts llvm#126872
The commit, though harmless, is unnecessary.
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Feb 24, 2025
Reverts llvm#126872
The commit, though harmless, is unnecessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants