summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/VirtualFileSystem.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-02-24 20:56:37 +0000
committerBen Langmuir <blangmuir@apple.com>2014-02-24 20:56:37 +0000
commit97882e7b7fc761140d36858ace9437e9e2039cdd (patch)
treed70e12d29922531874ca9d90075cb4c84766cdbf /clang/lib/Basic/VirtualFileSystem.cpp
parent5b2f7c5f604da111060cec778e59c89e017ac1e4 (diff)
downloadbcm5719-llvm-97882e7b7fc761140d36858ace9437e9e2039cdd.tar.gz
bcm5719-llvm-97882e7b7fc761140d36858ace9437e9e2039cdd.zip
Pass through context for DiagHandler in VFS
This allows the unit tests to not use global state when checking diagnostics. llvm-svn: 202072
Diffstat (limited to 'clang/lib/Basic/VirtualFileSystem.cpp')
-rw-r--r--clang/lib/Basic/VirtualFileSystem.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Basic/VirtualFileSystem.cpp b/clang/lib/Basic/VirtualFileSystem.cpp
index a107db68e44..6aef524abae 100644
--- a/clang/lib/Basic/VirtualFileSystem.cpp
+++ b/clang/lib/Basic/VirtualFileSystem.cpp
@@ -357,6 +357,7 @@ public:
/// Takes ownership of \p Buffer.
static VFSFromYAML *create(MemoryBuffer *Buffer,
SourceMgr::DiagHandlerTy DiagHandler,
+ void *DiagContext,
IntrusiveRefCntPtr<FileSystem> ExternalFS);
ErrorOr<Status> status(const Twine &Path) LLVM_OVERRIDE;
@@ -645,12 +646,13 @@ VFSFromYAML::~VFSFromYAML() { llvm::DeleteContainerPointers(Roots); }
VFSFromYAML *VFSFromYAML::create(MemoryBuffer *Buffer,
SourceMgr::DiagHandlerTy DiagHandler,
+ void *DiagContext,
IntrusiveRefCntPtr<FileSystem> ExternalFS) {
SourceMgr SM;
yaml::Stream Stream(Buffer, SM);
- SM.setDiagHandler(DiagHandler);
+ SM.setDiagHandler(DiagHandler, DiagContext);
yaml::document_iterator DI = Stream.begin();
yaml::Node *Root = DI->getRoot();
if (DI == Stream.end() || !Root) {
@@ -753,8 +755,9 @@ error_code VFSFromYAML::openFileForRead(const Twine &Path,
IntrusiveRefCntPtr<FileSystem>
vfs::getVFSFromYAML(MemoryBuffer *Buffer, SourceMgr::DiagHandlerTy DiagHandler,
+ void *DiagContext,
IntrusiveRefCntPtr<FileSystem> ExternalFS) {
- return VFSFromYAML::create(Buffer, DiagHandler, ExternalFS);
+ return VFSFromYAML::create(Buffer, DiagHandler, DiagContext, ExternalFS);
}
UniqueID vfs::getNextVirtualUniqueID() {
OpenPOWER on IntegriCloud