[PATCH] D11233: [MS Compat] Allow _Atomic(Type) and 'struct _Atomic' to coexist

David Majnemer david.majnemer at gmail.com
Wed Jul 15 11:42:12 PDT 2015


majnemer created this revision.
majnemer added reviewers: rsmith, rnk.
majnemer added a subscriber: cfe-commits.

MSVC 2013 ships, as part of its STL implementation, a class named
'_Atomic'.  This is unfortunate because this keyword is in conflict with
the C11 keyword with the same name.  Our solution was to disable this
keyword when targeting MSVC 2013 and reenable it for 2015.

However, this makes it impossible for clang's headers to make use of
_Atomic.  This is problematic in the case of libc++ as it makes heavy
use of this keyword.

Let the keywordness of _Atomic float under certain circumstances:
the body of a class named _Atomic, or a class with a base specifier
named _Atomic, will not have the keyword variant of _Atomic for the
duration of the class body.  This is sufficient to allow us to correctly
handle _Atomic in the STL while permitting us to use _Atomic as a
keyword everywhere else.

http://reviews.llvm.org/D11233

Files:
  include/clang/Basic/IdentifierTable.h
  include/clang/Basic/TokenKinds.def
  include/clang/Parse/Parser.h
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/Parser.cpp
  test/SemaCXX/MicrosoftCompatibility.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11233.29807.patch
Type: text/x-patch
Size: 4403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150715/ab0665fa/attachment.bin>


More information about the cfe-commits mailing list