Skip to content

Commit 1828d49

Browse files
committed
[clang][analyzer] Load config through the proper VFS
1 parent 30633f3 commit 1828d49

File tree

1 file changed

+6
-2
lines changed
  • clang/lib/StaticAnalyzer/Checkers

1 file changed

+6
-2
lines changed

clang/lib/StaticAnalyzer/Checkers/Yaml.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKER_YAML_H
1515
#define LLVM_CLANG_LIB_STATICANALYZER_CHECKER_YAML_H
1616

17+
#include "clang/Basic/SourceManager.h"
1718
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
1819
#include "llvm/Support/VirtualFileSystem.h"
1920
#include "llvm/Support/YAMLTraits.h"
@@ -31,9 +32,12 @@ std::optional<T> getConfiguration(CheckerManager &Mgr, Checker *Chk,
3132
if (ConfigFile.trim().empty())
3233
return std::nullopt;
3334

34-
llvm::vfs::FileSystem *FS = llvm::vfs::getRealFileSystem().get();
35+
auto &VFS = Mgr.getASTContext()
36+
.getSourceManager()
37+
.getFileManager()
38+
.getVirtualFileSystem();
3539
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Buffer =
36-
FS->getBufferForFile(ConfigFile.str());
40+
VFS.getBufferForFile(ConfigFile.str());
3741

3842
if (Buffer.getError()) {
3943
Mgr.reportInvalidCheckerOptionValue(Chk, Option,

0 commit comments

Comments
 (0)