[Openmp-commits] [openmp] 68ff52f - [OpenMP] Fixed the link error that cannot find static data member

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 12 13:48:34 PST 2021


Author: Shilei Tian
Date: 2021-01-12T16:48:28-05:00
New Revision: 68ff52ffead2ba25cca442778ab19286000daad7

URL: https://github.com/llvm/llvm-project/commit/68ff52ffead2ba25cca442778ab19286000daad7
DIFF: https://github.com/llvm/llvm-project/commit/68ff52ffead2ba25cca442778ab19286000daad7.diff

LOG: [OpenMP] Fixed the link error that cannot find static data member

Constant static data member can be defined in the class without another
define after the class in C++17. Although it is C++17, Clang can still handle it
even w/o the flag for C++17. Unluckily, GCC cannot handle that.

Reviewed By: jhuber6

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

Added: 
    

Modified: 
    openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h b/openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h
index 1f9cbeb00394..6e00728a658f 100644
--- a/openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h
+++ b/openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h
@@ -338,4 +338,9 @@ class MemoryManagerTy {
   }
 };
 
+// GCC still cannot handle the static data member like Clang so we still need
+// this part.
+constexpr const size_t MemoryManagerTy::BucketSize[];
+constexpr const int MemoryManagerTy::NumBuckets;
+
 #endif // LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_MEMORYMANAGER_H


        


More information about the Openmp-commits mailing list