]> granicus.if.org Git - clang/commit
Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for a
authorChris Lattner <sabre@nondot.org>
Sat, 28 Mar 2009 19:18:32 +0000 (19:18 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 28 Mar 2009 19:18:32 +0000 (19:18 +0000)
commitb28317a8e5e0e2953d1e5406d753d6c3c7f1e7d2
treede590dbcd3bf708b1f203f27df4eccef59f0235a
parent8054e25b5116e331a2ee4203f5fae2bee1c3cc46
Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for a
pointer.  Its purpose in life is to be a glorified void*, but which does not
implicitly convert to void* or other OpaquePtr's with a different UID.

Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>.  Change the
entire parser/sema interface to use DeclPtrTy instead of DeclTy*.  This
makes the C++ compiler enforce that these aren't convertible to other opaque
types.

We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc,
but I don't plan to do that in the short term.

The one outstanding known problem with this patch is that we lose the
bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to
bitmangle the success bit into the low bit of DeclPtrTy.  I will rectify
this with a subsequent patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67952 91177308-0d34-0410-b5e6-96231b3b80d8
32 files changed:
include/clang/Parse/Action.h
include/clang/Parse/DeclSpec.h
include/clang/Parse/Ownership.h
include/clang/Parse/Parser.h
include/clang/Parse/Scope.h
lib/Parse/DeclSpec.cpp
lib/Parse/MinimalAction.cpp
lib/Parse/ParseCXXInlineMethods.cpp
lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp
lib/Parse/ParseExprCXX.cpp
lib/Parse/ParseObjc.cpp
lib/Parse/ParseStmt.cpp
lib/Parse/ParseTemplate.cpp
lib/Parse/Parser.cpp
lib/Sema/IdentifierResolver.cpp
lib/Sema/ParseAST.cpp
lib/Sema/Sema.cpp
lib/Sema/Sema.h
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaDeclObjC.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaLookup.cpp
lib/Sema/SemaOverload.cpp
lib/Sema/SemaStmt.cpp
lib/Sema/SemaTemplate.cpp
lib/Sema/SemaTemplateInstantiate.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp
lib/Sema/SemaType.cpp
tools/clang-cc/PrintParserCallbacks.cpp