vsapsai created this revision.
vsapsai added a reviewer: bruno.
Herald added subscribers: dexonsmith, hiraditya.

'ignore-non-existent-contents' stopped working after r342232 in a way
that the actual attribute value isn't used and it works as if it is
always `true`.

Common use case for VFS iteration is iterating through files in umbrella
directories for modules. Ability to detect if some VFS entries point to
non-existing files is nice but non-critical. Instead of adding back
support for `'ignore-non-existent-contents': false` I am removing the
attribute, because such scenario isn't used widely enough and stricter
checks don't provide enough value to justify the maintenance.

rdar://problem/45176119


https://reviews.llvm.org/D53228

Files:
  clang/lib/Frontend/ModuleDependencyCollector.cpp
  clang/test/Modules/crash-vfs-headermaps.m
  clang/test/Modules/crash-vfs-include-pch.m
  clang/test/Modules/crash-vfs-ivfsoverlay.m
  clang/test/Modules/crash-vfs-relative-incdir.m
  clang/test/Modules/crash-vfs-run-reproducer.m
  clang/test/VFS/Inputs/MissingVFS/vfsoverlay.yaml
  clang/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
  clang/test/VFS/Inputs/bar-headers.yaml
  clang/test/VFS/Inputs/vfsoverlay2.yaml
  llvm/include/llvm/Support/VirtualFileSystem.h
  llvm/lib/Support/VirtualFileSystem.cpp

Index: llvm/lib/Support/VirtualFileSystem.cpp
===================================================================
--- llvm/lib/Support/VirtualFileSystem.cpp
+++ llvm/lib/Support/VirtualFileSystem.cpp
@@ -1028,7 +1028,6 @@
 ///   'case-sensitive': <boolean, default=true>
 ///   'use-external-names': <boolean, default=true>
 ///   'overlay-relative': <boolean, default=false>
-///   'ignore-non-existent-contents': <boolean, default=true>
 ///
 /// Virtual directories are represented as
 /// \verbatim
@@ -1092,14 +1091,6 @@
   /// Whether to use to use the value of 'external-contents' for the
   /// names of files.  This global value is overridable on a per-file basis.
   bool UseExternalNames = true;
-
-  /// Whether an invalid path obtained via 'external-contents' should
-  /// cause iteration on the VFS to stop. If 'true', the VFS should ignore
-  /// the entry and continue with the next. Allows YAML files to be shared
-  /// across multiple compiler invocations regardless of prior existent
-  /// paths in 'external-contents'. This global value is overridable on a
-  /// per-file basis.
-  bool IgnoreNonExistentContents = true;
   /// @}
 
   /// Virtual file paths and external files could be canonicalized without "..",
@@ -1176,8 +1167,6 @@
     return ExternalContentsPrefixDir;
   }
 
-  bool ignoreNonExistentContents() const { return IgnoreNonExistentContents; }
-
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   LLVM_DUMP_METHOD void dump() const {
     for (const auto &Root : Roots)
@@ -1549,7 +1538,6 @@
         KeyStatusPair("case-sensitive", false),
         KeyStatusPair("use-external-names", false),
         KeyStatusPair("overlay-relative", false),
-        KeyStatusPair("ignore-non-existent-contents", false),
         KeyStatusPair("roots", true),
     };
 
@@ -1607,9 +1595,6 @@
       } else if (Key == "use-external-names") {
         if (!parseScalarBool(I.getValue(), FS->UseExternalNames))
           return false;
-      } else if (Key == "ignore-non-existent-contents") {
-        if (!parseScalarBool(I.getValue(), FS->IgnoreNonExistentContents))
-          return false;
       } else {
         llvm_unreachable("key missing from Keys");
       }
@@ -1915,7 +1900,7 @@
 
   void write(ArrayRef<YAMLVFSEntry> Entries, Optional<bool> UseExternalNames,
              Optional<bool> IsCaseSensitive, Optional<bool> IsOverlayRelative,
-             Optional<bool> IgnoreNonExistentContents, StringRef OverlayDir);
+             StringRef OverlayDir);
 };
 
 } // namespace
