Skip to content

Commit c10e826

Browse files
authored
[FileCheck] Remove unneeded unique_ptr. NFC. (#123216)
1 parent ebc7efb commit c10e826

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

llvm/include/llvm/FileCheck/FileCheck.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ struct FileCheckString;
180180
class FileCheck {
181181
FileCheckRequest Req;
182182
std::unique_ptr<FileCheckPatternContext> PatternContext;
183-
// C++17 TODO: make this a plain std::vector.
184-
std::unique_ptr<std::vector<FileCheckString>> CheckStrings;
183+
std::vector<FileCheckString> CheckStrings;
185184

186185
public:
187186
explicit FileCheck(FileCheckRequest Req);

llvm/lib/FileCheck/FileCheck.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,8 +1766,7 @@ void FileCheckPatternContext::createLineVariable() {
17661766
}
17671767

17681768
FileCheck::FileCheck(FileCheckRequest Req)
1769-
: Req(Req), PatternContext(std::make_unique<FileCheckPatternContext>()),
1770-
CheckStrings(std::make_unique<std::vector<FileCheckString>>()) {}
1769+
: Req(Req), PatternContext(std::make_unique<FileCheckPatternContext>()) {}
17711770

17721771
FileCheck::~FileCheck() = default;
17731772

@@ -1916,7 +1915,7 @@ bool FileCheck::readCheckFile(
19161915
// Verify that CHECK-NEXT/SAME/EMPTY lines have at least one CHECK line before them.
19171916
if ((CheckTy == Check::CheckNext || CheckTy == Check::CheckSame ||
19181917
CheckTy == Check::CheckEmpty) &&
1919-
CheckStrings->empty()) {
1918+
CheckStrings.empty()) {
19201919
StringRef Type = CheckTy == Check::CheckNext
19211920
? "NEXT"
19221921
: CheckTy == Check::CheckEmpty ? "EMPTY" : "SAME";
@@ -1934,8 +1933,8 @@ bool FileCheck::readCheckFile(
19341933
}
19351934

19361935
// Okay, add the string we captured to the output vector and move on.
1937-
CheckStrings->emplace_back(P, UsedPrefix, PatternLoc);
1938-
std::swap(DagNotMatches, CheckStrings->back().DagNotStrings);
1936+
CheckStrings.emplace_back(P, UsedPrefix, PatternLoc);
1937+
std::swap(DagNotMatches, CheckStrings.back().DagNotStrings);
19391938
DagNotMatches = ImplicitNegativeChecks;
19401939
}
19411940

@@ -1962,10 +1961,10 @@ bool FileCheck::readCheckFile(
19621961
// Add an EOF pattern for any trailing --implicit-check-not/CHECK-DAG/-NOTs,
19631962
// and use the first prefix as a filler for the error message.
19641963
if (!DagNotMatches.empty()) {
1965-
CheckStrings->emplace_back(
1964+
CheckStrings.emplace_back(
19661965
Pattern(Check::CheckEOF, PatternContext.get(), LineNumber + 1),
19671966
*Req.CheckPrefixes.begin(), SMLoc::getFromPointer(Buffer.data()));
1968-
std::swap(DagNotMatches, CheckStrings->back().DagNotStrings);
1967+
std::swap(DagNotMatches, CheckStrings.back().DagNotStrings);
19691968
}
19701969

19711970
return false;
@@ -2676,13 +2675,13 @@ bool FileCheck::checkInput(SourceMgr &SM, StringRef Buffer,
26762675
std::vector<FileCheckDiag> *Diags) {
26772676
bool ChecksFailed = false;
26782677

2679-
unsigned i = 0, j = 0, e = CheckStrings->size();
2678+
unsigned i = 0, j = 0, e = CheckStrings.size();
26802679
while (true) {
26812680
StringRef CheckRegion;
26822681
if (j == e) {
26832682
CheckRegion = Buffer;
26842683
} else {
2685-
const FileCheckString &CheckLabelStr = (*CheckStrings)[j];
2684+
const FileCheckString &CheckLabelStr = CheckStrings[j];
26862685
if (CheckLabelStr.Pat.getCheckTy() != Check::CheckLabel) {
26872686
++j;
26882687
continue;
@@ -2708,7 +2707,7 @@ bool FileCheck::checkInput(SourceMgr &SM, StringRef Buffer,
27082707
PatternContext->clearLocalVars();
27092708

27102709
for (; i != j; ++i) {
2711-
const FileCheckString &CheckStr = (*CheckStrings)[i];
2710+
const FileCheckString &CheckStr = CheckStrings[i];
27122711

27132712
// Check each string within the scanned region, including a second check
27142713
// of any final CHECK-LABEL (to verify CHECK-NOT and CHECK-DAG)

0 commit comments

Comments
 (0)