Lines Matching +full:external +full:- +full:contents
1 //===- VirtualFileSystem.cpp - Virtual File System Layer --------*- C++ -*-===//
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
78 F->getBuffer(Name, Result, FileSize, RequiresNullTerminator, IsVolatile); in getBufferForFile()
82 //===-----------------------------------------------------------------------===/
84 //===-----------------------------------------------------------------------===/
101 int64_t FileSize = -1,
111 assert(FD != -1 && "cannot stat closed file"); in status()
128 assert(FD != -1 && "cannot get buffer for closed file"); in getBuffer()
151 FD = -1; in close()
185 Result->setName(Name.str()); in openFileForRead()
203 EC = Iter->status(S); in RealFSDirIter()
206 CurrentEntry.setName(Iter->path()); in RealFSDirIter()
220 EC = Iter->status(S); in increment()
222 CurrentEntry.setName(Iter->path()); in increment()
234 //===-----------------------------------------------------------------------===/
236 //===-----------------------------------------------------------------------===/
248 ErrorOr<Status> Status = (*I)->status(Path); in status()
260 std::error_code EC = (*I)->openFileForRead(Path, Result); in openFileForRead()
282 CurrentDirIter = (*CurrentFS)->dir_begin(Path, EC); in incrementFS()
321 CurrentDirIter = (*CurrentFS)->dir_begin(Path, EC); in OverlayFSDirIterImpl()
335 //===-----------------------------------------------------------------------===/
337 //===-----------------------------------------------------------------------===/
373 std::vector<Entry *> Contents; member in __anon63d25d9d0511::DirectoryEntry
378 DirectoryEntry(StringRef Name, std::vector<Entry *> Contents, Status S) in DirectoryEntry() argument
379 : Entry(EK_Directory, Name), Contents(std::move(Contents)), in DirectoryEntry()
383 iterator contents_begin() { return Contents.begin(); } in contents_begin()
384 iterator contents_end() { return Contents.end(); } in contents_end()
385 static bool classof(const Entry *E) { return E->getKind() == EK_Directory; } in classof()
403 /// \brief whether to use the external path as the name for this file.
408 static bool classof(const Entry *E) { return E->getKind() == EK_File; } in classof()
427 /// virtual file paths to existing external files, available in \c ExternalFS.
441 /// 'case-sensitive': <boolean, default=true>
442 /// 'use-external-names': <boolean, default=true>
449 /// 'contents': [ <file or directory entries> ]
462 /// Re-mapped files are represented as
467 /// 'use-external-name': <boolean> # Optional
468 /// 'external-contents': <path to external file>)
472 /// and inherit their attributes from the external contents.
479 /// \brief The file system to use for external references.
485 /// \brief Whether to perform case-sensitive comparisons.
487 /// Currently, case-insensitive matching only works correctly with ASCII.
490 /// \brief Whether to use to use the value of 'external-contents' for the
491 /// names of files. This global value is overridable on a per-file basis.
505 /// recursing into the contents of \p From if it is a directory.
516 /// returns a virtual file system representing its contents.
539 if (!S->isDirectory()) { in dir_begin()
547 *this, D->contents_begin(), D->contents_end(), EC)); in dir_begin()
567 Result = S->getValue(Storage); in parseScalarString()
620 if (I->second.Required && !I->second.Seen) { in checkMissingKeys()
621 error(Obj, Twine("missing key '") + I->first + "'"); in checkMissingKeys()
638 KeyStatusPair("contents", false), in parseEntry()
639 KeyStatusPair("external-contents", false), in parseEntry()
640 KeyStatusPair("use-external-name", false), in parseEntry()
646 bool HasContents = false; // external or otherwise in parseEntry()
653 for (yaml::MappingNode::iterator I = M->begin(), E = M->end(); I != E; in parseEntry()
659 if (!parseScalarString(I->getKey(), Key, Buffer)) in parseEntry()
662 if (!checkDuplicateOrUnknownKey(I->getKey(), Key, Keys)) in parseEntry()
667 if (!parseScalarString(I->getValue(), Value, Buffer)) in parseEntry()
671 if (!parseScalarString(I->getValue(), Value, Buffer)) in parseEntry()
678 error(I->getValue(), "unknown value for 'type'"); in parseEntry()
681 } else if (Key == "contents") { in parseEntry()
683 error(I->getKey(), in parseEntry()
684 "entry already has 'contents' or 'external-contents'"); in parseEntry()
688 yaml::SequenceNode *Contents = in parseEntry() local
689 dyn_cast<yaml::SequenceNode>(I->getValue()); in parseEntry()
690 if (!Contents) { in parseEntry()
692 error(I->getValue(), "expected array"); in parseEntry()
696 for (yaml::SequenceNode::iterator I = Contents->begin(), in parseEntry()
697 E = Contents->end(); in parseEntry()
704 } else if (Key == "external-contents") { in parseEntry()
706 error(I->getKey(), in parseEntry()
707 "entry already has 'contents' or 'external-contents'"); in parseEntry()
711 if (!parseScalarString(I->getValue(), Value, Buffer)) in parseEntry()
714 } else if (Key == "use-external-name") { in parseEntry()
716 if (!parseScalarBool(I->getValue(), Val)) in parseEntry()
729 error(N, "missing key 'contents' or 'external-contents'"); in parseEntry()
737 error(N, "'use-external-name' is not supported for directories"); in parseEntry()
746 Trimmed = Trimmed.slice(0, Trimmed.size()-1); in parseEntry()
791 KeyStatusPair("case-sensitive", false), in parse()
792 KeyStatusPair("use-external-names", false), in parse()
800 for (yaml::MappingNode::iterator I = Top->begin(), E = Top->end(); I != E; in parse()
804 if (!parseScalarString(I->getKey(), Key, KeyBuffer)) in parse()
807 if (!checkDuplicateOrUnknownKey(I->getKey(), Key, Keys)) in parse()
811 yaml::SequenceNode *Roots = dyn_cast<yaml::SequenceNode>(I->getValue()); in parse()
813 error(I->getValue(), "expected array"); in parse()
817 for (yaml::SequenceNode::iterator I = Roots->begin(), E = Roots->end(); in parse()
820 FS->Roots.push_back(E); in parse()
827 if (!parseScalarString(I->getValue(), VersionString, Storage)) in parse()
831 error(I->getValue(), "expected integer"); in parse()
835 error(I->getValue(), "invalid version number"); in parse()
839 error(I->getValue(), "version mismatch, expected 0"); in parse()
842 } else if (Key == "case-sensitive") { in parse()
843 if (!parseScalarBool(I->getValue(), FS->CaseSensitive)) in parse()
845 } else if (Key == "use-external-names") { in parse()
846 if (!parseScalarBool(I->getValue(), FS->UseExternalNames)) in parse()
864 DirectoryEntry::~DirectoryEntry() { llvm::DeleteContainerPointers(Contents); } in ~DirectoryEntry()
878 yaml::Node *Root = DI->getRoot(); in create()
918 if (Start->equals(".")) in lookupPath()
922 if (CaseSensitive ? !Start->equals(From->getName()) in lookupPath()
923 : !Start->equals_lower(From->getName())) in lookupPath()
938 for (DirectoryEntry::iterator I = DE->contents_begin(), in lookupPath()
939 E = DE->contents_end(); in lookupPath()
952 ErrorOr<Status> S = ExternalFS->status(F->getExternalContentsPath()); in status()
953 assert(!S || S->getName() == F->getExternalContentsPath()); in status()
954 if (S && !F->useExternalName(UseExternalNames)) in status()
955 S->setName(PathStr); in status()
957 S->IsVFSMapped = true; in status()
961 Status S = DE->getStatus(); in status()
986 ExternalFS->openFileForRead(F->getExternalContentsPath(), Result)) in openFileForRead()
989 if (!F->useExternalName(UseExternalNames)) in openFileForRead()
990 Result->setName(Path.str()); in openFileForRead()
1072 OS.indent(Indent + 2) << "'contents': [\n"; in startDirectory()
1088 OS.indent(Indent + 2) << "'external-contents': \"" in writeEntry()
1100 OS << " 'case-sensitive': '" in write()
1153 llvm::sys::path::append(PathStr, (*Current)->getName()); in VFSFromYamlDirIterImpl()
1166 llvm::sys::path::append(PathStr, (*Current)->getName()); in increment()
1181 directory_iterator I = FS->dir_begin(Path, EC); in recursive_directory_iterator()
1184 State->push(I); in recursive_directory_iterator()
1190 assert(FS && State && !State->empty() && "incrementing past end"); in increment()
1191 assert(State->top()->isStatusKnown() && "non-canonical end iterator"); in increment()
1193 if (State->top()->isDirectory()) { in increment()
1194 vfs::directory_iterator I = FS->dir_begin(State->top()->getName(), EC); in increment()
1198 State->push(I); in increment()
1203 while (!State->empty() && State->top().increment(EC) == End) in increment()
1204 State->pop(); in increment()
1206 if (State->empty()) in increment()