Skip to content

Commit 7c5ad22

Browse files
authored
[NFC][SpecialCaseList] Remove unnecessary indirection (#162211)
1 parent 5821446 commit 7c5ad22

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

clang/lib/Basic/SanitizerSpecialCaseList.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void SanitizerSpecialCaseList::createSanitizerSections() {
4242
SanitizerMask Mask;
4343

4444
#define SANITIZER(NAME, ID) \
45-
if (S.SectionMatcher->match(NAME)) \
45+
if (S.SectionMatcher.match(NAME)) \
4646
Mask |= SanitizerKind::ID;
4747
#define SANITIZER_GROUP(NAME, ID, ALIAS) SANITIZER(NAME, ID)
4848

llvm/include/llvm/Support/SpecialCaseList.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ class SpecialCaseList {
147147
Section(StringRef Str, unsigned FileIdx)
148148
: SectionStr(Str), FileIdx(FileIdx) {};
149149

150-
std::unique_ptr<Matcher> SectionMatcher = std::make_unique<Matcher>();
150+
Section(Section &&) = default;
151+
152+
Matcher SectionMatcher;
151153
SectionEntries Entries;
152154
std::string SectionStr;
153155
unsigned FileIdx;

llvm/lib/Support/SpecialCaseList.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ SpecialCaseList::addSection(StringRef SectionStr, unsigned FileNo,
135135
Sections.emplace_back(SectionStr, FileNo);
136136
auto &Section = Sections.back();
137137

138-
if (auto Err = Section.SectionMatcher->insert(SectionStr, LineNo, UseGlobs)) {
138+
if (auto Err = Section.SectionMatcher.insert(SectionStr, LineNo, UseGlobs)) {
139139
return createStringError(errc::invalid_argument,
140140
"malformed section at line " + Twine(LineNo) +
141141
": '" + SectionStr +
@@ -218,7 +218,7 @@ std::pair<unsigned, unsigned>
218218
SpecialCaseList::inSectionBlame(StringRef Section, StringRef Prefix,
219219
StringRef Query, StringRef Category) const {
220220
for (const auto &S : reverse(Sections)) {
221-
if (S.SectionMatcher->match(Section)) {
221+
if (S.SectionMatcher.match(Section)) {
222222
unsigned Blame = inSectionBlame(S.Entries, Prefix, Query, Category);
223223
if (Blame)
224224
return {S.FileIdx, Blame};

0 commit comments

Comments
 (0)