[llvm] r277893 - Fix a -Wunused-const-variable due to a bug in clang.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 17:13:32 PDT 2016


Author: zturner
Date: Fri Aug  5 19:13:32 2016
New Revision: 277893

URL: http://llvm.org/viewvc/llvm-project?rev=277893&view=rev
Log:
Fix a -Wunused-const-variable due to a bug in clang.

Modified:
    llvm/trunk/include/llvm/Support/YAMLTraits.h

Modified: llvm/trunk/include/llvm/Support/YAMLTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/YAMLTraits.h?rev=277893&r1=277892&r2=277893&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/YAMLTraits.h (original)
+++ llvm/trunk/include/llvm/Support/YAMLTraits.h Fri Aug  5 19:13:32 2016
@@ -1388,6 +1388,11 @@ template <typename T> struct SequenceTra
 
 /// Utility for declaring that a std::vector of a particular type
 /// should be considered a YAML flow sequence.
+/// We need to do a partial specialization on the vector version, not a full.
+/// If this is a full specialization, the compiler is a bit too "smart" and
+/// decides to warn on -Wunused-const-variable.  This workaround can be
+/// removed and we can do a full specialization on std::vector<T> once
+/// PR28878 is fixed.
 #define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(_type)                               \
   namespace llvm {                                                             \
   namespace yaml {                                                             \
@@ -1396,9 +1401,9 @@ template <typename T> struct SequenceTra
       : public SequenceTraitsImpl<SmallVector<_type, N>> {                     \
     static const bool flow = true;                                             \
   };                                                                           \
-  template <>                                                                  \
-  struct SequenceTraits<std::vector<_type>>                                    \
-      : public SequenceTraitsImpl<std::vector<_type>> {                        \
+  template <typename Allocator>                                                \
+  struct SequenceTraits<std::vector<_type, Allocator>>                         \
+      : public SequenceTraitsImpl<std::vector<_type, Allocator>> {             \
     static const bool flow = true;                                             \
   };                                                                           \
   }                                                                            \




More information about the llvm-commits mailing list