@@ -1973,7 +1958,6 @@
                        Optional<bool> UseExternalNames,
                        Optional<bool> IsCaseSensitive,
                        Optional<bool> IsOverlayRelative,
-                       Optional<bool> IgnoreNonExistentContents,
                        StringRef OverlayDir) {
   using namespace llvm::sys;
 
@@ -1991,9 +1975,6 @@
     OS << "  'overlay-relative': '" << (UseOverlayRelative ? "true" : "false")
        << "',\n";
   }
-  if (IgnoreNonExistentContents.hasValue())
-    OS << "  'ignore-non-existent-contents': '"
-       << (IgnoreNonExistentContents.getValue() ? "true" : "false") << "',\n";
   OS << "  'roots': [\n";
 
   if (!Entries.empty()) {
@@ -2049,8 +2030,7 @@
   });
 
   JSONWriter(OS).write(Mappings, UseExternalNames, IsCaseSensitive,
-                       IsOverlayRelative, IgnoreNonExistentContents,
-                       OverlayDir);
+                       IsOverlayRelative, OverlayDir);
 }
 
 VFSFromYamlDirIterImpl::VFSFromYamlDirIterImpl(
Index: llvm/include/llvm/Support/VirtualFileSystem.h
===================================================================
--- llvm/include/llvm/Support/VirtualFileSystem.h
+++ llvm/include/llvm/Support/VirtualFileSystem.h
@@ -490,7 +490,6 @@
   Optional<bool> IsCaseSensitive;
   Optional<bool> IsOverlayRelative;
   Optional<bool> UseExternalNames;
-  Optional<bool> IgnoreNonExistentContents;
   std::string OverlayDir;
 
 public:
@@ -504,10 +503,6 @@
 
   void setUseExternalNames(bool UseExtNames) { UseExternalNames = UseExtNames; }
 
-  void setIgnoreNonExistentContents(bool IgnoreContents) {
-    IgnoreNonExistentContents = IgnoreContents;
-  }
-
   void setOverlayDir(StringRef OverlayDirectory) {
     IsOverlayRelative = true;
     OverlayDir.assign(OverlayDirectory.str());
Index: clang/test/VFS/Inputs/vfsoverlay2.yaml
===================================================================
--- clang/test/VFS/Inputs/vfsoverlay2.yaml
+++ clang/test/VFS/Inputs/vfsoverlay2.yaml
@@ -1,6 +1,5 @@
 {
   'version': 0,
-  'ignore-non-existent-contents': false,
   'roots': [
     { 'name': 'OUT_DIR', 'type': 'directory',
       'contents': [
Index: clang/test/VFS/Inputs/bar-headers.yaml
===================================================================
--- clang/test/VFS/Inputs/bar-headers.yaml
+++ clang/test/VFS/Inputs/bar-headers.yaml
@@ -1,7 +1,6 @@
 {
   'version': 0,
   'case-sensitive': 'false',
-  'ignore-non-existent-contents': 'true',
   'roots': [
     {
       'type': 'directory',
Index: clang/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
===================================================================
--- clang/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
+++ clang/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
@@ -1,7 +1,6 @@
 {
   'version': 0,
   'case-sensitive': 'false',
-  'ignore-non-existent-contents': 'true',
   'roots': [
     {
       'type': 'directory',
Index: clang/test/VFS/Inputs/MissingVFS/vfsoverlay.yaml
===================================================================
--- clang/test/VFS/Inputs/MissingVFS/vfsoverlay.yaml
+++ clang/test/VFS/Inputs/MissingVFS/vfsoverlay.yaml
@@ -1,6 +1,5 @@
 {
   'version': 0,
-  'ignore-non-existent-contents': false,
   'roots': [
     { 'name': 'INPUT_DIR', 'type': 'directory',
       'contents': [
Index: clang/test/Modules/crash-vfs-run-reproducer.m
===================================================================
--- clang/test/Modules/crash-vfs-run-reproducer.m
+++ clang/test/Modules/crash-vfs-run-reproducer.m
@@ -36,7 +36,6 @@
 // CHECKYAML: 'case-sensitive':
 // CHECKYAML-NEXT: 'use-external-names': 'false',
 // CHECKYAML-NEXT: 'overlay-relative': 'true',
-// CHECKYAML-NEXT: 'ignore-non-existent-contents': 'false'
 // CHECKYAML: 'type': 'directory'
 // CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include",
 // CHECKYAML-NEXT: 'contents': [
Index: clang/test/Modules/crash-vfs-relative-incdir.m
===================================================================
--- clang/test/Modules/crash-vfs-relative-incdir.m
+++ clang/test/Modules/crash-vfs-relative-incdir.m
@@ -36,7 +36,6 @@
 // CHECKYAML: 'case-sensitive':
 // CHECKYAML-NEXT: 'use-external-names': 'false',
 // CHECKYAML-NEXT: 'overlay-relative': 'true',
-// CHECKYAML-NEXT: 'ignore-non-existent-contents': 'false'
 // CHECKYAML: 'type': 'directory'
 // CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include",
 // CHECKYAML-NEXT: 'contents': [
Index: clang/test/Modules/crash-vfs-ivfsoverlay.m
===================================================================
--- clang/test/Modules/crash-vfs-ivfsoverlay.m
+++ clang/test/Modules/crash-vfs-ivfsoverlay.m
@@ -36,7 +36,6 @@
 // CHECKYAML: 'case-sensitive':
 // CHECKYAML-NEXT: 'use-external-names': 'false',
 // CHECKYAML-NEXT: 'overlay-relative': 'true',
-// CHECKYAML-NEXT: 'ignore-non-existent-contents': 'false'
 // CHECKYAML: 'type': 'directory'
 // CHECKYAML: 'name': "/[[PATH:.*]]/example"
 // CHECKYAML: 'contents': [
Index: clang/test/Modules/crash-vfs-include-pch.m
===================================================================
--- clang/test/Modules/crash-vfs-include-pch.m
+++ clang/test/Modules/crash-vfs-include-pch.m
@@ -33,7 +33,6 @@
 // CHECKYAML: 'case-sensitive':
 // CHECKYAML-NEXT: 'use-external-names': 'false',
 // CHECKYAML-NEXT: 'overlay-relative': 'true',
-// CHECKYAML-NEXT: 'ignore-non-existent-contents': 'false'
 // CHECKYAML: 'type': 'directory'
 // CHECKYAML: 'name': "/[[PATH:.*]]/out",
 // CHECKYAML-NEXT: 'contents': [
Index: clang/test/Modules/crash-vfs-headermaps.m
===================================================================
--- clang/test/Modules/crash-vfs-headermaps.m
+++ clang/test/Modules/crash-vfs-headermaps.m
@@ -32,7 +32,6 @@
 // CHECKYAML: 'case-sensitive':
 // CHECKYAML-NEXT: 'use-external-names': 'false',
 // CHECKYAML-NEXT: 'overlay-relative': 'true',
-// CHECKYAML-NEXT: 'ignore-non-existent-contents': 'false'
 // CHECKYAML: 'type': 'directory'
 // CHECKYAML: 'name': "/[[PATH:.*]]/Foo.framework/Headers",
 // CHECKYAML-NEXT: 'contents': [
Index: clang/lib/Frontend/ModuleDependencyCollector.cpp
===================================================================
--- clang/lib/Frontend/ModuleDependencyCollector.cpp
+++ clang/lib/Frontend/ModuleDependencyCollector.cpp
@@ -156,10 +156,6 @@
   // allows crash reproducer scripts to work across machines.
   VFSWriter.setOverlayDir(VFSDir);
 
-  // Do not ignore non existent contents otherwise we might skip something
-  // that should have been collected here.
-  VFSWriter.setIgnoreNonExistentContents(false);
-
   // Explicitly set case sensitivity for the YAML writer. For that, find out
   // the sensitivity at the path where the headers all collected to.
   VFSWriter.setCaseSensitivity(isCaseSensitivePath(VFSDir));
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to