[PATCH] D49852: [Modules] Do not emit relocation error when -fno-validate-pch is set
Yuka Takahashi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 1 02:50:34 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338503: [Modules] Do not emit relocation error when -fno-validate-pch is set (authored by yamaguchi, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D49852?vs=157479&id=158484#toc
Repository:
rL LLVM
https://reviews.llvm.org/D49852
Files:
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Modules/resolution-change.m
Index: cfe/trunk/test/Modules/resolution-change.m
===================================================================
--- cfe/trunk/test/Modules/resolution-change.m
+++ cfe/trunk/test/Modules/resolution-change.m
@@ -21,6 +21,8 @@
// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-WRONGA %s
// CHECK-WRONGA: module 'A' was built in directory '{{.*Inputs.modules-with-same-name.path1.A}}' but now resides in directory '{{.*Inputs.modules-with-same-name.path2.A}}'
+// RUN: %clang_cc1 -fno-validate-pch -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -include-pch %t-A.pch %s -fsyntax-only
+
#ifndef HEADER
#define HEADER
@import DependsOnA;
Index: cfe/trunk/lib/Serialization/ASTReader.cpp
===================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp
+++ cfe/trunk/lib/Serialization/ASTReader.cpp
@@ -2632,7 +2632,9 @@
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 @@
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 @@
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()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49852.158484.patch
Type: text/x-patch
Size: 2851 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180801/b5efe49c/attachment.bin>
More information about the cfe-commits
mailing list