[clang] [NFC] Delete useless call (PR #126874)

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 00:37:50 PST 2025


https://github.com/schittir created https://github.com/llvm/llvm-project/pull/126874

None

>From 5a25d2a34813d7b37a0a26cd883c6a7ccd4574a8 Mon Sep 17 00:00:00 2001
From: Sindhu Chittireddy <sindhu.chittireddy at intel.com>
Date: Wed, 12 Feb 2025 00:05:33 -0800
Subject: [PATCH 1/2] [NFC] Avoid potential null dereference.

---
 clang/lib/Format/UnwrappedLineFormatter.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 46545aa1f4c07..a5b30c85974c7 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -1596,7 +1596,7 @@ static auto computeNewlines(const AnnotatedLine &Line,
     if (Line.startsWith(TT_NamespaceRBrace)) {
       if (Style.WrapNamespaceBodyWithEmptyLines == FormatStyle::WNBWELS_Never)
         Newlines = 1;
-      else if (!PreviousLine->startsWith(TT_NamespaceRBrace))
+      else if (PreviousLine && !PreviousLine->startsWith(TT_NamespaceRBrace))
         Newlines = std::max(Newlines, 2u);
     }
   }

>From 2321b74a8c604449fa11660c7b43f19189404ea8 Mon Sep 17 00:00:00 2001
From: Sindhu Chittireddy <sindhu.chittireddy at intel.com>
Date: Wed, 12 Feb 2025 00:34:31 -0800
Subject: [PATCH 2/2] [NFC] Deleting a useless call.

---
 clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
index bb4a39f68280c..cca8a057a9180 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -440,7 +440,6 @@ static SVal castArgToParamTypeIfNeeded(const CallEvent &Call, unsigned ArgIdx,
     return ArgVal;
 
   const FunctionDecl *Definition = CallExprDecl;
-  Definition->hasBody(Definition);
 
   // The function decl of the Call (in the AST) will not have any parameter
   // declarations, if it was 'only' declared without a prototype. However, the



More information about the cfe-commits mailing list