v.g.vassilev created this revision.
v.g.vassilev added a reviewer: rsmith.
v.g.vassilev added a subscriber: cfe-commits.

I am not sure if we should #include <atomic> but the instantiation of 
`operator*` of `ManagedStatic` needs `std::memory_order_aquire`. Modules builds 
error out with:

`In module 'LLVM_Utils' imported from 
/home/vvassilev/workspace/llvm-git/src/lib/Support/CommandLine.cpp:19:
/home/vvassilev/workspace/llvm-git/src/include/llvm/Support/ManagedStatic.h:66:26:
 error: 
      definition of 'memory_order' must be imported from module
      'LLVM_Utils.ADT.IntrusiveRefCntPtr' before it is required
    void *Tmp = Ptr.load(std::memory_order_acquire);
                         ^
/home/vvassilev/workspace/llvm-git/src/include/llvm/Support/ManagedStatic.h:73:29:
 note: 
      in instantiation of member function 'llvm::ManagedStatic<(anonymous
      namespace)::CommandLineParser>::operator*' requested here
  C *operator->() { return &**this; }
                            ^
/home/vvassilev/workspace/llvm-git/src/lib/Support/CommandLine.cpp:339:15: 
note: 
      in instantiation of member function 'llvm::ManagedStatic<(anonymous
      namespace)::CommandLineParser>::operator->' requested here
  GlobalParser->addLiteralOption(O, Name);
              ^
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/atomic_base.h:56:16:
 note: 
      previous definition is here
  typedef enum memory_order
               ^
1 error generated.
`

https://reviews.llvm.org/D22439

Files:
  lib/Support/APInt.cpp
  lib/Support/CachePruning.cpp
  lib/Support/CommandLine.cpp
  lib/Support/CrashRecoveryContext.cpp
  lib/Support/Debug.cpp
  lib/Support/DeltaAlgorithm.cpp
  lib/Support/Error.cpp
  lib/Support/ErrorHandling.cpp
  lib/Support/LockFileManager.cpp
  lib/Support/ManagedStatic.cpp

Index: lib/Support/ManagedStatic.cpp
===================================================================
--- lib/Support/ManagedStatic.cpp
+++ lib/Support/ManagedStatic.cpp
@@ -16,6 +16,7 @@
 #include "llvm/Support/Mutex.h"
 #include "llvm/Support/MutexGuard.h"
 #include "llvm/Support/Threading.h"
+#include <atomic>
 #include <cassert>
 using namespace llvm;
 
Index: lib/Support/LockFileManager.cpp
===================================================================
--- lib/Support/LockFileManager.cpp
+++ lib/Support/LockFileManager.cpp
@@ -13,6 +13,8 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/Signals.h"
+#include <atomic>
+#include <system_error>
 #include <sys/stat.h>
 #include <sys/types.h>
 #if LLVM_ON_WIN32
Index: lib/Support/ErrorHandling.cpp
===================================================================
--- lib/Support/ErrorHandling.cpp
+++ lib/Support/ErrorHandling.cpp
@@ -27,6 +27,7 @@
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/WindowsError.h"
 #include "llvm/Support/raw_ostream.h"
+#include <atomic>
 #include <cassert>
 #include <cstdlib>
 
Index: lib/Support/Error.cpp
===================================================================
--- lib/Support/Error.cpp
+++ lib/Support/Error.cpp
@@ -11,7 +11,8 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ManagedStatic.h"
-
+#include <atomic>
+#include <system_error>
 
 using namespace llvm;
 
Index: lib/Support/DeltaAlgorithm.cpp
===================================================================
--- lib/Support/DeltaAlgorithm.cpp
+++ lib/Support/DeltaAlgorithm.cpp
@@ -9,6 +9,7 @@
 #include "llvm/ADT/DeltaAlgorithm.h"
 #include <algorithm>
 #include <iterator>
+#include <set>
 using namespace llvm;
 
 DeltaAlgorithm::~DeltaAlgorithm() {
Index: lib/Support/Debug.cpp
===================================================================
--- lib/Support/Debug.cpp
+++ lib/Support/Debug.cpp
@@ -29,6 +29,7 @@
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/circular_raw_ostream.h"
 #include "llvm/Support/raw_ostream.h"
+#include <atomic>
 
 #undef isCurrentDebugType
 #undef setCurrentDebugType
Index: lib/Support/CrashRecoveryContext.cpp
===================================================================
--- lib/Support/CrashRecoveryContext.cpp
+++ lib/Support/CrashRecoveryContext.cpp
@@ -13,6 +13,7 @@
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Mutex.h"
 #include "llvm/Support/ThreadLocal.h"
+#include <atomic>
 #include <setjmp.h>
 using namespace llvm;
 
Index: lib/Support/CommandLine.cpp
===================================================================
--- lib/Support/CommandLine.cpp
+++ lib/Support/CommandLine.cpp
@@ -35,6 +35,7 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/StringSaver.h"
 #include "llvm/Support/raw_ostream.h"
+#include <atomic>
 #include <cstdlib>
 #include <map>
 using namespace llvm;
Index: lib/Support/CachePruning.cpp
===================================================================
--- lib/Support/CachePruning.cpp
+++ lib/Support/CachePruning.cpp
@@ -22,6 +22,7 @@
 #define DEBUG_TYPE "cache-pruning"
 
 #include <set>
+#include <system_error>
 
 using namespace llvm;
 
Index: lib/Support/APInt.cpp
===================================================================
--- lib/Support/APInt.cpp
+++ lib/Support/APInt.cpp
@@ -22,10 +22,10 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
+#include <climits>
 #include <cmath>
 #include <cstdlib>
 #include <cstring>
-#include <limits>
 using namespace llvm;
 
 #define DEBUG_TYPE "apint"
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to