[PATCH] D77159: [pch] Honour -fallow-pch-with-compiler-errors for overall compilation status

Ben Langmuir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 14:19:44 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGcc3fddb411d5: [pch] Honour -fallow-pch-with-compiler-errors for overall compilation status (authored by benlangmuir).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77159/new/

https://reviews.llvm.org/D77159

Files:
  clang/lib/Serialization/GeneratePCH.cpp
  clang/test/Index/pch-with-errors.c


Index: clang/test/Index/pch-with-errors.c
===================================================================
--- clang/test/Index/pch-with-errors.c
+++ clang/test/Index/pch-with-errors.c
@@ -42,3 +42,6 @@
 
 // RUN: not c-index-test -write-pch %t.pch foobar.c 2>&1 | FileCheck -check-prefix=NONEXISTENT %s
 // NONEXISTENT: Unable to load translation unit
+
+// RUN: %clang -x c-header %s -o %t-clang.h.pch -Xclang -detailed-preprocessing-record -Xclang -fallow-pch-with-compiler-errors
+// RUN: c-index-test -index-file %s -include %t-clang.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-INDEX %s
Index: clang/lib/Serialization/GeneratePCH.cpp
===================================================================
--- clang/lib/Serialization/GeneratePCH.cpp
+++ clang/lib/Serialization/GeneratePCH.cpp
@@ -57,6 +57,11 @@
     }
   }
 
+  // Errors that do not prevent the PCH from being written should not cause the
+  // overall compilation to fail either.
+  if (AllowASTWithErrors)
+    PP.getDiagnostics().getClient()->clear();
+
   // Emit the PCH file to the Buffer.
   assert(SemaPtr && "No Sema?");
   Buffer->Signature =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77159.254000.patch
Type: text/x-patch
Size: 1155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200331/dfc7c687/attachment.bin>


More information about the cfe-commits mailing list