Skip to content

Commit c9e31f7

Browse files
committed
[apple/stable/20200108] Fix ambiguity
Fix error: conditional expression is ambiguous; 'const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char> >') can be converted to 'llvm::StringRef' and vice versa.
1 parent 1d9a5be commit c9e31f7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Support/VirtualFileSystem.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,8 +2010,8 @@ void JSONWriter::write(ArrayRef<YAMLVFSEntry> Entries,
20102010
if (!Entries.empty()) {
20112011
const YAMLVFSEntry &Entry = Entries.front();
20122012
bool first_entry_is_directory = Entry.IsDirectory;
2013-
StringRef Dir =
2014-
first_entry_is_directory ? Entry.VPath : path::parent_path(Entry.VPath);
2013+
StringRef Dir = first_entry_is_directory ? StringRef(Entry.VPath)
2014+
: path::parent_path(Entry.VPath);
20152015
startDirectory(Dir);
20162016

20172017
StringRef RPath = Entry.RPath;
@@ -2026,8 +2026,8 @@ void JSONWriter::write(ArrayRef<YAMLVFSEntry> Entries,
20262026
writeEntry(path::filename(Entry.VPath), RPath);
20272027

20282028
for (const auto &Entry : Entries.slice(1)) {
2029-
StringRef Dir =
2030-
Entry.IsDirectory ? Entry.VPath : path::parent_path(Entry.VPath);
2029+
StringRef Dir = Entry.IsDirectory ? StringRef(Entry.VPath)
2030+
: path::parent_path(Entry.VPath);
20312031
if (Dir == DirStack.back()) {
20322032
if (!first_entry_is_directory) {
20332033
OS << ",\n";

0 commit comments

Comments
 (0)