Skip to content

Commit a438555

Browse files
[TableGen] Use StringRef::take_while (NFC) (#139461)
1 parent 6c31984 commit a438555

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

clang/utils/TableGen/ClangOptionDocEmitter.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,7 @@ std::string escapeRST(StringRef Str) {
205205
}
206206

207207
StringRef getSphinxOptionID(StringRef OptionName) {
208-
for (auto I = OptionName.begin(), E = OptionName.end(); I != E; ++I)
209-
if (!isalnum(*I) && *I != '-')
210-
return OptionName.substr(0, I - OptionName.begin());
211-
return OptionName;
208+
return OptionName.take_while([](char C) { return isalnum(C) || C == '-'; });
212209
}
213210

214211
bool canSphinxCopeWithOption(const Record *Option) {

0 commit comments

Comments
 (0)