================
@@ -179,22 +179,39 @@ StringRef sys::detail::getHostCPUNameForARM(StringRef
ProcCpuinfoContent) {
// Look for the CPU implementer line.
StringRef Implementer;
StringRef Hardware;
- StringRef Part;
+ SmallVector<StringRef, 32> Parts;
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 :");
+ Parts.emplace_back(Lines[I].substr(8).ltrim("\t :"));
}
+ // Last `Part' seen, in case we don't analyse all `Parts' parsed.
+ StringRef Part = Parts.empty() ? StringRef() : Parts.back();
+
+ // Remove duplicate `Parts'.
----------------
rj-jesus wrote:
There will be multiple CPU part lines in `/proc/cpuinfo` based on the number of
cores of the system (not one line per _unique_ core type), so we need to filter
out duplicates.
https://github.com/llvm/llvm-project/pull/146515
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits