Skip to content

[TargetParser] Use StringRef::consume_front (NFC) #147202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions llvm/lib/TargetParser/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ StringRef sys::detail::getHostCPUNameForARM(StringRef ProcCpuinfoContent) {
StringRef Implementer;
StringRef Hardware;
StringRef Part;
for (unsigned I = 0, E = Lines.size(); I != E; ++I) {
if (Lines[I].starts_with("CPU implementer"))
Implementer = Lines[I].substr(15).ltrim("\t :");
if (Lines[I].starts_with("Hardware"))
Hardware = Lines[I].substr(8).ltrim("\t :");
if (Lines[I].starts_with("CPU part"))
Part = Lines[I].substr(8).ltrim("\t :");
for (StringRef Line : Lines) {
if (Line.consume_front("CPU implementer"))
Implementer = Line.ltrim("\t :");
else if (Line.consume_front("Hardware"))
Hardware = Line.ltrim("\t :");
else if (Line.consume_front("CPU part"))
Part = Line.ltrim("\t :");
}

if (Implementer == "0x41") { // ARM Ltd.
Expand Down
Loading