diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2019-11-21 11:32:17 +0100 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2019-11-21 11:56:09 +0100 |
commit | aa981c1802d7353c777e399f2568e5a0e12dea21 (patch) | |
tree | 988917b64870affe5a5259fa9232419f1fac0ece /llvm/lib/Support/SpecialCaseList.cpp | |
parent | f65cfff605f2fd802fc337c6152474e3f3d22a1c (diff) | |
download | bcm5719-llvm-aa981c1802d7353c777e399f2568e5a0e12dea21.tar.gz bcm5719-llvm-aa981c1802d7353c777e399f2568e5a0e12dea21.zip |
Reland 9f3fdb0d7fab: [Driver] Use VFS to check if sanitizer blacklists exist
With updates to various LLVM tools that use SpecialCastList.
It was tempting to use RealFileSystem as the default, but that makes it
too easy to accidentally forget passing VFS in clang code.
Diffstat (limited to 'llvm/lib/Support/SpecialCaseList.cpp')
-rw-r--r-- | llvm/lib/Support/SpecialCaseList.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp index 5812f075aa4..d1ff44cefb0 100644 --- a/llvm/lib/Support/SpecialCaseList.cpp +++ b/llvm/lib/Support/SpecialCaseList.cpp @@ -18,6 +18,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Regex.h" +#include "llvm/Support/VirtualFileSystem.h" #include <string> #include <system_error> #include <utility> @@ -71,9 +72,9 @@ unsigned SpecialCaseList::Matcher::match(StringRef Query) const { std::unique_ptr<SpecialCaseList> SpecialCaseList::create(const std::vector<std::string> &Paths, - std::string &Error) { + llvm::vfs::FileSystem &FS, std::string &Error) { std::unique_ptr<SpecialCaseList> SCL(new SpecialCaseList()); - if (SCL->createInternal(Paths, Error)) + if (SCL->createInternal(Paths, FS, Error)) return SCL; return nullptr; } @@ -87,15 +88,16 @@ std::unique_ptr<SpecialCaseList> SpecialCaseList::create(const MemoryBuffer *MB, } std::unique_ptr<SpecialCaseList> -SpecialCaseList::createOrDie(const std::vector<std::string> &Paths) { +SpecialCaseList::createOrDie(const std::vector<std::string> &Paths, + llvm::vfs::FileSystem &FS) { std::string Error; - if (auto SCL = create(Paths, Error)) + if (auto SCL = create(Paths, FS, Error)) return SCL; report_fatal_error(Error); } bool SpecialCaseList::createInternal(const std::vector<std::string> &Paths, - std::string &Error, vfs::FileSystem &VFS) { + vfs::FileSystem &VFS, std::string &Error) { StringMap<size_t> Sections; for (const auto &Path : Paths) { ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr = |