[PATCH] D31236: Refactor getHostCPUName to allow testing on non-native hardware.

Renato Golin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 03:27:46 PDT 2017

rengolin added inline comments.

Comment at: include/llvm/Support/Host.h:83
+    virtual ssize_t readCpuInfo(void *Buf, size_t Size) const;
+    virtual StringRef getHostCPUName_powerpc() const;
+    virtual StringRef getHostCPUName_arm() const;
These don't need to be virtual, do they? They could even be static.

Comment at: unittests/Support/Host.cpp:53
+TEST(getLinuxHostCPUName, ARM) {
+  const char *CortexA9ProcCpuinfo = R"(
Do we have tests for the other platforms?

Comment at: unittests/Support/Host.cpp:90
+  EXPECT_THAT(m.getHostCPUName_arm(), Eq("cortex-a9"));
There are a number of different ways to find cpu names on ARM cpuinfo, and it would be good to know that they're all working. Maybe having a few different small snippets, instead of one large and redundant one?


More information about the llvm-commits mailing list