]> granicus.if.org Git - clang/commitdiff
Don't try to rebuild modules on umbrella header mismatch
authorBen Langmuir <blangmuir@apple.com>
Fri, 20 Feb 2015 21:46:39 +0000 (21:46 +0000)
committerBen Langmuir <blangmuir@apple.com>
Fri, 20 Feb 2015 21:46:39 +0000 (21:46 +0000)
There are two issues here:
1) It's too late to rebuild at this point, because we won't go through
removeModules and when we try to reload the new .pcm we'll get the old
one instead.  We might be able to call removeModules after an OutOfDate
here, but I'm not yet confident that it is always safe to do so.

2) In practice, this check fails spuriously when the umbrella header
appears to change because of a VFS change that means it maps to a
different copy of the same file.  Because of this, we just skip the
check for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230064 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTReader.cpp
test/VFS/Inputs/UsesFoo.framework/Headers/UsesFoo.h [new file with mode: 0644]
test/VFS/Inputs/UsesFoo.framework/Modules/module.modulemap [new file with mode: 0644]
test/VFS/umbrella-mismatch.m

index bb6a450222d3163a4737bbb7609a613f7c8b5e7d..0ee2b2b2215ea2311651f6ab1601b29a9392e0fe 100644 (file)
@@ -4578,9 +4578,13 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
         if (!CurrentModule->getUmbrellaHeader())
           ModMap.setUmbrellaHeader(CurrentModule, Umbrella);
         else if (CurrentModule->getUmbrellaHeader() != Umbrella) {
-          if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
-            Error("mismatched umbrella headers in submodule");
-          return OutOfDate;
+          // This can be a spurious difference caused by changing the VFS to
+          // point to a different copy of the file, and it is too late to
+          // to rebuild safely.
+          // FIXME: If we wrote the virtual paths instead of the 'real' paths,
+          // after input file validation only real problems would remain and we
+          // could just error. For now, assume it's okay.
+          break;
         }
       }
       break;
diff --git a/test/VFS/Inputs/UsesFoo.framework/Headers/UsesFoo.h b/test/VFS/Inputs/UsesFoo.framework/Headers/UsesFoo.h
new file mode 100644 (file)
index 0000000..375d3ea
--- /dev/null
@@ -0,0 +1 @@
+@import Foo;
diff --git a/test/VFS/Inputs/UsesFoo.framework/Modules/module.modulemap b/test/VFS/Inputs/UsesFoo.framework/Modules/module.modulemap
new file mode 100644 (file)
index 0000000..55be29e
--- /dev/null
@@ -0,0 +1,4 @@
+framework module UsesFoo {
+  umbrella header "UsesFoo.h"
+  export *
+}
index f3a4ab34e0654b83e366d900727291b722e6a6ea..741b0e6930883f5001913cdf65dae9f8aba1c9aa 100644 (file)
@@ -4,4 +4,4 @@
 // RUN: %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -ivfsoverlay %t.yaml -F %S/Inputs -fsyntax-only %s -verify
 // RUN: %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -F %S/Inputs -fsyntax-only %s -verify
 // expected-no-diagnostics
-@import Foo;
+@import UsesFoo;