diff options
author | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
commit | 3176e97f130184ece0e1a21352c8124cc83ff24a (patch) | |
tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /include/clang/AST/Redeclarable.h | |
parent | 1e9b8d38881c3213d1e67b0c47ab9b2c00721a5c (diff) | |
download | FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.zip FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.tar.gz |
Vendor import of clang trunk r256633:
https://llvm.org/svn/llvm-project/cfe/trunk@256633
Diffstat (limited to 'include/clang/AST/Redeclarable.h')
-rw-r--r-- | include/clang/AST/Redeclarable.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/clang/AST/Redeclarable.h b/include/clang/AST/Redeclarable.h index 92046d5..eaa22f8 100644 --- a/include/clang/AST/Redeclarable.h +++ b/include/clang/AST/Redeclarable.h @@ -20,6 +20,7 @@ #include <iterator> namespace clang { +class ASTContext; /// \brief Provides common interface for the Decls that can be redeclared. template<typename decl_type> @@ -32,7 +33,11 @@ protected: &ExternalASTSource::CompleteRedeclChain> KnownLatest; - typedef const ASTContext *UninitializedLatest; + /// We store a pointer to the ASTContext in the UninitializedLatest + /// pointer, but to avoid circular type dependencies when we steal the low + /// bits of this pointer, we use a raw void* here. + typedef const void *UninitializedLatest; + typedef Decl *Previous; /// A pointer to either an uninitialized latest declaration (where either @@ -47,7 +52,7 @@ protected: enum LatestTag { LatestLink }; DeclLink(LatestTag, const ASTContext &Ctx) - : Next(NotKnownLatest(&Ctx)) {} + : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {} DeclLink(PreviousTag, decl_type *D) : Next(NotKnownLatest(Previous(D))) {} @@ -67,7 +72,8 @@ protected: return static_cast<decl_type*>(NKL.get<Previous>()); // Allocate the generational 'most recent' cache now, if needed. - Next = KnownLatest(*NKL.get<UninitializedLatest>(), + Next = KnownLatest(*reinterpret_cast<const ASTContext *>( + NKL.get<UninitializedLatest>()), const_cast<decl_type *>(D)); } @@ -83,7 +89,9 @@ protected: assert(NextIsLatest() && "decl became canonical unexpectedly"); if (Next.is<NotKnownLatest>()) { NotKnownLatest NKL = Next.get<NotKnownLatest>(); - Next = KnownLatest(*NKL.get<UninitializedLatest>(), D); + Next = KnownLatest(*reinterpret_cast<const ASTContext *>( + NKL.get<UninitializedLatest>()), + D); } else { auto Latest = Next.get<KnownLatest>(); Latest.set(D); |