[llvm-branch-commits] [llvm] 09b3f3f - [benchmark] Fixed a build error when using CMake 3.15.1 + NDK-R20

Roman Lebedev via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jan 4 00:06:08 PST 2021


Author: AnZhong Huang
Date: 2021-01-04T11:00:57+03:00
New Revision: 09b3f3f22cbe159a737c44b2e78de08bbbfa5be3

URL: https://github.com/llvm/llvm-project/commit/09b3f3f22cbe159a737c44b2e78de08bbbfa5be3
DIFF: https://github.com/llvm/llvm-project/commit/09b3f3f22cbe159a737c44b2e78de08bbbfa5be3.diff

LOG: [benchmark] Fixed a build error when using CMake 3.15.1 + NDK-R20

std::decay_t used by llvm/utils/benchmark/include/benchmark/benchmark.h is a c++14 feature, but the CMakelist uses c++11, it's the root-cause of build error.

    There are two options to fix the error.
    1) change the CMakelist to support c++14.
    2) change std::decay_t to std::decay, it's what the patch done.

    This bug can only be reproduced by CMake 3.15, we didn't observer the bug with CMake 3.16. But based on the code's logic, it's an obvious bug of LLVM.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D93794

Added: 
    

Modified: 
    llvm/utils/benchmark/include/benchmark/benchmark.h

Removed: 
    


################################################################################
diff  --git a/llvm/utils/benchmark/include/benchmark/benchmark.h b/llvm/utils/benchmark/include/benchmark/benchmark.h
index ab61c46e9386..3b535f1b7d52 100644
--- a/llvm/utils/benchmark/include/benchmark/benchmark.h
+++ b/llvm/utils/benchmark/include/benchmark/benchmark.h
@@ -990,7 +990,7 @@ inline internal::Benchmark* RegisterBenchmark(const char* name,
 #ifdef BENCHMARK_HAS_CXX11
 template <class Lambda>
 internal::Benchmark* RegisterBenchmark(const char* name, Lambda&& fn) {
-  using BenchType = internal::LambdaBenchmark<std::decay_t<Lambda>>;
+  using BenchType = internal::LambdaBenchmark<typename std::decay<Lambda>::type>;
   return internal::RegisterBenchmarkInternal(
       ::new BenchType(name, std::forward<Lambda>(fn)));
 }


        


More information about the llvm-branch-commits mailing list