diff options
author | Douglas Gregor <dgregor@apple.com> | 2015-07-07 03:58:14 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2015-07-07 03:58:14 +0000 |
commit | 9bda6cff20276f67c02d0d2814ef44c2d62ecd89 (patch) | |
tree | 42cdccf290e6507ad745f4b0a838e76a6f8e32d0 /clang/lib/Sema/DeclSpec.cpp | |
parent | c5e07f5c115ed486f57db957447086c1b0023385 (diff) | |
download | bcm5719-llvm-9bda6cff20276f67c02d0d2814ef44c2d62ecd89.tar.gz bcm5719-llvm-9bda6cff20276f67c02d0d2814ef44c2d62ecd89.zip |
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.
llvm-svn: 241545
Diffstat (limited to 'clang/lib/Sema/DeclSpec.cpp')
-rw-r--r-- | clang/lib/Sema/DeclSpec.cpp | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index 5c75536e94a..ea3872f4270 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -893,7 +893,6 @@ bool DeclSpec::SetConstexprSpec(SourceLocation Loc, const char *&PrevSpec, return false; } - bool DeclSpec::SetConceptSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID) { if (Concept_specified) { @@ -906,30 +905,6 @@ bool DeclSpec::SetConceptSpec(SourceLocation Loc, const char *&PrevSpec, return false; } -void DeclSpec::setObjCTypeArgs(SourceLocation lAngleLoc, - ArrayRef<ParsedType> args, - SourceLocation rAngleLoc) { - ParsedType *argsCopy = new ParsedType[args.size()]; - memcpy(argsCopy, args.data(), args.size() * sizeof(ParsedType)); - ObjCTypeArgs = llvm::makeArrayRef(argsCopy, args.size()); - ObjCTypeArgsLAngleLoc = lAngleLoc; - ObjCTypeArgsRAngleLoc = rAngleLoc; -} - -void DeclSpec::setProtocolQualifiers(Decl * const *Protos, - unsigned NP, - SourceLocation *ProtoLocs, - SourceLocation LAngleLoc) { - if (NP == 0) return; - Decl **ProtoQuals = new Decl*[NP]; - memcpy(ProtoQuals, Protos, sizeof(Decl*)*NP); - ProtocolQualifiers = ProtoQuals; - ProtocolLocs = new SourceLocation[NP]; - memcpy(ProtocolLocs, ProtoLocs, sizeof(SourceLocation)*NP); - NumProtocolQualifiers = NP; - ProtocolLAngleLoc = LAngleLoc; -} - void DeclSpec::SaveWrittenBuiltinSpecs() { writtenBS.Sign = getTypeSpecSign(); writtenBS.Width = getTypeSpecWidth(); |