[clang] [llvm] [clang][AArch64] Add getHostCPUFeatures to query for enabled features in cpu info (PR #97749)

David Green via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 12:54:50 PDT 2024


================
@@ -70,6 +70,10 @@ static std::unique_ptr<llvm::MemoryBuffer>
     LLVM_ATTRIBUTE_UNUSED getProcCpuinfoContent() {
   llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Text =
       llvm::MemoryBuffer::getFileAsStream("/proc/cpuinfo");
+  if (const char *cpuinfoIntercept = std::getenv("LLVM_CPUINFO")) {
----------------
davemgreen wrote:

cpuinfoIntercept -> CpuinfoIntercept

This might be a little better to only open a single file
```
const char *CPUInfoFile = "/proc/cpuinfo";
if (const char *CpuinfoIntercept = std::getenv("LLVM_CPUINFO"))
  CPUInfoFile = CpuinfoIntercept;
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Text =
      llvm::MemoryBuffer::getFileAsStream(CPUInfoFile);
```

https://github.com/llvm/llvm-project/pull/97749


More information about the cfe-commits mailing list