]> granicus.if.org Git - clang/commit
C++ support for Objective-C lightweight generics.
authorDouglas Gregor <dgregor@apple.com>
Tue, 7 Jul 2015 03:58:14 +0000 (03:58 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 7 Jul 2015 03:58:14 +0000 (03:58 +0000)
commitf09aad86528a168b8253ab8e0f456b0d8010ee6e
tree26c189a4d1aec785750a839368a4bb69160bf4d8
parentc575231ea9dfccafa44d5c49ea05063fb3efb7fc
C++ support for Objective-C lightweight generics.

Teach C++'s tentative parsing to handle specializations of Objective-C
class types (e.g., NSArray<NSString *>) as well as Objective-C
protocol qualifiers (id<NSCopying>) by extending type-annotation
tokens to handle this case. As part of this, remove Objective-C
protocol qualifiers from the declaration specifiers, which never
really made sense: instead, provide Sema entry points to make them
part of the type annotation token. Among other things, this properly
diagnoses bogus types such as "<NSCopying> id" which should have been
written as "id <NSCopying>".

Implements template instantiation support for, e.g., NSArray<T>*
in C++. Note that parameterized classes are not templates in the C++
sense, so that cannot (for example) be used as a template argument for
a template template parameter. Part of rdar://problem/6294649.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241545 91177308-0d34-0410-b5e6-96231b3b80d8
26 files changed:
include/clang/AST/Type.h
include/clang/AST/TypeLoc.h
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Parse/Parser.h
include/clang/Sema/DeclSpec.h
include/clang/Sema/Sema.h
lib/AST/Type.cpp
lib/AST/TypeLoc.cpp
lib/Lex/PPMacroExpansion.cpp
lib/Parse/ParseDecl.cpp
lib/Parse/ParseExprCXX.cpp
lib/Parse/ParseInit.cpp
lib/Parse/ParseObjc.cpp
lib/Parse/Parser.cpp
lib/Sema/DeclSpec.cpp
lib/Sema/SemaDeclObjC.cpp
lib/Sema/SemaType.cpp
lib/Sema/TreeTransform.h
test/Index/annotate-parameterized-classes.m
test/Index/annotate-tokens.m
test/Parser/placeholder-recovery.m
test/SemaObjC/parameterized_classes.m
test/SemaObjC/protocol-archane.m
test/SemaObjCXX/parameterized_classes_subst.mm [new file with mode: 0644]
tools/libclang/CIndex.cpp
tools/libclang/CursorVisitor.h