r230064 - Don't try to rebuild modules on umbrella header mismatch

Ben Langmuir blangmuir at apple.com
Fri Feb 20 13:46:39 PST 2015


Author: benlangmuir
Date: Fri Feb 20 15:46:39 2015
New Revision: 230064

URL: http://llvm.org/viewvc/llvm-project?rev=230064&view=rev
Log:
Don't try to rebuild modules on umbrella header mismatch

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.

Added:
    cfe/trunk/test/VFS/Inputs/UsesFoo.framework/
    cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Headers/
    cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Headers/UsesFoo.h
    cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Modules/
    cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Modules/module.modulemap
Modified:
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/test/VFS/umbrella-mismatch.m

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=230064&r1=230063&r2=230064&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Feb 20 15:46:39 2015
@@ -4578,9 +4578,13 @@ ASTReader::ReadSubmoduleBlock(ModuleFile
         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;

Added: cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Headers/UsesFoo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Headers/UsesFoo.h?rev=230064&view=auto
==============================================================================
--- cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Headers/UsesFoo.h (added)
+++ cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Headers/UsesFoo.h Fri Feb 20 15:46:39 2015
@@ -0,0 +1 @@
+ at import Foo;

Added: cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Modules/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Modules/module.modulemap?rev=230064&view=auto
==============================================================================
--- cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Modules/module.modulemap (added)
+++ cfe/trunk/test/VFS/Inputs/UsesFoo.framework/Modules/module.modulemap Fri Feb 20 15:46:39 2015
@@ -0,0 +1,4 @@
+framework module UsesFoo {
+  umbrella header "UsesFoo.h"
+  export *
+}

Modified: cfe/trunk/test/VFS/umbrella-mismatch.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/umbrella-mismatch.m?rev=230064&r1=230063&r2=230064&view=diff
==============================================================================
--- cfe/trunk/test/VFS/umbrella-mismatch.m (original)
+++ cfe/trunk/test/VFS/umbrella-mismatch.m Fri Feb 20 15:46:39 2015
@@ -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
- at import Foo;
+ at import UsesFoo;





More information about the cfe-commits mailing list