Skip to content

Commit 79610ab

Browse files
committed
Address test cases for contradict5 and contradict6.
Created using spr 1.3.6
1 parent c6e4f8e commit 79610ab

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

clang/test/CodeGen/ubsan-src-ignorelist-category.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict1 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE
88
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict2 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,SANITIZE
99
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict3 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE
10-
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict4 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE
10+
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict4 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,SANITIZE
1111
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict5 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE
12-
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict6 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE
12+
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict6 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,SANITIZE
1313

1414

1515
// Verify ubsan only emits checks for files in the allowlist

llvm/lib/Support/SpecialCaseList.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ unsigned SpecialCaseList::Matcher::match(StringRef Query) const {
7676
for (const auto &[Pattern, Pair] : Globs)
7777
if (Pair.first.match(Query))
7878
return Pair.second;
79-
for (const auto &[Regex, LineNumber] : RegExes)
80-
if (Regex->match(Query))
81-
return LineNumber;
79+
for (auto it = RegExes.crbegin(); it != RegExes.crend(); ++it)
80+
if (it->first->match(Query))
81+
return it->second;
8282
return 0;
8383
}
8484

@@ -220,9 +220,9 @@ bool SpecialCaseList::inSection(StringRef Section, StringRef Prefix,
220220
unsigned SpecialCaseList::inSectionBlame(StringRef Section, StringRef Prefix,
221221
StringRef Query,
222222
StringRef Category) const {
223-
for (const auto &S : Sections) {
224-
if (S.SectionMatcher->match(Section)) {
225-
unsigned Blame = inSectionBlame(S.Entries, Prefix, Query, Category);
223+
for (auto it = Sections.crbegin(); it != Sections.crend(); ++it) {
224+
if (it->SectionMatcher->match(Section)) {
225+
unsigned Blame = inSectionBlame(it->Entries, Prefix, Query, Category);
226226
if (Blame)
227227
return Blame;
228228
}

0 commit comments

Comments
 (0)