[llvm-branch-commits] [NFC] Run code formatter on Diagnostic.h/cpp ProfileList.cpp SpecialCaseList.cpp (PR #140295)
https://github.com/qinkunbao closed https://github.com/llvm/llvm-project/pull/140295 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [NFC] Run code formatter on Diagnostic.h/cpp ProfileList.cpp SpecialCaseList.cpp (PR #140295)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/140295 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [NFC] Run code formatter on Diagnostic.h/cpp ProfileList.cpp SpecialCaseList.cpp (PR #140295)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/140295 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [NFC] Run code formatter on Diagnostic.h/cpp ProfileList.cpp SpecialCaseList.cpp (PR #140295)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/140295 None Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [NFC] Run formatter on three files (PR #140269)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/140269 None Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [NFC] Run formatter on three files (PR #140269)
https://github.com/qinkunbao closed https://github.com/llvm/llvm-project/pull/140269 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFCI] Avoid adding duplicated SpecialCaseList::Sections. (PR #140821)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/140821 >From bb0e2f0bb26a47602978d1ac6f3d73a770075900 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Wed, 21 May 2025 00:28:47 + Subject: [PATCH 1/2] Remove lineno. Created using spr 1.3.6 --- llvm/include/llvm/Support/SpecialCaseList.h | 1 - llvm/lib/Support/SpecialCaseList.cpp| 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h index baa5c917220e3..fc6dc93651f38 100644 --- a/llvm/include/llvm/Support/SpecialCaseList.h +++ b/llvm/include/llvm/Support/SpecialCaseList.h @@ -138,7 +138,6 @@ class SpecialCaseList { std::unique_ptr SectionMatcher; SectionEntries Entries; std::string SectionStr; -unsigned LineNo; }; std::vector Sections; diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp index e8dac4680f96f..2d84f7f22cd7b 100644 --- a/llvm/lib/Support/SpecialCaseList.cpp +++ b/llvm/lib/Support/SpecialCaseList.cpp @@ -139,13 +139,12 @@ SpecialCaseList::addSection(StringRef SectionStr, unsigned LineNo, bool UseGlobs) { auto it = std::find_if(Sections.begin(), Sections.end(), [&](const Section &s) { -return s.SectionStr == SectionStr && s.LineNo == LineNo; +return s.SectionStr == SectionStr; }); if (it == Sections.end()) { Sections.emplace_back(); auto &sec = Sections.back(); sec.SectionStr = SectionStr; -sec.LineNo = LineNo; it = std::prev(Sections.end()); } if (auto Err = it->SectionMatcher->insert(SectionStr, LineNo, UseGlobs)) { >From 6c30ad8f079fe2fccc8fe194daaa0cf087577710 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Wed, 21 May 2025 01:30:49 + Subject: [PATCH 2/2] Add unit tests. Created using spr 1.3.6 --- .../unittests/Support/SpecialCaseListTest.cpp | 21 --- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/llvm/unittests/Support/SpecialCaseListTest.cpp b/llvm/unittests/Support/SpecialCaseListTest.cpp index d6d5621116d72..16da11e2d7835 100644 --- a/llvm/unittests/Support/SpecialCaseListTest.cpp +++ b/llvm/unittests/Support/SpecialCaseListTest.cpp @@ -216,8 +216,9 @@ TEST_F(SpecialCaseListTest, NoTrigramsInARule) { } TEST_F(SpecialCaseListTest, RepetitiveRule) { - std::unique_ptr SCL = makeSpecialCaseList("fun:*bar*bar*bar*bar*\n" - "fun:bar*\n"); + std::unique_ptr SCL = + makeSpecialCaseList("fun:*bar*bar*bar*bar*\n" + "fun:bar*\n"); EXPECT_TRUE(SCL->inSection("", "fun", "bara")); EXPECT_FALSE(SCL->inSection("", "fun", "abara")); EXPECT_TRUE(SCL->inSection("", "fun", "barbarbarbar")); @@ -226,7 +227,8 @@ TEST_F(SpecialCaseListTest, RepetitiveRule) { } TEST_F(SpecialCaseListTest, SpecialSymbolRule) { - std::unique_ptr SCL = makeSpecialCaseList("src:*c\\+\\+abi*\n"); + std::unique_ptr SCL = + makeSpecialCaseList("src:*c\\+\\+abi*\n"); EXPECT_TRUE(SCL->inSection("", "src", "c++abi")); EXPECT_FALSE(SCL->inSection("", "src", "c\\+\\+abi")); } @@ -242,8 +244,9 @@ TEST_F(SpecialCaseListTest, PopularTrigram) { } TEST_F(SpecialCaseListTest, EscapedSymbols) { - std::unique_ptr SCL = makeSpecialCaseList("src:*c\\+\\+abi*\n" - "src:*helloworld*\n"); + std::unique_ptr SCL = + makeSpecialCaseList("src:*c\\+\\+abi*\n" + "src:*helloworld*\n"); EXPECT_TRUE(SCL->inSection("", "src", "dir/c++abi")); EXPECT_FALSE(SCL->inSection("", "src", "dir/c\\+\\+abi")); EXPECT_FALSE(SCL->inSection("", "src", "c\\+\\+abi")); @@ -315,7 +318,9 @@ TEST_F(SpecialCaseListTest, Version3) { "src:def\n" "[sect2]\n" "src:def\n" - "src:def\n"); + "src:def\n" + "[sect1]\n" + "src:foo*\n"); EXPECT_TRUE(SCL->inSection("sect1", "src", "fooz")); EXPECT_TRUE(SCL->inSection("sect1", "src", "barz")); EXPECT_FALSE(SCL->inSection("sect2", "src", "fooz")); @@ -323,9 +328,9 @@ TEST_F(SpecialCaseListTest, Version3) { EXPECT_TRUE(SCL->inSection("sect2", "src", "def")); EXPECT_TRUE(SCL->inSection("sect1", "src", "def")); - EXPECT_EQ(2u, SCL->inSectionBlame("sect1", "src", "fooz")); EXPECT_EQ(4u, SCL->inSectionBlame("sect1", "src", "barz")); EXPECT_EQ(5u, SCL->inSectionBlame("sect1", "src", "def")); EXPECT_EQ(8u, SCL->inSectionBlame("sect2", "src", "def")); + EXPECT_EQ(10u, SCL
[llvm-branch-commits] [llvm] [NFCI] Avoid adding duplicated SpecialCaseList::Sections. (PR #140821)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/140821 >From bb0e2f0bb26a47602978d1ac6f3d73a770075900 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Wed, 21 May 2025 00:28:47 + Subject: [PATCH] Remove lineno. Created using spr 1.3.6 --- llvm/include/llvm/Support/SpecialCaseList.h | 1 - llvm/lib/Support/SpecialCaseList.cpp| 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h index baa5c917220e3..fc6dc93651f38 100644 --- a/llvm/include/llvm/Support/SpecialCaseList.h +++ b/llvm/include/llvm/Support/SpecialCaseList.h @@ -138,7 +138,6 @@ class SpecialCaseList { std::unique_ptr SectionMatcher; SectionEntries Entries; std::string SectionStr; -unsigned LineNo; }; std::vector Sections; diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp index e8dac4680f96f..2d84f7f22cd7b 100644 --- a/llvm/lib/Support/SpecialCaseList.cpp +++ b/llvm/lib/Support/SpecialCaseList.cpp @@ -139,13 +139,12 @@ SpecialCaseList::addSection(StringRef SectionStr, unsigned LineNo, bool UseGlobs) { auto it = std::find_if(Sections.begin(), Sections.end(), [&](const Section &s) { -return s.SectionStr == SectionStr && s.LineNo == LineNo; +return s.SectionStr == SectionStr; }); if (it == Sections.end()) { Sections.emplace_back(); auto &sec = Sections.back(); sec.SectionStr = SectionStr; -sec.LineNo = LineNo; it = std::prev(Sections.end()); } if (auto Err = it->SectionMatcher->insert(SectionStr, LineNo, UseGlobs)) { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [NFCI] Avoid adding duplicated SpecialCaseList::Sections. (PR #140821)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/140821 https://github.com/llvm/llvm-project/pull/140127 converts SpecialCaseList::Sections from StringMap to vector. However, the previous StringMap ensures that only a new section is created when the SectionStr is different. We should keep the same behavior. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] Fix the tests that have multiple same entry. (PR #140751)
https://github.com/qinkunbao closed https://github.com/llvm/llvm-project/pull/140751 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] Fix the tests that have multiple same entry. (PR #140751)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/140751 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] Implement src:*=sanitize for UBSan. (PR #140489)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/140489 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] Implement src:*=sanitize for UBSan. (PR #140489)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/140489 >From d383fc3d23c0c302d134a76d39491c87547526a1 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Mon, 19 May 2025 02:45:30 + Subject: [PATCH] fix format Created using spr 1.3.6 --- clang/include/clang/Basic/SanitizerSpecialCaseList.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/SanitizerSpecialCaseList.h b/clang/include/clang/Basic/SanitizerSpecialCaseList.h index dd01a786dee01..25d518e7128cf 100644 --- a/clang/include/clang/Basic/SanitizerSpecialCaseList.h +++ b/clang/include/clang/Basic/SanitizerSpecialCaseList.h @@ -44,9 +44,9 @@ class SanitizerSpecialCaseList : public llvm::SpecialCaseList { StringRef Category = StringRef()) const; // Query ignorelisted entries if any bit in Mask matches the entry's section. - // Return 0 if not found. If found, return the line number (starts with 1). + // Return 0 if not found. If found, return the line number (starts with 1). unsigned inSectionBlame(SanitizerMask Mask, StringRef Prefix, StringRef Query, - StringRef Category = StringRef()) const; + StringRef Category = StringRef()) const; protected: // Initialize SanitizerSections. @@ -54,7 +54,7 @@ class SanitizerSpecialCaseList : public llvm::SpecialCaseList { struct SanitizerSection { SanitizerSection(SanitizerMask SM, SectionEntries &E) -: Mask(SM), Entries(E){}; +: Mask(SM), Entries(E) {}; SanitizerMask Mask; SectionEntries &Entries; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] Implement src:*=sanitize for UBSan. (PR #140489)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/140489 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] Implement src:*=sanitize for UBSan. (PR #140489)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/140489 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] Implement src:*=sanitize for UBSan. (PR #140489)
https://github.com/qinkunbao converted_to_draft https://github.com/llvm/llvm-project/pull/140489 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] Implement src:*=sanitize for UBSan. (PR #140489)
https://github.com/qinkunbao closed https://github.com/llvm/llvm-project/pull/140489 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] Implement src:*=sanitize for UBSan. (PR #140489)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/140489 >From d383fc3d23c0c302d134a76d39491c87547526a1 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Mon, 19 May 2025 02:45:30 + Subject: [PATCH 1/2] fix format Created using spr 1.3.6 --- clang/include/clang/Basic/SanitizerSpecialCaseList.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/SanitizerSpecialCaseList.h b/clang/include/clang/Basic/SanitizerSpecialCaseList.h index dd01a786dee01..25d518e7128cf 100644 --- a/clang/include/clang/Basic/SanitizerSpecialCaseList.h +++ b/clang/include/clang/Basic/SanitizerSpecialCaseList.h @@ -44,9 +44,9 @@ class SanitizerSpecialCaseList : public llvm::SpecialCaseList { StringRef Category = StringRef()) const; // Query ignorelisted entries if any bit in Mask matches the entry's section. - // Return 0 if not found. If found, return the line number (starts with 1). + // Return 0 if not found. If found, return the line number (starts with 1). unsigned inSectionBlame(SanitizerMask Mask, StringRef Prefix, StringRef Query, - StringRef Category = StringRef()) const; + StringRef Category = StringRef()) const; protected: // Initialize SanitizerSections. @@ -54,7 +54,7 @@ class SanitizerSpecialCaseList : public llvm::SpecialCaseList { struct SanitizerSection { SanitizerSection(SanitizerMask SM, SectionEntries &E) -: Mask(SM), Entries(E){}; +: Mask(SM), Entries(E) {}; SanitizerMask Mask; SectionEntries &Entries; >From da2f95e6399b539e45ec9235f5751cb6c98acf77 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Mon, 19 May 2025 03:20:43 + Subject: [PATCH 2/2] fix tests Created using spr 1.3.6 --- clang/lib/Basic/SanitizerSpecialCaseList.cpp | 7 ++- clang/test/CodeGen/ubsan-src-ignorelist-category.test | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/clang/lib/Basic/SanitizerSpecialCaseList.cpp b/clang/lib/Basic/SanitizerSpecialCaseList.cpp index 3bf79876235db..7da36f3801453 100644 --- a/clang/lib/Basic/SanitizerSpecialCaseList.cpp +++ b/clang/lib/Basic/SanitizerSpecialCaseList.cpp @@ -56,7 +56,12 @@ void SanitizerSpecialCaseList::createSanitizerSections() { bool SanitizerSpecialCaseList::inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query, StringRef Category) const { - return inSectionBlame(Mask, Prefix, Query, Category) > 0; + for (auto &S : SanitizerSections) +if ((S.Mask & Mask) && +SpecialCaseList::inSectionBlame(S.Entries, Prefix, Query, Category)) + return true; + + return false; } unsigned SanitizerSpecialCaseList::inSectionBlame(SanitizerMask Mask, diff --git a/clang/test/CodeGen/ubsan-src-ignorelist-category.test b/clang/test/CodeGen/ubsan-src-ignorelist-category.test index f32dc5cbb9e13..e0efd65df8652 100644 --- a/clang/test/CodeGen/ubsan-src-ignorelist-category.test +++ b/clang/test/CodeGen/ubsan-src-ignorelist-category.test @@ -17,7 +17,7 @@ src:* src:*/test1.c=sanitize src:*/test1.c -//--- src.ignorelist.contradict1 +//--- src.ignorelist.contradict2 src:* src:*/test1.c src:*/test1.c=sanitize ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] Implement src:*=sanitize for UBSan. (PR #140489)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/140489 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] fix format in SpecialCaseList.cpp (PR #140479)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/140479 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] fix format in SpecialCaseList.cpp (PR #140479)
https://github.com/qinkunbao closed https://github.com/llvm/llvm-project/pull/140479 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] Change inSectionBlame to return pair (FileIdx, LineNo). (PR #141540)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/141540 Accoring to the discussion in https://github.com/llvm/llvm-project/pull/140529, we need to SSCL can be created from multiple ignore list files, so we can repeat -fsanitize-ignorelist=. The change is necessary to achieve the feature described in https://github.com/llvm/llvm-project/issues/139128. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] Change inSectionBlame to return pair (FileIdx, LineNo). (PR #141540)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/141540 >From d5508cc217f413b3bbb7a301b2110cfc0c2c6cbc Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Tue, 27 May 2025 03:24:26 + Subject: [PATCH] Format SpecialCaseList.h Created using spr 1.3.6 --- llvm/include/llvm/Support/SpecialCaseList.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h index bce337f553a93..d54b242a9c501 100644 --- a/llvm/include/llvm/Support/SpecialCaseList.h +++ b/llvm/include/llvm/Support/SpecialCaseList.h @@ -17,8 +17,8 @@ #include "llvm/Support/GlobPattern.h" #include "llvm/Support/Regex.h" #include -#include #include +#include #include namespace llvm { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] Change inSectionBlame to return pair (FileIdx, LineNo). (PR #141540)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/141540 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] Change inSectionBlame to return pair (FileIdx, LineNo). (PR #141540)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/141540 >From d5508cc217f413b3bbb7a301b2110cfc0c2c6cbc Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Tue, 27 May 2025 03:24:26 + Subject: [PATCH 1/2] Format SpecialCaseList.h Created using spr 1.3.6 --- llvm/include/llvm/Support/SpecialCaseList.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h index bce337f553a93..d54b242a9c501 100644 --- a/llvm/include/llvm/Support/SpecialCaseList.h +++ b/llvm/include/llvm/Support/SpecialCaseList.h @@ -17,8 +17,8 @@ #include "llvm/Support/GlobPattern.h" #include "llvm/Support/Regex.h" #include -#include #include +#include #include namespace llvm { >From b094fc2f5e3fe0d9b65f86a3f6eda04a6ab41e47 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Tue, 27 May 2025 14:01:19 + Subject: [PATCH 2/2] Remove irelevant format changes Created using spr 1.3.6 --- llvm/unittests/Support/SpecialCaseListTest.cpp | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/llvm/unittests/Support/SpecialCaseListTest.cpp b/llvm/unittests/Support/SpecialCaseListTest.cpp index da4c557e740e6..0fe6a427c0562 100644 --- a/llvm/unittests/Support/SpecialCaseListTest.cpp +++ b/llvm/unittests/Support/SpecialCaseListTest.cpp @@ -218,9 +218,8 @@ TEST_F(SpecialCaseListTest, NoTrigramsInARule) { } TEST_F(SpecialCaseListTest, RepetitiveRule) { - std::unique_ptr SCL = - makeSpecialCaseList("fun:*bar*bar*bar*bar*\n" - "fun:bar*\n"); + std::unique_ptr SCL = makeSpecialCaseList("fun:*bar*bar*bar*bar*\n" + "fun:bar*\n"); EXPECT_TRUE(SCL->inSection("", "fun", "bara")); EXPECT_FALSE(SCL->inSection("", "fun", "abara")); EXPECT_TRUE(SCL->inSection("", "fun", "barbarbarbar")); @@ -229,8 +228,7 @@ TEST_F(SpecialCaseListTest, RepetitiveRule) { } TEST_F(SpecialCaseListTest, SpecialSymbolRule) { - std::unique_ptr SCL = - makeSpecialCaseList("src:*c\\+\\+abi*\n"); + std::unique_ptr SCL = makeSpecialCaseList("src:*c\\+\\+abi*\n"); EXPECT_TRUE(SCL->inSection("", "src", "c++abi")); EXPECT_FALSE(SCL->inSection("", "src", "c\\+\\+abi")); } @@ -246,9 +244,8 @@ TEST_F(SpecialCaseListTest, PopularTrigram) { } TEST_F(SpecialCaseListTest, EscapedSymbols) { - std::unique_ptr SCL = - makeSpecialCaseList("src:*c\\+\\+abi*\n" - "src:*helloworld*\n"); + std::unique_ptr SCL = makeSpecialCaseList("src:*c\\+\\+abi*\n" + "src:*helloworld*\n"); EXPECT_TRUE(SCL->inSection("", "src", "dir/c++abi")); EXPECT_FALSE(SCL->inSection("", "src", "dir/c\\+\\+abi")); EXPECT_FALSE(SCL->inSection("", "src", "c\\+\\+abi")); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] Change SpecialCaseList::inSectionBlame to return pair (FileIdx, LineNo). (PR #141540)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/141540 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [UBSan] Support src:*=sanitize for multiple ignorelists. (PR #141640)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/141640 >From cddba024f55d52e30d9c74369b3707b5fce64a20 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Tue, 27 May 2025 17:34:51 + Subject: [PATCH] Add some comments. Created using spr 1.3.6 --- clang/lib/Basic/NoSanitizeList.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/lib/Basic/NoSanitizeList.cpp b/clang/lib/Basic/NoSanitizeList.cpp index c58a67971dfb6..549bbda55e459 100644 --- a/clang/lib/Basic/NoSanitizeList.cpp +++ b/clang/lib/Basic/NoSanitizeList.cpp @@ -53,6 +53,8 @@ bool NoSanitizeList::containsFile(SanitizerMask Mask, StringRef FileName, // If we have two cases such as `src:a.cpp=sanitize` and `src:a.cpp`, the // current entry override the previous entry. if (SanLine > 0) +// std::pair uses lexicographic comparison. It will compare the file index +// first and then comapre the line number. return std::make_pair(NoSanFileIdx, NoSanLine) > std::make_pair(SanFileIdx, SanLine); return true; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [UBSan] Support src:*=sanitize for multiple ignorelists. (PR #141640)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/141640 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [UBSan] Support src:*=sanitize for multiple ignorelists. (PR #141640)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/141640 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [UBSan] Support src:*=sanitize for multiple ignorelists. (PR #141640)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/141640 See: https://github.com/llvm/llvm-project/issues/139128 for the background. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [UBSan] Support src:*=sanitize for multiple ignorelists. (PR #141640)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/141640 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [UBSan] Support src:*=sanitize for multiple ignorelists. (PR #141640)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/141640 >From cddba024f55d52e30d9c74369b3707b5fce64a20 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Tue, 27 May 2025 17:34:51 + Subject: [PATCH 1/2] Add some comments. Created using spr 1.3.6 --- clang/lib/Basic/NoSanitizeList.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/lib/Basic/NoSanitizeList.cpp b/clang/lib/Basic/NoSanitizeList.cpp index c58a67971dfb6..549bbda55e459 100644 --- a/clang/lib/Basic/NoSanitizeList.cpp +++ b/clang/lib/Basic/NoSanitizeList.cpp @@ -53,6 +53,8 @@ bool NoSanitizeList::containsFile(SanitizerMask Mask, StringRef FileName, // If we have two cases such as `src:a.cpp=sanitize` and `src:a.cpp`, the // current entry override the previous entry. if (SanLine > 0) +// std::pair uses lexicographic comparison. It will compare the file index +// first and then comapre the line number. return std::make_pair(NoSanFileIdx, NoSanLine) > std::make_pair(SanFileIdx, SanLine); return true; >From 468bc103fa1a88329d2502356411de1fcf6f306e Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Tue, 27 May 2025 18:22:14 + Subject: [PATCH 2/2] Update tests. Created using spr 1.3.6 --- clang/test/CodeGen/ubsan-src-ignorelist-category.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/test/CodeGen/ubsan-src-ignorelist-category.test b/clang/test/CodeGen/ubsan-src-ignorelist-category.test index 0ff2ea5c456a1..96a4abb1d1020 100644 --- a/clang/test/CodeGen/ubsan-src-ignorelist-category.test +++ b/clang/test/CodeGen/ubsan-src-ignorelist-category.test @@ -12,8 +12,8 @@ // 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 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict7 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict8 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,SANITIZE -// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict8 -fsanitize-ignorelist=%t/src.ignorelist.contradict9 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE -// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict9 -fsanitize-ignorelist=%t/src.ignorelist.contradict8 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,SANITIZE +// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist -fsanitize-ignorelist=%t/src.ignorelist.contradict9 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE +// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict9 -fsanitize-ignorelist=%t/src.ignorelist -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,SANITIZE // Verify ubsan only emits checks for files in the allowlist ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [UBSan] Support src:*=sanitize for multiple ignorelists. (PR #141640)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/141640 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFCI] Change SpecialCaseList::inSectionBlame to return pair (FileIdx, LineNo). (PR #141540)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/141540 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] Fix the unit test errors. (PR #140184)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/140184 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] Fix the unit test errors. (PR #140184)
https://github.com/qinkunbao closed https://github.com/llvm/llvm-project/pull/140184 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFCI] Avoid adding duplicated SpecialCaseList::Sections. (PR #140821)
qinkunbao wrote: > Make Glob a vector added in parsing order Yeah, that is needed. > Make sections a vector added in parsing order It is not necessary. > duplicate entries is not a problem as they should not be common It is not common but we need to iterate all the sections every time to ensure the correctness. ``` [sec1] src:a.txt src:b.txt [sec1] src:b.txt [sec1] src:b.txt ``` Suppose we have the function query `inSectionBlame(Section="sec1", Prefix="src", Query="a.txt", we need to iterate all sections to find the entry and get the correct line number `2`. https://github.com/llvm/llvm-project/pull/140821 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFCI] Avoid adding duplicated SpecialCaseList::Sections. (PR #140821)
qinkunbao wrote: Hi Vitaly, Sorry for the late reply. I am thinking about a good solution for https://github.com/llvm/llvm-project/pull/139772 in the past two days. At the moment, I am thinking only the order of `Globs` and `RegExes` (Or `Pattern`) matters. The order of `Section`, `Prefix` and `Category` does not matter. Without this PR, considering the following example. ``` [sec1] src:a.txt src:b.txt [sec1] src:b.txt [sec1] src:b.txt ``` We have to iterate the all the sections (all entry) to know if a.txt should be matched or not. This pull request (or by reverting[ https://github.com/llvm/llvm-project/pull/140127](https://github.com/llvm/llvm-project/pull/140127)) simplifies the process to finding the last matching Pattern for a given Prefix and Category by jumping to sec1 and performing a reverse walk. Each matched pattern provides a line number and a file number. Entries with higher line numbers take precedence over those with lower line numbers. I'm interested in your feedback and we can discuss this further in our meeting. https://github.com/llvm/llvm-project/pull/140821 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFCI] Avoid adding duplicated SpecialCaseList::Sections. (PR #140821)
qinkunbao wrote: Discussed with @vitalybuka offline. It turns out that Section name can be a regular expression so the order of Section needs to be tacked (with a vector). https://github.com/llvm/llvm-project/pull/140821 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFCI] Avoid adding duplicated SpecialCaseList::Sections. (PR #140821)
https://github.com/qinkunbao closed https://github.com/llvm/llvm-project/pull/140821 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] change GlobPattern:Prefix from stringref to string. (PR #141270)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/141270 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] change GlobPattern:Prefix from stringref to string. (PR #141270)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/141270 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] change GlobPattern:Prefix from stringref to string. (PR #141270)
https://github.com/qinkunbao closed https://github.com/llvm/llvm-project/pull/141270 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [NoSanitizeList][NFI] Add containsPrefix to remove duplicated logics. (PR #142027)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/142027 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [NoSanitizeList][NFI] Add containsPrefix to remove duplicated logics. (PR #142027)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/142027 >From b4871ccd92c7006fa771d61dfbadeaeeaa2c170d Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Thu, 29 May 2025 19:59:38 + Subject: [PATCH] format. Created using spr 1.3.6 --- clang/include/clang/Basic/NoSanitizeList.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Basic/NoSanitizeList.h b/clang/include/clang/Basic/NoSanitizeList.h index 4a546351bb66d..266dfc0d217cb 100644 --- a/clang/include/clang/Basic/NoSanitizeList.h +++ b/clang/include/clang/Basic/NoSanitizeList.h @@ -29,8 +29,9 @@ class SanitizerSpecialCaseList; class NoSanitizeList { std::unique_ptr SSCL; SourceManager &SM; - bool containsPrefix(SanitizerMask Mask,StringRef Prefix, StringRef Name, + bool containsPrefix(SanitizerMask Mask, StringRef Prefix, StringRef Name, StringRef Category = StringRef()) const; + public: NoSanitizeList(const std::vector &NoSanitizeListPaths, SourceManager &SM); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [NoSanitizeList][NFI] Add containsPrefix to remove duplicated logics. (PR #142027)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/142027 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [NoSanitizeList][NFI] Add containsPrefix to remove duplicated logics. (PR #142027)
https://github.com/qinkunbao converted_to_draft https://github.com/llvm/llvm-project/pull/142027 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [UBSan][Ignorelist] Expanding =sanitize to global. (PR #142456)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/142456 >From c0d1cb94966a24e12525bb5c1d863e43cd13e3c2 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Mon, 2 Jun 2025 19:10:16 + Subject: [PATCH] Change the test. Created using spr 1.3.6 --- ...relist.test => asan-global-ignorelist.test} | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) rename clang/test/CodeGen/{ubsan-global-ignorelist.test => asan-global-ignorelist.test} (60%) diff --git a/clang/test/CodeGen/ubsan-global-ignorelist.test b/clang/test/CodeGen/asan-global-ignorelist.test similarity index 60% rename from clang/test/CodeGen/ubsan-global-ignorelist.test rename to clang/test/CodeGen/asan-global-ignorelist.test index 8d7812217f331..3ec2847a8a4e9 100644 --- a/clang/test/CodeGen/ubsan-global-ignorelist.test +++ b/clang/test/CodeGen/asan-global-ignorelist.test @@ -1,11 +1,11 @@ // RUN: rm -rf %t // RUN: split-file %s %t -// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE -// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-0.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE -// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-1.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE -// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-2.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE -// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-3.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=address %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=address -fsanitize-ignorelist=%t/order-0.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=address -fsanitize-ignorelist=%t/order-1.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=address -fsanitize-ignorelist=%t/order-2.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=address -fsanitize-ignorelist=%t/order-3.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE // The same type can appear multiple times within an ignorelist. Any ``=sanitize`` type // entries enable sanitizer instrumentation, even if it was ignored by entries before. @@ -13,18 +13,22 @@ // precedence. //--- order-0.ignorelist +[address] global:global_array //--- order-1.ignorelist +[address] global:global_array global:global_array=sanitize //--- order-2.ignorelist +[address] global:* global:global_array=sanitize global:global_array //--- order-3.ignorelist +[address] global:* global:global_array=sanitize global:global* @@ -34,6 +38,6 @@ global:*array=sanitize unsigned global_array[100] = {-1}; // CHECK-LABEL: define dso_local i32 @test -// IGNORE-NOT: call void @__ubsan_handle_out_of_bounds -// SANITIZE: call void @__ubsan_handle_out_of_bounds +// IGNORE-NOT: call void @__asan_report_load4 +// SANITIZE: call void @__asan_report_load4 int test(int i) { return global_array[i]; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [UBSan][Ignorelist] Expanding =sanitize to global. (PR #142456)
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/142456 >From c0d1cb94966a24e12525bb5c1d863e43cd13e3c2 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Mon, 2 Jun 2025 19:10:16 + Subject: [PATCH 1/2] Change the test. Created using spr 1.3.6 --- ...relist.test => asan-global-ignorelist.test} | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) rename clang/test/CodeGen/{ubsan-global-ignorelist.test => asan-global-ignorelist.test} (60%) diff --git a/clang/test/CodeGen/ubsan-global-ignorelist.test b/clang/test/CodeGen/asan-global-ignorelist.test similarity index 60% rename from clang/test/CodeGen/ubsan-global-ignorelist.test rename to clang/test/CodeGen/asan-global-ignorelist.test index 8d7812217f331..3ec2847a8a4e9 100644 --- a/clang/test/CodeGen/ubsan-global-ignorelist.test +++ b/clang/test/CodeGen/asan-global-ignorelist.test @@ -1,11 +1,11 @@ // RUN: rm -rf %t // RUN: split-file %s %t -// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE -// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-0.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE -// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-1.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE -// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-2.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE -// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-3.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=address %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=address -fsanitize-ignorelist=%t/order-0.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=address -fsanitize-ignorelist=%t/order-1.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=address -fsanitize-ignorelist=%t/order-2.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=address -fsanitize-ignorelist=%t/order-3.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE // The same type can appear multiple times within an ignorelist. Any ``=sanitize`` type // entries enable sanitizer instrumentation, even if it was ignored by entries before. @@ -13,18 +13,22 @@ // precedence. //--- order-0.ignorelist +[address] global:global_array //--- order-1.ignorelist +[address] global:global_array global:global_array=sanitize //--- order-2.ignorelist +[address] global:* global:global_array=sanitize global:global_array //--- order-3.ignorelist +[address] global:* global:global_array=sanitize global:global* @@ -34,6 +38,6 @@ global:*array=sanitize unsigned global_array[100] = {-1}; // CHECK-LABEL: define dso_local i32 @test -// IGNORE-NOT: call void @__ubsan_handle_out_of_bounds -// SANITIZE: call void @__ubsan_handle_out_of_bounds +// IGNORE-NOT: call void @__asan_report_load4 +// SANITIZE: call void @__asan_report_load4 int test(int i) { return global_array[i]; } >From 0ae18c201b4a78aef9ed3df0528026bf7e6f2a67 Mon Sep 17 00:00:00 2001 From: Qinkun Bao Date: Mon, 2 Jun 2025 19:45:30 + Subject: [PATCH 2/2] Add implementation Created using spr 1.3.6 --- clang/lib/Basic/NoSanitizeList.cpp| 2 +- .../test/CodeGen/asan-global-ignorelist.test | 22 +++ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/clang/lib/Basic/NoSanitizeList.cpp b/clang/lib/Basic/NoSanitizeList.cpp index ba36f78175422..24d2276f50ddf 100644 --- a/clang/lib/Basic/NoSanitizeList.cpp +++ b/clang/lib/Basic/NoSanitizeList.cpp @@ -44,7 +44,7 @@ bool NoSanitizeList::containsPrefix(SanitizerMask Mask, StringRef Prefix, bool NoSanitizeList::containsGlobal(SanitizerMask Mask, StringRef GlobalName, StringRef Category) const { - return SSCL->inSection(Mask, "global", GlobalName, Category); + return containsPrefix(Mask, "global", GlobalName, Category); } bool NoSanitizeList::containsType(SanitizerMask Mask, StringRef MangledTypeName, diff --git a/clang/test/CodeGen/asan-global-ignorelist.test b/clang/test/CodeGen/asan-global-ignorelist.test index 3ec2847a8a4e9..2bb37c100c067 100644 --- a/clang/test/CodeGen/asan-global-ignorelist.test +++ b/clang/test/CodeGen/asan-global-ignorelist.test @@ -1
[llvm-branch-commits] [clang] [Sanitizer][Ignorelist] Expanding =sanitize to global. (PR #142456)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/142456 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [UBSan][Ignorelist] Expanding =sanitize to global. (PR #142456)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/142456 See https://github.com/llvm/llvm-project/issues/139128 If multiple entries match the source, than the latest entry takes the precedence.` ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Sanitizer][Ignorelist] Expanding =sanitize to mainfile. (PR #142472)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/142472 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Sanitizer][Ignorelist] Expanding =sanitize to global. (PR #142472)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/142472 See https://github.com/llvm/llvm-project/issues/139128 If multiple entries match the source, than the latest entry takes the precedence. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Sanitizer][Doc][NFI] Update the doc for prefix:*=sanitize (PR #142701)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/142701 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Sanitizer][Doc][NFC] Update the doc for prefix:*=sanitize (PR #142701)
https://github.com/qinkunbao closed https://github.com/llvm/llvm-project/pull/142701 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Sanitizer][Doc][NFC] Update the doc for prefix:*=sanitize (PR #142701)
qinkunbao wrote: Close this PR because of https://github.com/llvm/llvm-project/pull/142659 https://github.com/llvm/llvm-project/pull/142701 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Sanitizer][Doc][NFC] Update the doc for prefix:*=sanitize (PR #142701)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/142701 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] Implement src:*=sanitize for UBSan. (PR #140489)
https://github.com/qinkunbao edited https://github.com/llvm/llvm-project/pull/140489 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [UBSan][Ignorelist] Expanding =sanitize to global. (PR #142077)
https://github.com/qinkunbao closed https://github.com/llvm/llvm-project/pull/142077 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [UBSan][Ignorelist] Expanding =sanitize to global. (PR #142077)
https://github.com/qinkunbao created https://github.com/llvm/llvm-project/pull/142077 See https://github.com/llvm/llvm-project/issues/139128 If multiple entries match the source, than the latest entry takes the precedence.` ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits