summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
diff options
context:
space:
mode:
authorYuka Takahashi <yukatkh@gmail.com>2018-08-01 09:50:02 +0000
committerYuka Takahashi <yukatkh@gmail.com>2018-08-01 09:50:02 +0000
commitd8baec2f467382227e8e904c1398fe3dee5e38c6 (patch)
treefe2d89384fbd6bab7325edcd04575b490fc960af /clang/lib/Serialization
parent8aca1c8db9f349eb5e6d39ce59c5260b9549670f (diff)
downloadbcm5719-llvm-d8baec2f467382227e8e904c1398fe3dee5e38c6.tar.gz
bcm5719-llvm-d8baec2f467382227e8e904c1398fe3dee5e38c6.zip
[Modules] Do not emit relocation error when -fno-validate-pch is set
Summary: Clang emits error when implicit modules was relocated from the first build directory. However this was biting our usecase where we copy the contents of build directory to another directory in order to distribute. Differential Revision: https://reviews.llvm.org/D49852 llvm-svn: 338503
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index b38c84d8e01..723839ff62b 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -2632,7 +2632,9 @@ ASTReader::ReadControlBlock(ModuleFile &F,
if (M && M->Directory) {
// If we're implicitly loading a module, the base directory can't
// change between the build and use.
- if (F.Kind != MK_ExplicitModule && F.Kind != MK_PrebuiltModule) {
+ // Don't emit module relocation error if we have -fno-validate-pch
+ if (!PP.getPreprocessorOpts().DisablePCHValidation &&
+ F.Kind != MK_ExplicitModule && F.Kind != MK_PrebuiltModule) {
const DirectoryEntry *BuildDir =
PP.getFileManager().getDirectory(Blob);
if (!BuildDir || BuildDir != M->Directory) {
@@ -3602,7 +3604,8 @@ ASTReader::ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F,
Module *M = PP.getHeaderSearchInfo().lookupModule(F.ModuleName);
auto &Map = PP.getHeaderSearchInfo().getModuleMap();
const FileEntry *ModMap = M ? Map.getModuleMapFileForUniquing(M) : nullptr;
- if (!ModMap) {
+ // Don't emit module relocation error if we have -fno-validate-pch
+ if (!PP.getPreprocessorOpts().DisablePCHValidation && !ModMap) {
assert(ImportedBy && "top-level import should be verified");
if ((ClientLoadCapabilities & ARR_OutOfDate) == 0) {
if (auto *ASTFE = M ? M->getASTFile() : nullptr) {
@@ -5039,7 +5042,9 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
if (!ParentModule) {
if (const FileEntry *CurFile = CurrentModule->getASTFile()) {
- if (CurFile != F.File) {
+ // Don't emit module relocation error if we have -fno-validate-pch
+ if (!PP.getPreprocessorOpts().DisablePCHValidation &&
+ CurFile != F.File) {
if (!Diags.isDiagnosticInFlight()) {
Diag(diag::err_module_file_conflict)
<< CurrentModule->getTopLevelModuleName()
OpenPOWER on IntegriCloud