[libcxx-commits] [PATCH] D64515: [libcxx] fix cxx-benchmarks target compilation

Afanasyev Ivan via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 10 10:23:55 PDT 2019


ivafanas created this revision.
ivafanas added reviewers: EricWF, sbenza, sebpop.
Herald added subscribers: libcxx-commits, ldionne, christof.

Proposal to fix command

  make cxx-benchmarks

Now it produces the following error:

  /home/ivafanas/Documents/clang/cl/llvm-project/libcxx/benchmarks/string.bench.cpp:78:32: error: inlining failed in call to always_inline ‘const char* getSmallString(DiffType)’: function body can be overwritten at link time
   TEST_ALWAYS_INLINE const char* getSmallString(DiffType D) {


Repository:
  rCXX libc++

https://reviews.llvm.org/D64515

Files:
  libcxx/benchmarks/string.bench.cpp


Index: libcxx/benchmarks/string.bench.cpp
===================================================================
--- libcxx/benchmarks/string.bench.cpp
+++ libcxx/benchmarks/string.bench.cpp
@@ -75,7 +75,7 @@
 
 static constexpr char SmallStringLiteral[] = "012345678";
 
-TEST_ALWAYS_INLINE const char* getSmallString(DiffType D) {
+inline TEST_ALWAYS_INLINE const char* getSmallString(DiffType D) {
   switch (D) {
     case DiffType::Control:
       return SmallStringLiteral;
@@ -91,7 +91,7 @@
 static constexpr char LargeStringLiteral[] =
     "012345678901234567890123456789012345678901234567890123456789012";
 
-TEST_ALWAYS_INLINE const char* getLargeString(DiffType D) {
+inline TEST_ALWAYS_INLINE const char* getLargeString(DiffType D) {
 #define LARGE_STRING_FIRST "123456789012345678901234567890"
 #define LARGE_STRING_SECOND "234567890123456789012345678901"
   switch (D) {
@@ -106,7 +106,7 @@
   }
 }
 
-TEST_ALWAYS_INLINE const char* getHugeString(DiffType D) {
+inline TEST_ALWAYS_INLINE const char* getHugeString(DiffType D) {
 #define HUGE_STRING0 "0123456789"
 #define HUGE_STRING1 HUGE_STRING0 HUGE_STRING0 HUGE_STRING0 HUGE_STRING0
 #define HUGE_STRING2 HUGE_STRING1 HUGE_STRING1 HUGE_STRING1 HUGE_STRING1
@@ -124,6 +124,7 @@
   }
 }
 
+inline
 TEST_ALWAYS_INLINE std::string makeString(Length L,
                                           DiffType D = DiffType::Control,
                                           Opacity O = Opacity::Transparent) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64515.209004.patch
Type: text/x-patch
Size: 1468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190710/5203a1c4/attachment-0001.bin>


More information about the libcxx-commits mailing list