summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorJan Korous <jkorous@apple.com>2019-10-08 01:13:17 +0000
committerJan Korous <jkorous@apple.com>2019-10-08 01:13:17 +0000
commit3dab5e825b8c9ef0e7d129e6aaa382b69f813c48 (patch)
treeea2a6e4f2c92609e06c03b3148f30bb31be95bca /clang/lib/AST/ASTContext.cpp
parentffc67f92514c97558a93b51b46f20c264d2d31e6 (diff)
downloadbcm5719-llvm-3dab5e825b8c9ef0e7d129e6aaa382b69f813c48.tar.gz
bcm5719-llvm-3dab5e825b8c9ef0e7d129e6aaa382b69f813c48.zip
Reland 'Add VFS support for sanitizers' blacklist'
The original patch broke the test for Windows. Trying to fix as per Reid's suggestions outlined here: https://reviews.llvm.org/rC371663 Differential Revision: https://reviews.llvm.org/D67742 llvm-svn: 374006
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index a41b64ffcc8..906c54194d9 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -72,6 +72,7 @@
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
@@ -81,6 +82,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
@@ -826,6 +828,18 @@ static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI,
llvm_unreachable("getAddressSpaceMapMangling() doesn't cover anything.");
}
+static std::vector<std::string>
+getRealPaths(llvm::vfs::FileSystem &VFS, llvm::ArrayRef<std::string> Paths) {
+ std::vector<std::string> Result;
+ llvm::SmallString<128> Buffer;
+ for (const auto &File : Paths) {
+ if (std::error_code EC = VFS.getRealPath(File, Buffer))
+ llvm::report_fatal_error("can't open file '" + File + "': " + EC.message());
+ Result.push_back(Buffer.str());
+ }
+ return Result;
+}
+
ASTContext::ASTContext(LangOptions &LOpts, SourceManager &SM,
IdentifierTable &idents, SelectorTable &sels,
Builtin::Context &builtins)
@@ -833,7 +847,10 @@ ASTContext::ASTContext(LangOptions &LOpts, SourceManager &SM,
TemplateSpecializationTypes(this_()),
DependentTemplateSpecializationTypes(this_()),
SubstTemplateTemplateParmPacks(this_()), SourceMgr(SM), LangOpts(LOpts),
- SanitizerBL(new SanitizerBlacklist(LangOpts.SanitizerBlacklistFiles, SM)),
+ SanitizerBL(new SanitizerBlacklist(
+ getRealPaths(SM.getFileManager().getVirtualFileSystem(),
+ LangOpts.SanitizerBlacklistFiles),
+ SM)),
XRayFilter(new XRayFunctionFilter(LangOpts.XRayAlwaysInstrumentFiles,
LangOpts.XRayNeverInstrumentFiles,
LangOpts.XRayAttrListFiles, SM)),
OpenPOWER on IntegriCloud