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;


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;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to