[PATCH] D153068: Remove unnecessary condition and assignment.

Zenong Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 15 13:06:54 PDT 2023


SlaterLatiao created this revision.
Herald added a project: All.
SlaterLatiao requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153068

Files:
  clang/lib/Frontend/DiagnosticRenderer.cpp


Index: clang/lib/Frontend/DiagnosticRenderer.cpp
===================================================================
--- clang/lib/Frontend/DiagnosticRenderer.cpp
+++ clang/lib/Frontend/DiagnosticRenderer.cpp
@@ -167,12 +167,8 @@
       PLoc.isInvalid() ? FullSourceLoc()
                        : FullSourceLoc(PLoc.getIncludeLoc(), Loc.getManager());
 
-  // Reset `LastIncludeLoc` on a new error so that the include stacks are
-  // not skipped.
-  if (Level == DiagnosticsEngine::Error)
-    LastIncludeLoc = SourceLocation();
-  // Skip redundant include stacks altogether.
-  if (LastIncludeLoc == IncludeLoc)
+  // Skip redundant include stacks altogether on non-top-level.
+  if (Level != DiagnosticsEngine::Error && LastIncludeLoc == IncludeLoc)
     return;
 
   LastIncludeLoc = IncludeLoc;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153068.531883.patch
Type: text/x-patch
Size: 802 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230615/d63fce30/attachment.bin>


More information about the cfe-commits mailing list