diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/Support/SpecialCaseList.h | 9 | ||||
| -rw-r--r-- | llvm/lib/Support/SpecialCaseList.cpp | 12 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp | 5 |
3 files changed, 16 insertions, 10 deletions
diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h index 74a7a45312a..5b5b7f6124d 100644 --- a/llvm/include/llvm/Support/SpecialCaseList.h +++ b/llvm/include/llvm/Support/SpecialCaseList.h @@ -69,7 +69,8 @@ public: /// Parses the special case list entries from files. On failure, returns /// 0 and writes an error message to string. static std::unique_ptr<SpecialCaseList> - create(const std::vector<std::string> &Paths, std::string &Error); + create(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &FS, + std::string &Error); /// Parses the special case list from a memory buffer. On failure, returns /// 0 and writes an error message to string. static std::unique_ptr<SpecialCaseList> create(const MemoryBuffer *MB, @@ -77,7 +78,7 @@ public: /// Parses the special case list entries from files. On failure, reports a /// fatal error. static std::unique_ptr<SpecialCaseList> - createOrDie(const std::vector<std::string> &Paths); + createOrDie(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &FS); ~SpecialCaseList(); @@ -103,8 +104,8 @@ public: protected: // Implementations of the create*() functions that can also be used by derived // classes. - bool createInternal(const std::vector<std::string> &Paths, std::string &Error, - vfs::FileSystem &VFS = *vfs::getRealFileSystem()); + bool createInternal(const std::vector<std::string> &Paths, + vfs::FileSystem &VFS, std::string &Error); bool createInternal(const MemoryBuffer *MB, std::string &Error); SpecialCaseList() = default; 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 = diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp index 6f5ec3d0852..cf9a6a321c7 100644 --- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -88,6 +88,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/SpecialCaseList.h" +#include "llvm/Support/VirtualFileSystem.h" #include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Local.h" @@ -480,7 +481,9 @@ DataFlowSanitizer::DataFlowSanitizer( std::vector<std::string> AllABIListFiles(std::move(ABIListFiles)); AllABIListFiles.insert(AllABIListFiles.end(), ClABIListFiles.begin(), ClABIListFiles.end()); - ABIList.set(SpecialCaseList::createOrDie(AllABIListFiles)); + // FIXME: should we propagate vfs::FileSystem to this constructor? + ABIList.set( + SpecialCaseList::createOrDie(AllABIListFiles, *vfs::getRealFileSystem())); } FunctionType *DataFlowSanitizer::getArgsFunctionType(FunctionType *T) { |

