[libc-commits] [PATCH] D79040: [libc] Fix benchmarks build.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Apr 28 14:02:46 PDT 2020


sivachandra created this revision.
sivachandra added reviewers: gchatelet, echristo.
Herald added subscribers: libc-commits, tschuett, mgorny.
Herald added a project: libc-project.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79040

Files:
  libc/utils/benchmarks/CMakeLists.txt
  libc/utils/benchmarks/JSON.cpp
  libc/utils/benchmarks/LibcMemoryBenchmarkMain.cpp


Index: libc/utils/benchmarks/LibcMemoryBenchmarkMain.cpp
===================================================================
--- libc/utils/benchmarks/LibcMemoryBenchmarkMain.cpp
+++ libc/utils/benchmarks/LibcMemoryBenchmarkMain.cpp
@@ -17,6 +17,8 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/raw_ostream.h"
 
+#include <string>
+
 namespace llvm {
 namespace libc_benchmarks {
 
@@ -61,7 +63,7 @@
   size_t Steps = 0;
   for (auto FunctionName : Runner->getFunctionNames()) {
     FunctionMeasurements FM;
-    FM.Name = FunctionName;
+    FM.Name = std::string(FunctionName);
     for (size_t Run = 0; Run < Runs; ++Run) {
       for (uint32_t Size = SR.From; Size <= SR.To; Size += SR.Step) {
         const auto Result = Runner->benchmark(S.Options, FunctionName, Size);
Index: libc/utils/benchmarks/JSON.cpp
===================================================================
--- libc/utils/benchmarks/JSON.cpp
+++ libc/utils/benchmarks/JSON.cpp
@@ -17,9 +17,11 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/MathExtras.h"
+
 #include <chrono>
 #include <limits>
 #include <memory>
+#include <string>
 #include <vector>
 
 namespace llvm {
@@ -48,7 +50,7 @@
 
 static Error fromJson(const json::Value &V, std::string &Out) {
   if (auto S = V.getAsString()) {
-    Out = *S;
+    Out = std::string(*S);
     return Error::success();
   }
   return createStringError(errc::io_error, "Can't parse String");
Index: libc/utils/benchmarks/CMakeLists.txt
===================================================================
--- libc/utils/benchmarks/CMakeLists.txt
+++ libc/utils/benchmarks/CMakeLists.txt
@@ -24,6 +24,7 @@
         -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
         -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
         -DCMAKE_CXX_FLAGS:STRING=${GOOGLE_BENCHMARK_TARGET_FLAGS}
+        -DCMAKE_CXX_STANDARD:STRING=14
         -DCMAKE_BUILD_TYPE:STRING=RELEASE
         -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
         -DBENCHMARK_ENABLE_TESTING:BOOL=OFF)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79040.260760.patch
Type: text/x-patch
Size: 2058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200428/935f06cf/attachment.bin>


More information about the libc-commits mailing list