r254365 - [modules] Don't reject multiple modules providing contents for the same embedded file.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 30 19:32:49 PST 2015
Author: rsmith
Date: Mon Nov 30 21:32:49 2015
New Revision: 254365
URL: http://llvm.org/viewvc/llvm-project?rev=254365&view=rev
Log:
[modules] Don't reject multiple modules providing contents for the same embedded file.
Added:
cfe/trunk/test/Modules/embed-files.cpp
Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=254365&r1=254364&r2=254365&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Mon Nov 30 21:32:49 2015
@@ -1963,7 +1963,8 @@ InputFile ASTReader::getInputFile(Module
// can lead to problems when lexing using the source locations from the
// PCH.
SourceManager &SM = getSourceManager();
- if (!Overridden && SM.isFileOverridden(File)) {
+ // FIXME: Reject if the overrides are different.
+ if ((!Overridden && !Transient) && SM.isFileOverridden(File)) {
if (Complain)
Error(diag::err_fe_pch_file_overridden, Filename);
// After emitting the diagnostic, recover by disabling the override so
Added: cfe/trunk/test/Modules/embed-files.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/embed-files.cpp?rev=254365&view=auto
==============================================================================
--- cfe/trunk/test/Modules/embed-files.cpp (added)
+++ cfe/trunk/test/Modules/embed-files.cpp Mon Nov 30 21:32:49 2015
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo 'module a { header "a.h" } module b { header "b.h" }' > %t/modulemap
+// RUN: echo 'extern int t;' > %t/t.h
+// RUN: echo '#include "t.h"' > %t/a.h
+// RUN: echo '#include "t.h"' > %t/b.h
+
+// RUN: %clang_cc1 -fmodules -I%t -fmodules-cache-path=%t -fmodule-map-file=%t/modulemap -fmodules-embed-all-files %s -verify
+#include "a.h"
+char t; // expected-error {{different type}}
+// expected-note at t.h:1 {{here}}
+#include "t.h"
+#include "b.h"
+char t; // expected-error {{different type}}
+// expected-note at t.h:1 {{here}}
More information about the cfe-commits
mailing list