[llvm] 854e8f8 - Remove unnecessary/erroneous "static" from function templates in headers

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 10 16:23:46 PDT 2020


Author: David Blaikie
Date: 2020-07-10T16:23:33-07:00
New Revision: 854e8f88e96bd6a75844d2af061cacc61fb0defe

URL: https://github.com/llvm/llvm-project/commit/854e8f88e96bd6a75844d2af061cacc61fb0defe
DIFF: https://github.com/llvm/llvm-project/commit/854e8f88e96bd6a75844d2af061cacc61fb0defe.diff

LOG: Remove unnecessary/erroneous "static" from function templates in headers

This risks ODR violations in inline functions that call these functions
(if they remain static) & otherwise just causes some object size
increase, potentially, by these functions not being deduplicated by the
linker.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/STLExtras.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index b2e709f7272f..50b688b36648 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -745,14 +745,14 @@ detail::zippy<detail::zip_first, T, U, Args...> zip_first(T &&t, U &&u,
 
 namespace detail {
 template <typename Iter>
-static Iter next_or_end(const Iter &I, const Iter &End) {
+Iter next_or_end(const Iter &I, const Iter &End) {
   if (I == End)
     return End;
   return std::next(I);
 }
 
 template <typename Iter>
-static auto deref_or_none(const Iter &I, const Iter &End) -> llvm::Optional<
+auto deref_or_none(const Iter &I, const Iter &End) -> llvm::Optional<
     std::remove_const_t<std::remove_reference_t<decltype(*I)>>> {
   if (I == End)
     return None;


        


More information about the llvm-commits mailing list