This is an archive of the discontinued LLVM Phabricator instance.

Add missing includes.
AbandonedPublic

Authored by v.g.vassilev on Jul 16 2016, 12:44 PM.

Details

Reviewers
rsmith
Summary

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.
`

Diff Detail

Event Timeline

v.g.vassilev retitled this revision from to Add missing includes..
v.g.vassilev updated this object.
v.g.vassilev added a reviewer: rsmith.
v.g.vassilev added a subscriber: cfe-commits.
rsmith edited edge metadata.Jul 20 2016, 1:19 PM

ManagedStatic.h already includes <atomic>, so the additional includes of <atomic> don't seem appropriate to me. Looks like this may have hit a bug in enum merging?

The 'atomic' bug was fixed I assume as part of https://llvm.org/bugs/show_bug.cgi?id=28794

Other includes landed in r281450.

v.g.vassilev abandoned this revision.Sep 14 2016, 2:09 AM