diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-12-01 03:32:49 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-12-01 03:32:49 +0000 |
commit | 64daf7b1a5c24fe09045dc15b2bc55cc702633e1 (patch) | |
tree | 8dad84c41bb47286a879572fafe1c5655c5a2e5c | |
parent | 38518e9f538b3ad1e1d0f1c0a0448f084872ca69 (diff) | |
download | bcm5719-llvm-64daf7b1a5c24fe09045dc15b2bc55cc702633e1.tar.gz bcm5719-llvm-64daf7b1a5c24fe09045dc15b2bc55cc702633e1.zip |
[modules] Don't reject multiple modules providing contents for the same embedded file.
llvm-svn: 254365
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 3 | ||||
-rw-r--r-- | clang/test/Modules/embed-files.cpp | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 2defd38e27a..8043cf8e90c 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -1963,7 +1963,8 @@ InputFile ASTReader::getInputFile(ModuleFile &F, unsigned ID, bool Complain) { // 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 diff --git a/clang/test/Modules/embed-files.cpp b/clang/test/Modules/embed-files.cpp new file mode 100644 index 00000000000..a1db21852d0 --- /dev/null +++ b/clang/test/Modules/embed-files.cpp @@ -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@t.h:1 {{here}} +#include "t.h" +#include "b.h" +char t; // expected-error {{different type}} +// expected-note@t.h:1 {{here}} |