]> granicus.if.org Git - clang/commit
[MS Compat] Allow _Atomic(Type) and 'struct _Atomic' to coexist
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 22 Jul 2015 23:46:18 +0000 (23:46 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 22 Jul 2015 23:46:18 +0000 (23:46 +0000)
commit94f9f1202ca86d0a8cfedf8d68407c1769faa7c7
tree35f684a123323b4617363ea4311966b6622650e6
parent8f385fa0e26474569205e6fdef3fb7c4a0c955da
[MS Compat] Allow _Atomic(Type) and 'struct _Atomic' to coexist

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.

Differential Revision: http://reviews.llvm.org/D11233

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242970 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/IdentifierTable.h
include/clang/Basic/TokenKinds.def
lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp
test/SemaCXX/MicrosoftCompatibility.cpp