[llvm] r232457 - Fix ODR violations caused by putting anonymous namespaces in header files (and

Richard Smith richard-llvm at metafoo.co.uk
Mon Mar 16 19:36:52 PDT 2015


Author: rsmith
Date: Mon Mar 16 21:36:51 2015
New Revision: 232457

URL: http://llvm.org/viewvc/llvm-project?rev=232457&view=rev
Log:
Fix ODR violations caused by putting anonymous namespaces in header files (and
then using the symbols from those anonymous namespaces from outside the
anonymous namespace).

This was "detected" by causing the modules selfhost to fail in some cases.
The corresponding Clang bug was fixed in r232455.

Modified:
    llvm/trunk/include/llvm/Analysis/DominanceFrontierImpl.h
    llvm/trunk/include/llvm/Analysis/LoopInfoImpl.h

Modified: llvm/trunk/include/llvm/Analysis/DominanceFrontierImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominanceFrontierImpl.h?rev=232457&r1=232456&r2=232457&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominanceFrontierImpl.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominanceFrontierImpl.h Mon Mar 16 21:36:51 2015
@@ -23,7 +23,6 @@
 
 namespace llvm {
 
-namespace {
 template <class BlockT>
 class DFCalculateWorkObject {
 public:
@@ -37,7 +36,6 @@ public:
   const DomTreeNodeT *Node;
   const DomTreeNodeT *parentNode;
 };
-}
 
 template <class BlockT>
 void DominanceFrontierBase<BlockT>::removeBlock(BlockT *BB) {

Modified: llvm/trunk/include/llvm/Analysis/LoopInfoImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfoImpl.h?rev=232457&r1=232456&r2=232457&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfoImpl.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfoImpl.h Mon Mar 16 21:36:51 2015
@@ -402,7 +402,6 @@ static void discoverAndMapSubloop(LoopT
   L->reserveBlocks(NumBlocks);
 }
 
-namespace {
 /// Populate all loop data in a stable order during a single forward DFS.
 template<class BlockT, class LoopT>
 class PopulateLoopsDFS {
@@ -430,7 +429,6 @@ protected:
     DFSStack.push_back(std::make_pair(Block, BlockTraits::child_begin(Block)));
   }
 };
-} // anonymous
 
 /// Top-level driver for the forward DFS within the loop.
 template<class BlockT, class LoopT>





More information about the llvm-commits mailing list