From: Ilya Biryukov Date: Wed, 9 Oct 2019 09:40:22 +0000 (+0000) Subject: Revert r374006: Reland 'Add VFS support for sanitizers' blacklist' X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df7ea71c3adf23f056eb0e0b926cef002812fb59;p=platform%2Fupstream%2Fllvm.git Revert r374006: Reland 'Add VFS support for sanitizers' blacklist' Also revert follow-up changes to the test. Reason: the patch breaks our internal clang-tidy integration. It's also unclear why we should use getRealPath instead of plumbing the VFS to SanitizerBlacklist, see original commit thread of cfe-commits for a discussion. llvm-svn: 374151 --- diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 906c541..a41b64f 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -72,7 +72,6 @@ #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" @@ -82,7 +81,6 @@ #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 #include @@ -828,18 +826,6 @@ static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, llvm_unreachable("getAddressSpaceMapMangling() doesn't cover anything."); } -static std::vector -getRealPaths(llvm::vfs::FileSystem &VFS, llvm::ArrayRef Paths) { - std::vector 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) @@ -847,10 +833,7 @@ ASTContext::ASTContext(LangOptions &LOpts, SourceManager &SM, TemplateSpecializationTypes(this_()), DependentTemplateSpecializationTypes(this_()), SubstTemplateTemplateParmPacks(this_()), SourceMgr(SM), LangOpts(LOpts), - SanitizerBL(new SanitizerBlacklist( - getRealPaths(SM.getFileManager().getVirtualFileSystem(), - LangOpts.SanitizerBlacklistFiles), - SM)), + SanitizerBL(new SanitizerBlacklist(LangOpts.SanitizerBlacklistFiles, SM)), XRayFilter(new XRayFunctionFilter(LangOpts.XRayAlwaysInstrumentFiles, LangOpts.XRayNeverInstrumentFiles, LangOpts.XRayAttrListFiles, SM)), diff --git a/clang/test/CodeGen/Inputs/sanitizer-blacklist-vfsoverlay.yaml b/clang/test/CodeGen/Inputs/sanitizer-blacklist-vfsoverlay.yaml deleted file mode 100644 index df2b221..0000000 --- a/clang/test/CodeGen/Inputs/sanitizer-blacklist-vfsoverlay.yaml +++ /dev/null @@ -1,15 +0,0 @@ -{ - 'version': 0, - 'roots': [ - { 'name': '@DIR@', 'type': 'directory', - 'contents': [ - { 'name': 'only-virtual-file.blacklist', 'type': 'file', - 'external-contents': '@REAL_FILE@' - }, - { 'name': 'invalid-virtual-file.blacklist', 'type': 'file', - 'external-contents': '@NONEXISTENT_FILE@' - } - ] - } - ] -} diff --git a/clang/test/CodeGen/ubsan-blacklist-vfs.c b/clang/test/CodeGen/ubsan-blacklist-vfs.c deleted file mode 100644 index 0647cbf..0000000 --- a/clang/test/CodeGen/ubsan-blacklist-vfs.c +++ /dev/null @@ -1,36 +0,0 @@ -// Verify ubsan doesn't emit checks for blacklisted functions and files -// RUN: echo "fun:hash" > %t-func.blacklist -// RUN: echo "src:%s" | sed -e 's/\\/\\\\/g' > %t-file.blacklist - -// RUN: rm -f %t-vfsoverlay.yaml -// RUN: rm -f %t-nonexistent.blacklist -// RUN: sed -e "s|@DIR@|%/T|g" %S/Inputs/sanitizer-blacklist-vfsoverlay.yaml | sed -e "s|@REAL_FILE@|%/t-func.blacklist|g" | sed -e "s|@NONEXISTENT_FILE@|%/t-nonexistent.blacklist|g" > %t-vfsoverlay.yaml -// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%/T/only-virtual-file.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC - -// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%/T/invalid-virtual-file.blacklist -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE -// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': {{[Nn]}}o such file or directory - -// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%t-nonexistent.blacklist -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID -// INVALID: nonexistent.blacklist': {{[Nn]}}o such file or directory - -unsigned i; - -// DEFAULT: @hash -// FUNC: @hash -// FILE: @hash -unsigned hash() { -// DEFAULT: call {{.*}}void @__ubsan -// FUNC-NOT: call {{.*}}void @__ubsan -// FILE-NOT: call {{.*}}void @__ubsan - return i * 37; -} - -// DEFAULT: @add -// FUNC: @add -// FILE: @add -unsigned add() { -// DEFAULT: call {{.*}}void @__ubsan -// FUNC: call {{.*}}void @__ubsan -// FILE-NOT: call {{.*}}void @__ubsan - return i + 1; -}