mibintc created this revision. mibintc added reviewers: Sanitizers, aaron.ballman, echristo, MaskRay. Herald added subscribers: dexonsmith, dang. Herald added a reviewer: jansvoboda11. mibintc requested review of this revision. Herald added a project: clang.
This changes the option names that include substring blacklist to blocklist. Also there are some "resource directory" builtin file names. I changed those from blacklist to blocklist. I looked in the doc to see if the builtin file names appear in the documentation, I couldn't find hits using e.g. "asan_blacklist.txt site:llvm.org" so I cautiously think they aren't documented and therefore fair game. In options.td there is a way to officially mark an option deprecated by adding it to a specific group, I didn't do that yet. When could we actually eliminate the old spelling? How about December 2021? I thought it would be best to start with the external clang interface, but i also want to make more patches to eliminate whitelist and blacklist in the comments and in the object names, file names etc. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D96203 Files: clang/include/clang/AST/ASTContext.h clang/include/clang/Basic/LangOptions.h clang/include/clang/Basic/SanitizerBlacklist.h clang/include/clang/Driver/Options.td clang/lib/AST/ASTContext.cpp clang/lib/AST/Decl.cpp clang/lib/Basic/LangOptions.cpp clang/lib/Basic/SanitizerBlacklist.cpp clang/lib/CodeGen/BackendUtil.cpp clang/lib/CodeGen/CGClass.cpp clang/lib/CodeGen/CGDeclCXX.cpp clang/lib/CodeGen/CGExpr.cpp clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenModule.h clang/lib/CodeGen/SanitizerMetadata.cpp clang/lib/Driver/SanitizerArgs.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/test/Driver/Inputs/resource_dir/share/asan_blacklist.txt clang/test/Driver/Inputs/resource_dir/share/asan_blocklist.txt clang/test/Driver/Inputs/resource_dir/share/hwasan_blacklist.txt clang/test/Driver/Inputs/resource_dir/share/hwasan_blocklist.txt clang/test/Driver/Inputs/resource_dir/share/ubsan_blacklist.txt clang/test/Driver/Inputs/resource_dir/share/ubsan_blocklist.txt clang/test/Driver/Inputs/resource_dir/share/vtables_blacklist.txt clang/test/Driver/Inputs/resource_dir/share/vtables_blocklist.txt clang/test/Driver/fsanitize-blacklist.c clang/test/Driver/print-file-name.c clang/test/Frontend/Inputs/resource_dir_with_sanitizer_blacklist/share/ubsan_blacklist.txt clang/test/Frontend/Inputs/resource_dir_with_sanitizer_blacklist/share/ubsan_blocklist.txt clang/test/Frontend/dependency-gen.c clang/unittests/Driver/SanitizerArgsTest.cpp
Index: clang/unittests/Driver/SanitizerArgsTest.cpp =================================================================== --- clang/unittests/Driver/SanitizerArgsTest.cpp +++ clang/unittests/Driver/SanitizerArgsTest.cpp @@ -92,30 +92,30 @@ std::unique_ptr<driver::Compilation> CompilationJob; }; -TEST_F(SanitizerArgsTest, Blacklists) { +TEST_F(SanitizerArgsTest, Blocklists) { const std::string ResourceDir = "/opt/llvm/lib/resources"; - const std::string UserBlacklist = "/source/my_blacklist.txt"; - const std::string ASanBlacklist = - concatPaths({ResourceDir, "share", "asan_blacklist.txt"}); + const std::string UserBlocklist = "/source/my_blocklist.txt"; + const std::string ASanBlocklist = + concatPaths({ResourceDir, "share", "asan_blocklist.txt"}); auto &Command = emulateSingleCompilation( /*ExtraArgs=*/{"-fsanitize=address", "-resource-dir", ResourceDir, - std::string("-fsanitize-blacklist=") + UserBlacklist}, - /*ExtraFiles=*/{ASanBlacklist, UserBlacklist}); + std::string("-fsanitize-blocklist=") + UserBlocklist}, + /*ExtraFiles=*/{ASanBlocklist, UserBlocklist}); - // System blacklists are added based on resource-dir. + // System blocklists are added based on resource-dir. EXPECT_THAT(Command.getArguments(), - Contains(StrEq(std::string("-fsanitize-system-blacklist=") + - ASanBlacklist))); - // User blacklists should also be added. + Contains(StrEq(std::string("-fsanitize-system-blocklist=") + + ASanBlocklist))); + // User blocklists should also be added. EXPECT_THAT( Command.getArguments(), - Contains(StrEq(std::string("-fsanitize-blacklist=") + UserBlacklist))); + Contains(StrEq(std::string("-fsanitize-blocklist=") + UserBlocklist))); } TEST_F(SanitizerArgsTest, XRayLists) { const std::string XRayWhitelist = "/source/xray_whitelist.txt"; - const std::string XRayBlacklist = "/source/xray_blacklist.txt"; + const std::string XRayBlocklist = "/source/xray_blocklist.txt"; const std::string XRayAttrList = "/source/xray_attr_list.txt"; auto &Command = emulateSingleCompilation( @@ -123,17 +123,17 @@ { "-fxray-instrument", "-fxray-always-instrument=" + XRayWhitelist, - "-fxray-never-instrument=" + XRayBlacklist, + "-fxray-never-instrument=" + XRayBlocklist, "-fxray-attr-list=" + XRayAttrList, }, - /*ExtraFiles=*/{XRayWhitelist, XRayBlacklist, XRayAttrList}); + /*ExtraFiles=*/{XRayWhitelist, XRayBlocklist, XRayAttrList}); - // Blacklists exist in the filesystem, so they should be added to the + // Blocklists exist in the filesystem, so they should be added to the // compilation command, produced by the driver. EXPECT_THAT(Command.getArguments(), Contains(StrEq("-fxray-always-instrument=" + XRayWhitelist))); EXPECT_THAT(Command.getArguments(), - Contains(StrEq("-fxray-never-instrument=" + XRayBlacklist))); + Contains(StrEq("-fxray-never-instrument=" + XRayBlocklist))); EXPECT_THAT(Command.getArguments(), Contains(StrEq("-fxray-attr-list=" + XRayAttrList))); } Index: clang/test/Frontend/dependency-gen.c =================================================================== --- clang/test/Frontend/dependency-gen.c +++ clang/test/Frontend/dependency-gen.c @@ -20,27 +20,27 @@ // RUN: cd a/b // RUN: %clang -MD -MF - %s -fsyntax-only -I ./ | FileCheck -check-prefix=CHECK-SIX %s // CHECK-SIX: {{ }}x.h -// RUN: echo "fun:foo" > %t.blacklist -// RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -fsanitize-blacklist=%t.blacklist -I ./ | FileCheck -check-prefix=CHECK-SEVEN %s -// CHECK-SEVEN: .blacklist +// RUN: echo "fun:foo" > %t.blocklist +// RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -fsanitize-blocklist=%t.blocklist -I ./ | FileCheck -check-prefix=CHECK-SEVEN %s +// CHECK-SEVEN: .blocklist // CHECK-SEVEN: {{ }}x.h #ifndef INCLUDE_FLAG_TEST #include <x.h> #endif -// RUN: echo "fun:foo" > %t.blacklist1 -// RUN: echo "fun:foo" > %t.blacklist2 -// RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -fsanitize-blacklist=%t.blacklist1 -fsanitize-blacklist=%t.blacklist2 -I ./ | FileCheck -check-prefix=TWO-BLACK-LISTS %s -// TWO-BLACK-LISTS: dependency-gen.o: -// TWO-BLACK-LISTS-DAG: blacklist1 -// TWO-BLACK-LISTS-DAG: blacklist2 -// TWO-BLACK-LISTS-DAG: x.h -// TWO-BLACK-LISTS-DAG: dependency-gen.c +// RUN: echo "fun:foo" > %t.blocklist1 +// RUN: echo "fun:foo" > %t.blocklist2 +// RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -fsanitize-blocklist=%t.blocklist1 -fsanitize-blocklist=%t.blocklist2 -I ./ | FileCheck -check-prefix=TWO-BLOCK-LISTS %s +// TWO-BLOCK-LISTS: dependency-gen.o: +// TWO-BLOCK-LISTS-DAG: blocklist1 +// TWO-BLOCK-LISTS-DAG: blocklist2 +// TWO-BLOCK-LISTS-DAG: x.h +// TWO-BLOCK-LISTS-DAG: dependency-gen.c // RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -I ./ | FileCheck -check-prefix=USER-AND-SYS-DEPS %s // USER-AND-SYS-DEPS: dependency-gen.o: -// USER-AND-SYS-DEPS-DAG: ubsan_blacklist.txt +// USER-AND-SYS-DEPS-DAG: ubsan_blocklist.txt // RUN: %clang -MMD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -I ./ | FileCheck -check-prefix=ONLY-USER-DEPS %s // ONLY-USER-DEPS: dependency-gen.o: -// NOT-ONLY-USER-DEPS: ubsan_blacklist.txt +// NOT-ONLY-USER-DEPS: ubsan_blocklist.txt Index: clang/test/Driver/print-file-name.c =================================================================== --- clang/test/Driver/print-file-name.c +++ clang/test/Driver/print-file-name.c @@ -1,10 +1,10 @@ // Test that -print-file-name finds the correct file. -// RUN: %clang -print-file-name=share/asan_blacklist.txt 2>&1 \ +// RUN: %clang -print-file-name=share/asan_blocklist.txt 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --target=x86_64-linux-gnu \ // RUN: | FileCheck --check-prefix=CHECK-RESOURCE-DIR %s -// CHECK-RESOURCE-DIR: resource_dir{{/|\\}}share{{/|\\}}asan_blacklist.txt +// CHECK-RESOURCE-DIR: resource_dir{{/|\\}}share{{/|\\}}asan_blocklist.txt // RUN: %clang -print-file-name=libclang_rt.builtins.a 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ Index: clang/test/Driver/fsanitize-blacklist.c =================================================================== --- clang/test/Driver/fsanitize-blacklist.c +++ clang/test/Driver/fsanitize-blacklist.c @@ -1,4 +1,4 @@ -// General blacklist usage. +// General blocklist usage. // PR12920 // REQUIRES: clang-driver @@ -12,63 +12,63 @@ // RUN: echo "fun:bar" > %t.second // RUN: echo "badline" > %t.bad -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST -// RUN: %clang -target aarch64-linux-gnu -fsanitize=hwaddress -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST -// CHECK-BLACKLIST: -fsanitize-blacklist={{.*}}.good" "-fsanitize-blacklist={{.*}}.second +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blocklist=%t.good -fsanitize-blocklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLOCKLIST +// RUN: %clang -target aarch64-linux-gnu -fsanitize=hwaddress -fsanitize-blocklist=%t.good -fsanitize-blocklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLOCKLIST +// CHECK-BLOCKLIST: -fsanitize-blocklist={{.*}}.good" "-fsanitize-blocklist={{.*}}.second -// Check that the default blacklist is not added as an extra dependency. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-BLACKLIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= -// CHECK-DEFAULT-BLACKLIST-ASAN: -fsanitize-system-blacklist={{.*[^w]}}asan_blacklist.txt -// RUN: %clang -target x86_64-linux-gnu -fsanitize=hwaddress -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-BLACKLIST-HWASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= -// CHECK-DEFAULT-BLACKLIST-HWASAN: -fsanitize-system-blacklist={{.*}}hwasan_blacklist.txt +// Check that the default blocklist is not added as an extra dependency. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-BLOCKLIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// CHECK-DEFAULT-BLOCKLIST-ASAN: -fsanitize-system-blocklist={{.*[^w]}}asan_blocklist.txt +// RUN: %clang -target x86_64-linux-gnu -fsanitize=hwaddress -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-BLOCKLIST-HWASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// CHECK-DEFAULT-BLOCKLIST-HWASAN: -fsanitize-system-blocklist={{.*}}hwasan_blocklist.txt -// RUN: %clang -target x86_64-linux-gnu -fsanitize=integer -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= -// RUN: %clang -target x86_64-linux-gnu -fsanitize=nullability -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= -// RUN: %clang -target x86_64-linux-gnu -fsanitize=alignment -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= -// RUN: %clang -target %itanium_abi_triple -fsanitize=float-divide-by-zero -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= -// CHECK-DEFAULT-UBSAN-BLACKLIST: -fsanitize-system-blacklist={{.*}}ubsan_blacklist.txt +// RUN: %clang -target x86_64-linux-gnu -fsanitize=integer -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLOCKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// RUN: %clang -target x86_64-linux-gnu -fsanitize=nullability -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLOCKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLOCKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// RUN: %clang -target x86_64-linux-gnu -fsanitize=alignment -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLOCKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// RUN: %clang -target %itanium_abi_triple -fsanitize=float-divide-by-zero -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLOCKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// CHECK-DEFAULT-UBSAN-BLOCKLIST: -fsanitize-system-blocklist={{.*}}ubsan_blocklist.txt -// Check that combining ubsan and another sanitizer results in both blacklists being used. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined,address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --check-prefix=CHECK-DEFAULT-BLACKLIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= +// Check that combining ubsan and another sanitizer results in both blocklists being used. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined,address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLOCKLIST --check-prefix=CHECK-DEFAULT-BLOCKLIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= -// Ignore -fsanitize-blacklist flag if there is no -fsanitize flag. -// RUN: %clang -target x86_64-linux-gnu -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS -// CHECK-NO-SANITIZE-NOT: -fsanitize-blacklist +// Ignore -fsanitize-blocklist flag if there is no -fsanitize flag. +// RUN: %clang -target x86_64-linux-gnu -fsanitize-blocklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS +// CHECK-NO-SANITIZE-NOT: -fsanitize-blocklist -// Ignore -fsanitize-blacklist flag if there is no -fsanitize flag. +// Ignore -fsanitize-blocklist flag if there is no -fsanitize flag. // Now, check for the absence of -fdepfile-entry flags. -// RUN: %clang -target x86_64-linux-gnu -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE2 --check-prefix=DELIMITERS +// RUN: %clang -target x86_64-linux-gnu -fsanitize-blocklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE2 --check-prefix=DELIMITERS // CHECK-NO-SANITIZE2-NOT: -fdepfile-entry -// Flag -fno-sanitize-blacklist wins if it is specified later. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-BLACKLIST --check-prefix=DELIMITERS -// CHECK-NO-BLACKLIST-NOT: -fsanitize-blacklist +// Flag -fno-sanitize-blocklist wins if it is specified later. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blocklist=%t.good -fno-sanitize-blocklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-BLOCKLIST --check-prefix=DELIMITERS +// CHECK-NO-BLOCKLIST-NOT: -fsanitize-blocklist -// Driver barks on unexisting blacklist files. -// RUN: %clang -target x86_64-linux-gnu -fno-sanitize-blacklist -fsanitize-blacklist=unexisting.txt %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SUCH-FILE +// Driver barks on unexisting blocklist files. +// RUN: %clang -target x86_64-linux-gnu -fno-sanitize-blocklist -fsanitize-blocklist=unexisting.txt %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SUCH-FILE // CHECK-NO-SUCH-FILE: error: no such file or directory: 'unexisting.txt' -// Driver properly reports malformed blacklist files. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.second -fsanitize-blacklist=%t.bad -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-BLACKLIST -// CHECK-BAD-BLACKLIST: error: malformed sanitizer blacklist: 'error parsing file '{{.*}}.bad': malformed line 1: 'badline'' +// Driver properly reports malformed blocklist files. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blocklist=%t.second -fsanitize-blocklist=%t.bad -fsanitize-blocklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-BLOCKLIST +// CHECK-BAD-BLOCKLIST: error: malformed sanitizer blacklist: 'error parsing file '{{.*}}.bad': malformed line 1: 'badline'' -// -fno-sanitize-blacklist disables all blacklists specified earlier. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED --implicit-check-not=-fsanitize-blacklist= +// -fno-sanitize-blocklist disables all blocklists specified earlier. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blocklist=%t.good -fno-sanitize-blocklist -fsanitize-blocklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED --implicit-check-not=-fsanitize-blocklist= // CHECK-ONLY_FIRST-DISABLED-NOT: good -// CHECK-ONLY-FIRST-DISABLED: -fsanitize-blacklist={{.*}}.second +// CHECK-ONLY-FIRST-DISABLED: -fsanitize-blocklist={{.*}}.second // CHECK-ONLY_FIRST-DISABLED-NOT: good -// -fno-sanitize-blacklist disables the system blacklists. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-sanitize-blacklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DISABLED-SYSTEM --check-prefix=DELIMITERS -// CHECK-DISABLED-SYSTEM-NOT: -fsanitize-system-blacklist +// -fno-sanitize-blocklist disables the system blocklists. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-sanitize-blocklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DISABLED-SYSTEM --check-prefix=DELIMITERS +// CHECK-DISABLED-SYSTEM-NOT: -fsanitize-system-blocklist -// If cfi_blacklist.txt cannot be found in the resource dir, driver should fail. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-BLACKLIST -// CHECK-MISSING-CFI-BLACKLIST: error: no such file or directory: '{{.*}}cfi_blacklist.txt' +// If cfi_blocklist.txt cannot be found in the resource dir, driver should fail. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-BLOCKLIST +// CHECK-MISSING-CFI-BLOCKLIST: error: no such file or directory: '{{.*}}cfi_blocklist.txt' -// -fno-sanitize-blacklist disables checking for cfi_blacklist.txt in the resource dir. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -fno-sanitize-blacklist -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-NO-BLACKLIST -// CHECK-MISSING-CFI-NO-BLACKLIST-NOT: error: no such file or directory: '{{.*}}cfi_blacklist.txt' +// -fno-sanitize-blocklist disables checking for cfi_blocklist.txt in the resource dir. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -fno-sanitize-blocklist -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-NO-BLOCKLIST +// CHECK-MISSING-CFI-NO-BLOCKLIST-NOT: error: no such file or directory: '{{.*}}cfi_blocklist.txt' // DELIMITERS: {{^ *"}} Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -1527,17 +1527,17 @@ } else { Opts.ShowIncludesDest = ShowIncludesDestination::None; } - // Add sanitizer blacklists as extra dependencies. + // Add sanitizer blocklists as extra dependencies. // They won't be discovered by the regular preprocessor, so // we let make / ninja to know about this implicit dependency. - if (!Args.hasArg(OPT_fno_sanitize_blacklist)) { - for (const auto *A : Args.filtered(OPT_fsanitize_blacklist)) { + if (!Args.hasArg(OPT_fno_sanitize_blocklist)) { + for (const auto *A : Args.filtered(OPT_fsanitize_blocklist)) { StringRef Val = A->getValue(); if (Val.find('=') == StringRef::npos) Opts.ExtraDeps.push_back(std::string(Val)); } if (Opts.IncludeSystemHeaders) { - for (const auto *A : Args.filtered(OPT_fsanitize_system_blacklist)) { + for (const auto *A : Args.filtered(OPT_fsanitize_system_blocklist)) { StringRef Val = A->getValue(); if (Val.find('=') == StringRef::npos) Opts.ExtraDeps.push_back(std::string(Val)); @@ -2872,11 +2872,11 @@ // Parse -fsanitize= arguments. parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ), Diags, Opts.Sanitize); - std::vector<std::string> systemBlacklists = - Args.getAllArgValues(OPT_fsanitize_system_blacklist); - Opts.SanitizerBlacklistFiles.insert(Opts.SanitizerBlacklistFiles.end(), - systemBlacklists.begin(), - systemBlacklists.end()); + std::vector<std::string> systemBlocklists = + Args.getAllArgValues(OPT_fsanitize_system_blocklist); + Opts.SanitizerBlocklistFiles.insert(Opts.SanitizerBlocklistFiles.end(), + systemBlocklists.begin(), + systemBlocklists.end()); if (Arg *A = Args.getLastArg(OPT_fclang_abi_compat_EQ)) { Opts.setClangABICompat(LangOptions::ClangABI::Latest); Index: clang/lib/Driver/SanitizerArgs.cpp =================================================================== --- clang/lib/Driver/SanitizerArgs.cpp +++ clang/lib/Driver/SanitizerArgs.cpp @@ -138,14 +138,14 @@ struct Blacklist { const char *File; SanitizerMask Mask; - } Blacklists[] = {{"asan_blacklist.txt", SanitizerKind::Address}, - {"hwasan_blacklist.txt", SanitizerKind::HWAddress}, - {"memtag_blacklist.txt", SanitizerKind::MemTag}, - {"msan_blacklist.txt", SanitizerKind::Memory}, - {"tsan_blacklist.txt", SanitizerKind::Thread}, + } Blacklists[] = {{"asan_blocklist.txt", SanitizerKind::Address}, + {"hwasan_blocklist.txt", SanitizerKind::HWAddress}, + {"memtag_blocklist.txt", SanitizerKind::MemTag}, + {"msan_blocklist.txt", SanitizerKind::Memory}, + {"tsan_blocklist.txt", SanitizerKind::Thread}, {"dfsan_abilist.txt", SanitizerKind::DataFlow}, - {"cfi_blacklist.txt", SanitizerKind::CFI}, - {"ubsan_blacklist.txt", + {"cfi_blocklist.txt", SanitizerKind::CFI}, + {"ubsan_blocklist.txt", SanitizerKind::Undefined | SanitizerKind::Integer | SanitizerKind::Nullability | SanitizerKind::FloatDivideByZero}}; @@ -581,17 +581,17 @@ TrappingKinds &= Kinds; RecoverableKinds &= ~TrappingKinds; - // Setup blacklist files. - // Add default blacklist from resource directory for activated sanitizers, and + // Setup blocklist files. + // Add default blocklist from resource directory for activated sanitizers, and // validate special case lists format. - if (!Args.hasArgNoClaim(options::OPT_fno_sanitize_blacklist)) + if (!Args.hasArgNoClaim(options::OPT_fno_sanitize_blocklist)) addDefaultBlacklists(D, Kinds, SystemBlacklistFiles); - // Parse -f(no-)?sanitize-blacklist options. + // Parse -f(no-)?sanitize-blocklist options. // This also validates special case lists format. parseSpecialCaseListArg(D, Args, UserBlacklistFiles, - options::OPT_fsanitize_blacklist, - options::OPT_fno_sanitize_blacklist, + options::OPT_fsanitize_blocklist, + options::OPT_fno_sanitize_blocklist, clang::diag::err_drv_malformed_sanitizer_blacklist); // Parse -f[no-]sanitize-memory-track-origins[=level] options. @@ -746,7 +746,7 @@ CoverageFeatures |= CoverageFunc; } - // Parse -fsanitize-coverage-(black|white)list options if coverage enabled. + // Parse -fsanitize-coverage-(block|white)list options if coverage enabled. // This also validates special case lists format. // Here, OptSpecifier() acts as a never-matching command-line argument. // So, there is no way to clear coverage lists but you can append to them. @@ -1006,9 +1006,9 @@ Args.MakeArgString("-fsanitize-trap=" + toString(TrapSanitizers))); addSpecialCaseListOpt(Args, CmdArgs, - "-fsanitize-blacklist=", UserBlacklistFiles); + "-fsanitize-blocklist=", UserBlacklistFiles); addSpecialCaseListOpt(Args, CmdArgs, - "-fsanitize-system-blacklist=", SystemBlacklistFiles); + "-fsanitize-system-blocklist=", SystemBlacklistFiles); if (MsanTrackOrigins) CmdArgs.push_back(Args.MakeArgString("-fsanitize-memory-track-origins=" + Index: clang/lib/CodeGen/SanitizerMetadata.cpp =================================================================== --- clang/lib/CodeGen/SanitizerMetadata.cpp +++ clang/lib/CodeGen/SanitizerMetadata.cpp @@ -34,8 +34,8 @@ bool IsExcluded) { if (!isAsanHwasanOrMemTag(CGM.getLangOpts().Sanitize)) return; - IsDynInit &= !CGM.isInSanitizerBlacklist(GV, Loc, Ty, "init"); - IsExcluded |= CGM.isInSanitizerBlacklist(GV, Loc, Ty); + IsDynInit &= !CGM.isInSanitizerBlocklist(GV, Loc, Ty, "init"); + IsExcluded |= CGM.isInSanitizerBlocklist(GV, Loc, Ty); llvm::Metadata *LocDescr = nullptr; llvm::Metadata *GlobalName = nullptr; Index: clang/lib/CodeGen/CodeGenModule.h =================================================================== --- clang/lib/CodeGen/CodeGenModule.h +++ clang/lib/CodeGen/CodeGenModule.h @@ -1267,10 +1267,10 @@ /// annotations are emitted during finalization of the LLVM code. void AddGlobalAnnotations(const ValueDecl *D, llvm::GlobalValue *GV); - bool isInSanitizerBlacklist(SanitizerMask Kind, llvm::Function *Fn, + bool isInSanitizerBlocklist(SanitizerMask Kind, llvm::Function *Fn, SourceLocation Loc) const; - bool isInSanitizerBlacklist(llvm::GlobalVariable *GV, SourceLocation Loc, + bool isInSanitizerBlocklist(llvm::GlobalVariable *GV, SourceLocation Loc, QualType Ty, StringRef Category = StringRef()) const; Index: clang/lib/CodeGen/CodeGenModule.cpp =================================================================== --- clang/lib/CodeGen/CodeGenModule.cpp +++ clang/lib/CodeGen/CodeGenModule.cpp @@ -2485,29 +2485,29 @@ Annotations.push_back(EmitAnnotateAttr(GV, I, D->getLocation())); } -bool CodeGenModule::isInSanitizerBlacklist(SanitizerMask Kind, +bool CodeGenModule::isInSanitizerBlocklist(SanitizerMask Kind, llvm::Function *Fn, SourceLocation Loc) const { - const auto &SanitizerBL = getContext().getSanitizerBlacklist(); - // Blacklist by function name. - if (SanitizerBL.isBlacklistedFunction(Kind, Fn->getName())) + const auto &SanitizerBL = getContext().getSanitizerBlocklist(); + // Blocklist by function name. + if (SanitizerBL.isBlocklistedFunction(Kind, Fn->getName())) return true; - // Blacklist by location. + // Blocklist by location. if (Loc.isValid()) - return SanitizerBL.isBlacklistedLocation(Kind, Loc); + return SanitizerBL.isBlocklistedLocation(Kind, Loc); // If location is unknown, this may be a compiler-generated function. Assume // it's located in the main file. auto &SM = Context.getSourceManager(); if (const auto *MainFile = SM.getFileEntryForID(SM.getMainFileID())) { - return SanitizerBL.isBlacklistedFile(Kind, MainFile->getName()); + return SanitizerBL.isBlocklistedFile(Kind, MainFile->getName()); } return false; } -bool CodeGenModule::isInSanitizerBlacklist(llvm::GlobalVariable *GV, +bool CodeGenModule::isInSanitizerBlocklist(llvm::GlobalVariable *GV, SourceLocation Loc, QualType Ty, StringRef Category) const { - // For now globals can be blacklisted only in ASan and KASan. + // For now globals can be blocklisted only in ASan and KASan. const SanitizerMask EnabledAsanMask = LangOpts.Sanitize.Mask & (SanitizerKind::Address | SanitizerKind::KernelAddress | @@ -2515,22 +2515,22 @@ SanitizerKind::MemTag); if (!EnabledAsanMask) return false; - const auto &SanitizerBL = getContext().getSanitizerBlacklist(); - if (SanitizerBL.isBlacklistedGlobal(EnabledAsanMask, GV->getName(), Category)) + const auto &SanitizerBL = getContext().getSanitizerBlocklist(); + if (SanitizerBL.isBlocklistedGlobal(EnabledAsanMask, GV->getName(), Category)) return true; - if (SanitizerBL.isBlacklistedLocation(EnabledAsanMask, Loc, Category)) + if (SanitizerBL.isBlocklistedLocation(EnabledAsanMask, Loc, Category)) return true; // Check global type. if (!Ty.isNull()) { // Drill down the array types: if global variable of a fixed type is - // blacklisted, we also don't instrument arrays of them. + // blocklisted, we also don't instrument arrays of them. while (auto AT = dyn_cast<ArrayType>(Ty.getTypePtr())) Ty = AT->getElementType(); Ty = Ty.getCanonicalType().getUnqualifiedType(); - // We allow to blacklist only record types (classes, structs etc.) + // We allow to blocklist only record types (classes, structs etc.) if (Ty->isRecordType()) { std::string TypeStr = Ty.getAsString(getContext().getPrintingPolicy()); - if (SanitizerBL.isBlacklistedType(EnabledAsanMask, TypeStr, Category)) + if (SanitizerBL.isBlocklistedType(EnabledAsanMask, TypeStr, Category)) return true; } } Index: clang/lib/CodeGen/CodeGenFunction.cpp =================================================================== --- clang/lib/CodeGen/CodeGenFunction.cpp +++ clang/lib/CodeGen/CodeGenFunction.cpp @@ -711,14 +711,14 @@ CurFnInfo = &FnInfo; assert(CurFn->isDeclaration() && "Function already has body?"); - // If this function has been blacklisted for any of the enabled sanitizers, + // If this function has been blocklisted for any of the enabled sanitizers, // disable the sanitizer for the function. do { #define SANITIZER(NAME, ID) \ if (SanOpts.empty()) \ break; \ if (SanOpts.has(SanitizerKind::ID)) \ - if (CGM.isInSanitizerBlacklist(SanitizerKind::ID, Fn, Loc)) \ + if (CGM.isInSanitizerBlocklist(SanitizerKind::ID, Fn, Loc)) \ SanOpts.set(SanitizerKind::ID, false); #include "clang/Basic/Sanitizers.def" Index: clang/lib/CodeGen/CGExpr.cpp =================================================================== --- clang/lib/CodeGen/CGExpr.cpp +++ clang/lib/CodeGen/CGExpr.cpp @@ -826,8 +826,8 @@ CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty.getUnqualifiedType(), Out); - // Blacklist based on the mangled type. - if (!CGM.getContext().getSanitizerBlacklist().isBlacklistedType( + // Blocklist based on the mangled type. + if (!CGM.getContext().getSanitizerBlocklist().isBlocklistedType( SanitizerKind::Vptr, Out.str())) { llvm::hash_code TypeHash = hash_value(Out.str()); Index: clang/lib/CodeGen/CGDeclCXX.cpp =================================================================== --- clang/lib/CodeGen/CGDeclCXX.cpp +++ clang/lib/CodeGen/CGDeclCXX.cpp @@ -388,43 +388,43 @@ Fn->setDoesNotThrow(); if (getLangOpts().Sanitize.has(SanitizerKind::Address) && - !isInSanitizerBlacklist(SanitizerKind::Address, Fn, Loc)) + !isInSanitizerBlocklist(SanitizerKind::Address, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::SanitizeAddress); if (getLangOpts().Sanitize.has(SanitizerKind::KernelAddress) && - !isInSanitizerBlacklist(SanitizerKind::KernelAddress, Fn, Loc)) + !isInSanitizerBlocklist(SanitizerKind::KernelAddress, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::SanitizeAddress); if (getLangOpts().Sanitize.has(SanitizerKind::HWAddress) && - !isInSanitizerBlacklist(SanitizerKind::HWAddress, Fn, Loc)) + !isInSanitizerBlocklist(SanitizerKind::HWAddress, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::SanitizeHWAddress); if (getLangOpts().Sanitize.has(SanitizerKind::KernelHWAddress) && - !isInSanitizerBlacklist(SanitizerKind::KernelHWAddress, Fn, Loc)) + !isInSanitizerBlocklist(SanitizerKind::KernelHWAddress, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::SanitizeHWAddress); if (getLangOpts().Sanitize.has(SanitizerKind::MemTag) && - !isInSanitizerBlacklist(SanitizerKind::MemTag, Fn, Loc)) + !isInSanitizerBlocklist(SanitizerKind::MemTag, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::SanitizeMemTag); if (getLangOpts().Sanitize.has(SanitizerKind::Thread) && - !isInSanitizerBlacklist(SanitizerKind::Thread, Fn, Loc)) + !isInSanitizerBlocklist(SanitizerKind::Thread, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::SanitizeThread); if (getLangOpts().Sanitize.has(SanitizerKind::Memory) && - !isInSanitizerBlacklist(SanitizerKind::Memory, Fn, Loc)) + !isInSanitizerBlocklist(SanitizerKind::Memory, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::SanitizeMemory); if (getLangOpts().Sanitize.has(SanitizerKind::KernelMemory) && - !isInSanitizerBlacklist(SanitizerKind::KernelMemory, Fn, Loc)) + !isInSanitizerBlocklist(SanitizerKind::KernelMemory, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::SanitizeMemory); if (getLangOpts().Sanitize.has(SanitizerKind::SafeStack) && - !isInSanitizerBlacklist(SanitizerKind::SafeStack, Fn, Loc)) + !isInSanitizerBlocklist(SanitizerKind::SafeStack, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::SafeStack); if (getLangOpts().Sanitize.has(SanitizerKind::ShadowCallStack) && - !isInSanitizerBlacklist(SanitizerKind::ShadowCallStack, Fn, Loc)) + !isInSanitizerBlocklist(SanitizerKind::ShadowCallStack, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::ShadowCallStack); return Fn; Index: clang/lib/CodeGen/CGClass.cpp =================================================================== --- clang/lib/CodeGen/CGClass.cpp +++ clang/lib/CodeGen/CGClass.cpp @@ -2776,7 +2776,7 @@ } std::string TypeName = RD->getQualifiedNameAsString(); - if (getContext().getSanitizerBlacklist().isBlacklistedType(M, TypeName)) + if (getContext().getSanitizerBlocklist().isBlocklistedType(M, TypeName)) return; SanitizerScope SanScope(this); @@ -2829,7 +2829,7 @@ return false; std::string TypeName = RD->getQualifiedNameAsString(); - return !getContext().getSanitizerBlacklist().isBlacklistedType( + return !getContext().getSanitizerBlocklist().isBlocklistedType( SanitizerKind::CFIVCall, TypeName); } @@ -2852,7 +2852,7 @@ std::string TypeName = RD->getQualifiedNameAsString(); if (SanOpts.has(SanitizerKind::CFIVCall) && - !getContext().getSanitizerBlacklist().isBlacklistedType( + !getContext().getSanitizerBlocklist().isBlocklistedType( SanitizerKind::CFIVCall, TypeName)) { EmitCheck(std::make_pair(CheckResult, SanitizerKind::CFIVCall), SanitizerHandler::CFICheckFail, {}, {}); Index: clang/lib/CodeGen/BackendUtil.cpp =================================================================== --- clang/lib/CodeGen/BackendUtil.cpp +++ clang/lib/CodeGen/BackendUtil.cpp @@ -362,7 +362,7 @@ static_cast<const PassManagerBuilderWrapper&>(Builder); const LangOptions &LangOpts = BuilderWrapper.getLangOpts(); PM.add( - createDataFlowSanitizerLegacyPassPass(LangOpts.SanitizerBlacklistFiles)); + createDataFlowSanitizerLegacyPassPass(LangOpts.SanitizerBlocklistFiles)); } static TargetLibraryInfoImpl *createTLII(llvm::Triple &TargetTriple, @@ -1321,7 +1321,7 @@ PB.registerOptimizerLastEPCallback( [this](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) { MPM.addPass( - DataFlowSanitizerPass(LangOpts.SanitizerBlacklistFiles)); + DataFlowSanitizerPass(LangOpts.SanitizerBlocklistFiles)); }); } Index: clang/lib/Basic/SanitizerBlacklist.cpp =================================================================== --- clang/lib/Basic/SanitizerBlacklist.cpp +++ clang/lib/Basic/SanitizerBlacklist.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// // -// User-provided blacklist used to disable/alter instrumentation done in +// User-provided blocklist used to disable/alter instrumentation done in // sanitizers. // //===----------------------------------------------------------------------===// @@ -19,41 +19,41 @@ using namespace clang; -SanitizerBlacklist::SanitizerBlacklist( - const std::vector<std::string> &BlacklistPaths, SourceManager &SM) +SanitizerBlocklist::SanitizerBlocklist( + const std::vector<std::string> &BlocklistPaths, SourceManager &SM) : SSCL(SanitizerSpecialCaseList::createOrDie( - BlacklistPaths, SM.getFileManager().getVirtualFileSystem())), + BlocklistPaths, SM.getFileManager().getVirtualFileSystem())), SM(SM) {} -SanitizerBlacklist::~SanitizerBlacklist() = default; +SanitizerBlocklist::~SanitizerBlocklist() = default; -bool SanitizerBlacklist::isBlacklistedGlobal(SanitizerMask Mask, +bool SanitizerBlocklist::isBlocklistedGlobal(SanitizerMask Mask, StringRef GlobalName, StringRef Category) const { return SSCL->inSection(Mask, "global", GlobalName, Category); } -bool SanitizerBlacklist::isBlacklistedType(SanitizerMask Mask, +bool SanitizerBlocklist::isBlocklistedType(SanitizerMask Mask, StringRef MangledTypeName, StringRef Category) const { return SSCL->inSection(Mask, "type", MangledTypeName, Category); } -bool SanitizerBlacklist::isBlacklistedFunction(SanitizerMask Mask, +bool SanitizerBlocklist::isBlocklistedFunction(SanitizerMask Mask, StringRef FunctionName) const { return SSCL->inSection(Mask, "fun", FunctionName); } -bool SanitizerBlacklist::isBlacklistedFile(SanitizerMask Mask, +bool SanitizerBlocklist::isBlocklistedFile(SanitizerMask Mask, StringRef FileName, StringRef Category) const { return SSCL->inSection(Mask, "src", FileName, Category); } -bool SanitizerBlacklist::isBlacklistedLocation(SanitizerMask Mask, +bool SanitizerBlocklist::isBlocklistedLocation(SanitizerMask Mask, SourceLocation Loc, StringRef Category) const { return Loc.isValid() && - isBlacklistedFile(Mask, SM.getFilename(SM.getFileLoc(Loc)), Category); + isBlocklistedFile(Mask, SM.getFilename(SM.getFileLoc(Loc)), Category); } Index: clang/lib/Basic/LangOptions.cpp =================================================================== --- clang/lib/Basic/LangOptions.cpp +++ clang/lib/Basic/LangOptions.cpp @@ -28,7 +28,7 @@ #include "clang/Basic/LangOptions.def" // These options do not affect AST generation. - SanitizerBlacklistFiles.clear(); + SanitizerBlocklistFiles.clear(); XRayAlwaysInstrumentFiles.clear(); XRayNeverInstrumentFiles.clear(); Index: clang/lib/AST/Decl.cpp =================================================================== --- clang/lib/AST/Decl.cpp +++ clang/lib/AST/Decl.cpp @@ -4594,7 +4594,7 @@ (SanitizerKind::Address | SanitizerKind::KernelAddress); if (!EnabledAsanMask || !Context.getLangOpts().SanitizeAddressFieldPadding) return false; - const auto &Blacklist = Context.getSanitizerBlacklist(); + const auto &Blocklist = Context.getSanitizerBlocklist(); const auto *CXXRD = dyn_cast<CXXRecordDecl>(this); // We may be able to relax some of these requirements. int ReasonToReject = -1; @@ -4610,10 +4610,10 @@ ReasonToReject = 4; // has trivial destructor. else if (CXXRD->isStandardLayout()) ReasonToReject = 5; // is standard layout. - else if (Blacklist.isBlacklistedLocation(EnabledAsanMask, getLocation(), + else if (Blocklist.isBlocklistedLocation(EnabledAsanMask, getLocation(), "field-padding")) ReasonToReject = 6; // is in an excluded file. - else if (Blacklist.isBlacklistedType(EnabledAsanMask, + else if (Blocklist.isBlocklistedType(EnabledAsanMask, getQualifiedNameAsString(), "field-padding")) ReasonToReject = 7; // The type is excluded. Index: clang/lib/AST/ASTContext.cpp =================================================================== --- clang/lib/AST/ASTContext.cpp +++ clang/lib/AST/ASTContext.cpp @@ -961,7 +961,7 @@ DependentTemplateSpecializationTypes(this_()), AutoTypes(this_()), SubstTemplateTemplateParmPacks(this_()), CanonTemplateTemplateParms(this_()), SourceMgr(SM), LangOpts(LOpts), - SanitizerBL(new SanitizerBlacklist(LangOpts.SanitizerBlacklistFiles, SM)), + SanitizerBL(new SanitizerBlocklist(LangOpts.SanitizerBlocklistFiles, SM)), XRayFilter(new XRayFunctionFilter(LangOpts.XRayAlwaysInstrumentFiles, LangOpts.XRayNeverInstrumentFiles, LangOpts.XRayAttrListFiles, SM)), Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -1409,16 +1409,29 @@ "or suspicious behavior. See user manual for available checks">; def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, Group<f_clang_Group>, Flags<[CoreOption, NoXarchOption]>; -def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">, +def fsanitize_blocklist : Joined<["-"], "fsanitize-blocklist=">, Group<f_clang_Group>, - HelpText<"Path to blacklist file for sanitizers">, - MarshallingInfoStringVector<LangOpts<"SanitizerBlacklistFiles">>; -def fsanitize_system_blacklist : Joined<["-"], "fsanitize-system-blacklist=">, - HelpText<"Path to system blacklist file for sanitizers">, + HelpText<"Path to blocklist file for sanitizers">, + MarshallingInfoStringVector<LangOpts<"SanitizerBlocklistFiles">>; +def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">, + Group<f_clang_Group>, Alias<fsanitize_blocklist>, + Flags<[HelpHidden]>, + HelpText<"Deprecated, use -fsanitize-blocklist= instead">; +def fsanitize_system_blocklist : Joined<["-"], "fsanitize-system-blocklist=">, + Group<f_clang_Group>, + HelpText<"Path to system blocklist file for sanitizers">, Flags<[CC1Option]>; -def fno_sanitize_blacklist : Flag<["-"], "fno-sanitize-blacklist">, +def fsanitize_system_blacklist : Joined<["-"], "fsanitize-system-blacklist=">, + Group<f_clang_Group>, Alias<fsanitize_system_blocklist>, + Flags<[CC1Option, HelpHidden]>, + HelpText<"Deprecated, use -fsanitize-system-blocklist= instead">; +def fno_sanitize_blocklist : Flag<["-"], "fno-sanitize-blocklist">, Group<f_clang_Group>, - HelpText<"Don't use blacklist file for sanitizers">; + HelpText<"Don't use blocklist file for sanitizers">; +def fno_sanitize_blacklist : Flag<["-"], "fno-sanitize-blacklist">, + Group<f_clang_Group>, + Flags<[HelpHidden]>, + HelpText<"Deprecated, use -fno-sanitize-blocklist= instead">; def fsanitize_coverage : CommaJoined<["-"], "fsanitize-coverage=">, Group<f_clang_Group>, Index: clang/include/clang/Basic/SanitizerBlacklist.h =================================================================== --- clang/include/clang/Basic/SanitizerBlacklist.h +++ clang/include/clang/Basic/SanitizerBlacklist.h @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// // -// User-provided blacklist used to disable/alter instrumentation done in +// User-provided blocklist used to disable/alter instrumentation done in // sanitizers. // //===----------------------------------------------------------------------===// @@ -25,22 +25,22 @@ class SourceManager; class SanitizerSpecialCaseList; -class SanitizerBlacklist { +class SanitizerBlocklist { std::unique_ptr<SanitizerSpecialCaseList> SSCL; SourceManager &SM; public: - SanitizerBlacklist(const std::vector<std::string> &BlacklistPaths, + SanitizerBlocklist(const std::vector<std::string> &BlocklistPaths, SourceManager &SM); - ~SanitizerBlacklist(); - bool isBlacklistedGlobal(SanitizerMask Mask, StringRef GlobalName, + ~SanitizerBlocklist(); + bool isBlocklistedGlobal(SanitizerMask Mask, StringRef GlobalName, StringRef Category = StringRef()) const; - bool isBlacklistedType(SanitizerMask Mask, StringRef MangledTypeName, + bool isBlocklistedType(SanitizerMask Mask, StringRef MangledTypeName, StringRef Category = StringRef()) const; - bool isBlacklistedFunction(SanitizerMask Mask, StringRef FunctionName) const; - bool isBlacklistedFile(SanitizerMask Mask, StringRef FileName, + bool isBlocklistedFunction(SanitizerMask Mask, StringRef FunctionName) const; + bool isBlocklistedFile(SanitizerMask Mask, StringRef FileName, StringRef Category = StringRef()) const; - bool isBlacklistedLocation(SanitizerMask Mask, SourceLocation Loc, + bool isBlocklistedLocation(SanitizerMask Mask, SourceLocation Loc, StringRef Category = StringRef()) const; }; Index: clang/include/clang/Basic/LangOptions.h =================================================================== --- clang/include/clang/Basic/LangOptions.h +++ clang/include/clang/Basic/LangOptions.h @@ -264,9 +264,9 @@ /// Set of enabled sanitizers. SanitizerSet Sanitize; - /// Paths to blacklist files specifying which objects + /// Paths to blocklist files specifying which objects /// (files, functions, variables) should not be instrumented. - std::vector<std::string> SanitizerBlacklistFiles; + std::vector<std::string> SanitizerBlocklistFiles; /// Paths to the XRay "always instrument" files specifying which /// objects (files, functions, variables) should be imbued with the XRay Index: clang/include/clang/AST/ASTContext.h =================================================================== --- clang/include/clang/AST/ASTContext.h +++ clang/include/clang/AST/ASTContext.h @@ -564,7 +564,7 @@ /// Blacklist object that is used by sanitizers to decide which /// entities should not be instrumented. - std::unique_ptr<SanitizerBlacklist> SanitizerBL; + std::unique_ptr<SanitizerBlocklist> SanitizerBL; /// Function filtering mechanism to determine whether a given function /// should be imbued with the XRay "always" or "never" attributes. @@ -691,7 +691,7 @@ return LangOpts.CPlusPlus || LangOpts.RecoveryAST; } - const SanitizerBlacklist &getSanitizerBlacklist() const { + const SanitizerBlocklist &getSanitizerBlocklist() const { return *SanitizerBL; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits