r296306 - Add a cc1 flag for setting the existing Preprocessor option 'AllowPCHWithCompilerErrors'.

Argyrios Kyrtzidis via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 26 18:06:19 PST 2017


Author: akirtzidis
Date: Sun Feb 26 20:06:18 2017
New Revision: 296306

URL: http://llvm.org/viewvc/llvm-project?rev=296306&view=rev
Log:
Add a cc1 flag for setting the existing Preprocessor option 'AllowPCHWithCompilerErrors'.

Modified:
    cfe/trunk/include/clang/Driver/CC1Options.td
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/test/Index/pch-from-libclang.c

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=296306&r1=296305&r2=296306&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Sun Feb 26 20:06:18 2017
@@ -588,6 +588,8 @@ def pic_is_pie : Flag<["-"], "pic-is-pie
   HelpText<"File is for a position independent executable">;
 def fno_validate_pch : Flag<["-"], "fno-validate-pch">,
   HelpText<"Disable validation of precompiled headers">;
+def fallow_pch_with_errors : Flag<["-"], "fallow-pch-with-compiler-errors">,
+  HelpText<"Accept a PCH file that was created with compiler errors">;
 def dump_deserialized_pch_decls : Flag<["-"], "dump-deserialized-decls">,
   HelpText<"Dump declarations that are deserialized from PCH, for testing">;
 def error_on_deserialized_pch_decl : Separate<["-"], "error-on-deserialized-decl">,

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=296306&r1=296305&r2=296306&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sun Feb 26 20:06:18 2017
@@ -2296,6 +2296,7 @@ static void ParsePreprocessorArgs(Prepro
   Opts.UsePredefines = !Args.hasArg(OPT_undef);
   Opts.DetailedRecord = Args.hasArg(OPT_detailed_preprocessing_record);
   Opts.DisablePCHValidation = Args.hasArg(OPT_fno_validate_pch);
+  Opts.AllowPCHWithCompilerErrors = Args.hasArg(OPT_fallow_pch_with_errors);
 
   Opts.DumpDeserializedPCHDecls = Args.hasArg(OPT_dump_deserialized_pch_decls);
   for (const Arg *A : Args.filtered(OPT_error_on_deserialized_pch_decl))

Modified: cfe/trunk/test/Index/pch-from-libclang.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/pch-from-libclang.c?rev=296306&r1=296305&r2=296306&view=diff
==============================================================================
--- cfe/trunk/test/Index/pch-from-libclang.c (original)
+++ cfe/trunk/test/Index/pch-from-libclang.c Sun Feb 26 20:06:18 2017
@@ -3,17 +3,19 @@
 // FIXME: Non-darwin bots fail. Would need investigation using -module-file-info to see what is the difference in modules generated from libclang vs the compiler invocation, in those systems.
 // REQUIRES: system-darwin
 
+// RUN: %clang_cc1 -fsyntax-only %s -verify
 // RUN: c-index-test -write-pch %t.h.pch %s -fmodules -fmodules-cache-path=%t.mcp -Xclang -triple -Xclang x86_64-apple-darwin
-// RUN: %clang -fsyntax-only -include %t.h %s -Xclang -verify -fmodules -fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record -Xclang -triple -Xclang x86_64-apple-darwin
-
-// expected-no-diagnostics
+// RUN: %clang -fsyntax-only -include %t.h %s -Xclang -verify -fmodules -fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record -Xclang -triple -Xclang x86_64-apple-darwin -Xclang -fallow-pch-with-compiler-errors
 
 #ifndef HEADER
 #define HEADER
 
 struct S { int x; };
 
+void some_function(undeclared_type p); // expected-error{{unknown type name}}
+
 #else
+// expected-no-diagnostics
 
 void test(struct S *s) {
   s->x = 0;




More information about the cfe-commits mailing list