]> granicus.if.org Git - clang/commit
Implement C++11 [expr.prim.general]p3, which permits the use of 'this'
authorDouglas Gregor <dgregor@apple.com>
Mon, 16 Apr 2012 07:05:22 +0000 (07:05 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 16 Apr 2012 07:05:22 +0000 (07:05 +0000)
commitcefc3afac14d29de5aba7810cc8fe6c858949e9d
tree1ebfb2a0c67f5e253edc1a2900cdda348163f4f5
parent275a8505420733a9e4c662289f36522a1dabaa51
Implement C++11 [expr.prim.general]p3, which permits the use of 'this'
in the declaration of a non-static member function after the
(optional) cv-qualifier-seq, which in practice means in the exception
specification and late-specified return type.

The new scheme here used to manage 'this' outside of a member function
scope is more general than the Scope-based mechanism previously used
for non-static data member initializers and late-parsesd attributes,
because it can also handle the cv-qualifiers on the member
function. Note, however, that a separate pass is required for static
member functions to determine whether 'this' was used, because we
might not know that we have a static function until after declaration
matching.

Finally, this introduces name mangling for 'this' and for the implicit
'this', which is intended to match GCC's mangling. Independent
verification for the new mangling test case would be appreciated.

Fixes PR10036 and PR12450.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154799 91177308-0d34-0410-b5e6-96231b3b80d8
20 files changed:
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Scope.h
include/clang/Sema/Sema.h
lib/AST/ItaniumMangle.cpp
lib/AST/StmtProfile.cpp
lib/Parse/ParseCXXInlineMethods.cpp
lib/Parse/ParseDecl.cpp
lib/Parse/ParseExprCXX.cpp
lib/Sema/Sema.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaExprMember.cpp
lib/Sema/SemaTemplateDeduction.cpp
lib/Sema/SemaTemplateInstantiate.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp
lib/Sema/TreeTransform.h
test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp [new file with mode: 0644]
test/CodeGenCXX/mangle-this-cxx11.cpp [new file with mode: 0644]
test/SemaCXX/warn-thread-safety-parsing.cpp