diff options
author | Kazu Hirata <kazu@google.com> | 2025-03-26 07:46:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-26 07:46:24 -0700 |
commit | 40d251db4a58df37e356a10d94db2263c5f60d4b (patch) | |
tree | c4431ee766a0876b780559691cd21e9b1d8f493c /llvm/lib/FileCheck/FileCheck.cpp | |
parent | e78eef2b6bd8932215bc47ca7a6561dea19a33f0 (diff) | |
download | llvm-40d251db4a58df37e356a10d94db2263c5f60d4b.zip llvm-40d251db4a58df37e356a10d94db2263c5f60d4b.tar.gz llvm-40d251db4a58df37e356a10d94db2263c5f60d4b.tar.bz2 |
[llvm] Use *Set::insert_range (NFC) (#133041)
We can use *Set::insert_range to collapse:
for (auto Elem : Range)
Set.insert(E);
down to:
Set.insert_range(Range);
In some cases, we can further fold that into the set declaration.
Diffstat (limited to 'llvm/lib/FileCheck/FileCheck.cpp')
-rw-r--r-- | llvm/lib/FileCheck/FileCheck.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp index 072dbef..10ca5f4 100644 --- a/llvm/lib/FileCheck/FileCheck.cpp +++ b/llvm/lib/FileCheck/FileCheck.cpp @@ -2491,14 +2491,10 @@ static bool ValidatePrefixes(StringRef Kind, StringSet<> &UniquePrefixes, bool FileCheck::ValidateCheckPrefixes() { StringSet<> UniquePrefixes; // Add default prefixes to catch user-supplied duplicates of them below. - if (Req.CheckPrefixes.empty()) { - for (const char *Prefix : DefaultCheckPrefixes) - UniquePrefixes.insert(Prefix); - } - if (Req.CommentPrefixes.empty()) { - for (const char *Prefix : DefaultCommentPrefixes) - UniquePrefixes.insert(Prefix); - } + if (Req.CheckPrefixes.empty()) + UniquePrefixes.insert_range(DefaultCheckPrefixes); + if (Req.CommentPrefixes.empty()) + UniquePrefixes.insert_range(DefaultCommentPrefixes); // Do not validate the default prefixes, or diagnostics about duplicates might // incorrectly indicate that they were supplied by the user. if (!ValidatePrefixes("check", UniquePrefixes, Req.CheckPrefixes)) |