diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-06-17 23:16:24 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-06-17 23:16:24 +0000 |
commit | 4020caec546d221170072d2388b57d151cb26111 (patch) | |
tree | 44f10839a53c7c9b89294536172b84e71ba5927f /lib/Sema/TypeLocBuilder.h | |
parent | c22d699d3aa1d7fbd32c4e35cf75abdca94bb5ef (diff) |
Objective-C++ ARC: eliminate the utterly unjustified loophole that
silently dropped ownership qualifiers that were being applied to
ownership-qualified, substituted type that was *not* a substituted
template type parameter. We now provide a diagnostic in such cases,
and recover by dropping the added qualifiers.
Document this behavior in the ARC specification.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133309 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/TypeLocBuilder.h')
-rw-r--r-- | lib/Sema/TypeLocBuilder.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Sema/TypeLocBuilder.h b/lib/Sema/TypeLocBuilder.h index 792bd1fc72..f7889e9c64 100644 --- a/lib/Sema/TypeLocBuilder.h +++ b/lib/Sema/TypeLocBuilder.h @@ -147,7 +147,7 @@ private: Index -= LocalSize; - return getTypeLoc(T); + return getTemporaryTypeLoc(T); } /// Grow to the given capacity. @@ -179,15 +179,17 @@ private: reserve(Size); Index -= Size; - return getTypeLoc(T); + return getTemporaryTypeLoc(T); } - - // This is private because, when we kill off TypeSourceInfo in favor - // of TypeLoc, we'll want an interface that creates a TypeLoc given - // an ASTContext, and we don't want people to think they can just - // use this as an equivalent. - TypeLoc getTypeLoc(QualType T) { +public: + /// \brief Retrieve a temporary TypeLoc that refers into this \c TypeLocBuilder + /// object. + /// + /// The resulting \c TypeLoc should only be used so long as the + /// \c TypeLocBuilder is active and has not had more type information + /// pushed into it. + TypeLoc getTemporaryTypeLoc(QualType T) { #ifndef NDEBUG assert(LastTy == T && "type doesn't match last type pushed!"); #endif |