[PATCH] D52513: [Modules] Do not emit file modification error when -fno-validate-pch is set
Yuka Takahashi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 25 11:36:43 PDT 2018
yamaguchi created this revision.
yamaguchi added reviewers: rsmith, v.g.vassilev.
This is a follow-up patch of
https://reviews.llvm.org/rL338503: [Modules] Do not emit relocation error when -fno-validate-pch is set
File modification with modules is also fine for our usecase as we
want to reuse pcms. This enables us to use the same build directory
again without deleting pcm directory.
https://reviews.llvm.org/D52513
Files:
clang/lib/Serialization/ASTReader.cpp
clang/test/Modules/module-file-novalidate.c
Index: clang/test/Modules/module-file-novalidate.c
===================================================================
--- /dev/null
+++ clang/test/Modules/module-file-novalidate.c
@@ -0,0 +1,11 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo 'int foo = 0;' > %t/a.h
+// RUN: echo 'module A { header "a.h" }' > %t/m.modulemap
+// RUN: %clang_cc1 -fmodules -emit-module -fmodule-name=A -x c %t/m.modulemap -o %t/m.pcm
+// RUN: echo 'int bar;' > %t/a.h
+// RUN: not %clang_cc1 -fmodules -fmodule-file=%t/m.pcm -fmodule-map-file=%t/m.modulemap -fno-validate-pch -x c %s -I%t -fsyntax-only 2>&1 | FileCheck %s
+#include "a.h"
+int foo = 0; // redefinition of 'foo'
+// CHECK-NOT: fatal error: file {{.*}} has been modified since the module file {{.*}} was built
+// REQUIRES: shell
Index: clang/lib/Serialization/ASTReader.cpp
===================================================================
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -2175,7 +2175,8 @@
bool IsOutOfDate = false;
// For an overridden file, there is nothing to validate.
- if (!Overridden && //
+ // Don't emit file modification error if we have -fno-validate-pch
+ if (!Overridden && !PP.getPreprocessorOpts().DisablePCHValidation &&
(StoredSize != File->getSize() ||
(StoredTime && StoredTime != File->getModificationTime() &&
!DisableValidation)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52513.166963.patch
Type: text/x-patch
Size: 1399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180925/4fc25bb9/attachment.bin>
More information about the cfe-commits
mailing list