diff options
Diffstat (limited to 'clang/include/clang')
-rw-r--r-- | clang/include/clang/Basic/DiagnosticSerializationKinds.td | 2 | ||||
-rw-r--r-- | clang/include/clang/Frontend/ASTUnit.h | 6 | ||||
-rw-r--r-- | clang/include/clang/Frontend/CompilerInstance.h | 2 | ||||
-rw-r--r-- | clang/include/clang/Frontend/PreprocessorOptions.h | 4 | ||||
-rw-r--r-- | clang/include/clang/Serialization/ASTReader.h | 10 | ||||
-rw-r--r-- | clang/include/clang/Serialization/ASTWriter.h | 6 |
6 files changed, 26 insertions, 4 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSerializationKinds.td b/clang/include/clang/Basic/DiagnosticSerializationKinds.td index 9a86ebfad86..7f9fe262f7f 100644 --- a/clang/include/clang/Basic/DiagnosticSerializationKinds.td +++ b/clang/include/clang/Basic/DiagnosticSerializationKinds.td @@ -37,6 +37,8 @@ def warn_pch_version_too_new : Error< "PCH file uses a newer PCH format that cannot be read">; def warn_pch_different_branch : Error< "PCH file built from a different branch (%0) than the compiler (%1)">; +def err_pch_with_compiler_errors : Error< + "PCH file contains compiler errors">; def warn_cmdline_conflicting_macro_def : Error< "definition of the macro '%0' conflicts with the definition used to " "build the precompiled header">; diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h index 210c7ce23ee..3d0639561a5 100644 --- a/clang/include/clang/Frontend/ASTUnit.h +++ b/clang/include/clang/Frontend/ASTUnit.h @@ -642,7 +642,8 @@ public: bool OnlyLocalDecls = false, RemappedFile *RemappedFiles = 0, unsigned NumRemappedFiles = 0, - bool CaptureDiagnostics = false); + bool CaptureDiagnostics = false, + bool AllowPCHWithCompilerErrors = false); private: /// \brief Helper function for \c LoadFromCompilerInvocation() and @@ -730,7 +731,8 @@ public: bool RemappedFilesKeepOriginalName = true, bool PrecompilePreamble = false, TranslationUnitKind TUKind = TU_Complete, - bool CacheCodeCompletionResults = false); + bool CacheCodeCompletionResults = false, + bool AllowPCHWithCompilerErrors = false); /// \brief Reparse the source files using the same command-line options that /// were originally used to produce this translation unit. diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h index ff0c30939a4..1bb76952d5a 100644 --- a/clang/include/clang/Frontend/CompilerInstance.h +++ b/clang/include/clang/Frontend/CompilerInstance.h @@ -535,6 +535,7 @@ public: void createPCHExternalASTSource(StringRef Path, bool DisablePCHValidation, bool DisableStatCache, + bool AllowPCHWithCompilerErrors, void *DeserializationListener); /// Create an external AST source to read a PCH file. @@ -544,6 +545,7 @@ public: createPCHExternalASTSource(StringRef Path, const std::string &Sysroot, bool DisablePCHValidation, bool DisableStatCache, + bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context, void *DeserializationListener, bool Preamble); diff --git a/clang/include/clang/Frontend/PreprocessorOptions.h b/clang/include/clang/Frontend/PreprocessorOptions.h index 4a0de963820..d86a923d430 100644 --- a/clang/include/clang/Frontend/PreprocessorOptions.h +++ b/clang/include/clang/Frontend/PreprocessorOptions.h @@ -69,6 +69,9 @@ public: /// precompiled header or AST file. bool DisableStatCache; + /// \brief When true, a PCH with compiler errors will not be rejected. + bool AllowPCHWithCompilerErrors; + /// \brief Dump declarations that are deserialized from PCH, for testing. bool DumpDeserializedPCHDecls; @@ -165,6 +168,7 @@ public: PreprocessorOptions() : UsePredefines(true), DetailedRecord(false), DetailedRecordConditionalDirectives(false), DisablePCHValidation(false), DisableStatCache(false), + AllowPCHWithCompilerErrors(false), DumpDeserializedPCHDecls(false), PrecompiledPreambleBytes(0, true), RemappedFilesKeepOriginalName(true), diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h index 3ad132c19fe..d0cdbeabbb5 100644 --- a/clang/include/clang/Serialization/ASTReader.h +++ b/clang/include/clang/Serialization/ASTReader.h @@ -579,6 +579,9 @@ private: /// \brief Whether to disable the use of stat caches in AST files. bool DisableStatCache; + /// \brief Whether to accept an AST file with compiler errors. + bool AllowASTWithCompilerErrors; + /// \brief The current "generation" of the module file import stack, which /// indicates how many separate module file load operations have occurred. unsigned CurrentGeneration; @@ -875,8 +878,13 @@ public: /// help when an AST file is being used in cases where the /// underlying files in the file system may have changed, but /// parsing should still continue. + /// + /// \param AllowASTWithCompilerErrors If true, the AST reader will accept an + /// AST file the was created out of an AST with compiler errors, + /// otherwise it will reject it. ASTReader(Preprocessor &PP, ASTContext &Context, StringRef isysroot = "", - bool DisableValidation = false, bool DisableStatCache = false); + bool DisableValidation = false, bool DisableStatCache = false, + bool AllowASTWithCompilerErrors = false); ~ASTReader(); diff --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h index 940c86ab333..4c62385cf2c 100644 --- a/clang/include/clang/Serialization/ASTWriter.h +++ b/clang/include/clang/Serialization/ASTWriter.h @@ -109,6 +109,9 @@ private: /// serialization, rather than just queueing updates. bool WritingAST; + /// \brief Indicates that the AST contained compiler errors. + bool ASTHasCompilerErrors; + /// \brief Stores a declaration or a type to be written to the AST file. class DeclOrType { public: @@ -467,7 +470,8 @@ public: /// are relative to the given system root. void WriteAST(Sema &SemaRef, MemorizeStatCalls *StatCalls, const std::string &OutputFile, - Module *WritingModule, StringRef isysroot); + Module *WritingModule, StringRef isysroot, + bool hasErrors = false); /// \brief Emit a source location. void AddSourceLocation(SourceLocation Loc, RecordDataImpl &Record); |