]> granicus.if.org Git - llvm/commitdiff
Attempt to define friend function more portably.
authorSean Silva <chisophugis@gmail.com>
Thu, 16 Jun 2016 07:00:19 +0000 (07:00 +0000)
committerSean Silva <chisophugis@gmail.com>
Thu, 16 Jun 2016 07:00:19 +0000 (07:00 +0000)
Patch written by Reid. I verified it locally with clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272875 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/SLPVectorizer.cpp

index ca40bff4f97a24b78d744940c01b866645fb51c2..774650b0c5530e483da0dc2749b962250c42584d 100644 (file)
@@ -601,7 +601,6 @@ private:
   /// A list of blocks that we are going to CSE.
   SetVector<BasicBlock *> CSEBlocks;
 
-public: // Workaround for MSVC friend semantics.
   /// Contains all scheduling relevant data for an instruction.
   /// A ScheduleData either represents a single instruction or a member of an
   /// instruction bundle (= a group of instructions which is combined into a
@@ -731,11 +730,13 @@ public: // Workaround for MSVC friend semantics.
     /// dry-run).
     bool IsScheduled;
   };
-private:
 
 #ifndef NDEBUG
-  friend raw_ostream &operator<<(raw_ostream &os,
-                                 const BoUpSLP::ScheduleData &SD);
+  friend inline raw_ostream &operator<<(raw_ostream &os,
+                                        const BoUpSLP::ScheduleData &SD) {
+    SD.dump(os);
+    return os;
+  }
 #endif
 
   /// Contains all scheduling data for a basic block.
@@ -945,21 +946,9 @@ private:
   MapVector<Value *, uint64_t> MinBWs;
 };
 
-#ifndef NDEBUG
-raw_ostream &operator<<(raw_ostream &os, const BoUpSLP::ScheduleData &SD);
-#endif
-
 } // end namespace llvm
 } // end namespace slpvectorizer
 
-#ifndef NDEBUG
-raw_ostream &llvm::slpvectorizer::operator<<(raw_ostream &os,
-                                             const BoUpSLP::ScheduleData &SD) {
-  SD.dump(os);
-  return os;
-}
-#endif
-
 void BoUpSLP::buildTree(ArrayRef<Value *> Roots,
                         ArrayRef<Value *> UserIgnoreLst) {
   deleteTree();