Change two static variables into instance variables of ASTContext. This allows us to have multiple copies

of ASTContext at the same time.

llvm-svn: 106258
This commit is contained in:
Ted Kremenek 2010-06-18 00:31:04 +00:00
parent 0883789ec4
commit 520f47b66f
2 changed files with 7 additions and 3 deletions

View File

@ -1345,6 +1345,11 @@ private:
// by DeclContext objects. This probably should not be in ASTContext, // by DeclContext objects. This probably should not be in ASTContext,
// but we include it here so that ASTContext can quickly deallocate them. // but we include it here so that ASTContext can quickly deallocate them.
llvm::PointerIntPair<StoredDeclsMap*,1> LastSDM; llvm::PointerIntPair<StoredDeclsMap*,1> LastSDM;
/// \brief A counter used to uniquely identify "blocks".
unsigned int UniqueBlockByRefTypeID;
unsigned int UniqueBlockParmTypeID;
friend class DeclContext; friend class DeclContext;
friend class DeclarationNameTable; friend class DeclarationNameTable;
void ReleaseDeclContextMaps(); void ReleaseDeclContextMaps();

View File

@ -142,7 +142,8 @@ ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM,
BuiltinInfo(builtins), BuiltinInfo(builtins),
DeclarationNames(*this), DeclarationNames(*this),
ExternalSource(0), PrintingPolicy(LOpts), ExternalSource(0), PrintingPolicy(LOpts),
LastSDM(0, 0) { LastSDM(0, 0),
UniqueBlockByRefTypeID(0), UniqueBlockParmTypeID(0) {
ObjCIdRedefinitionType = QualType(); ObjCIdRedefinitionType = QualType();
ObjCClassRedefinitionType = QualType(); ObjCClassRedefinitionType = QualType();
ObjCSelRedefinitionType = QualType(); ObjCSelRedefinitionType = QualType();
@ -3154,7 +3155,6 @@ QualType ASTContext::BuildByRefType(const char *DeclName, QualType Ty) {
bool HasCopyAndDispose = BlockRequiresCopying(Ty); bool HasCopyAndDispose = BlockRequiresCopying(Ty);
// FIXME: Move up // FIXME: Move up
static unsigned int UniqueBlockByRefTypeID = 0;
llvm::SmallString<36> Name; llvm::SmallString<36> Name;
llvm::raw_svector_ostream(Name) << "__Block_byref_" << llvm::raw_svector_ostream(Name) << "__Block_byref_" <<
++UniqueBlockByRefTypeID << '_' << DeclName; ++UniqueBlockByRefTypeID << '_' << DeclName;
@ -3206,7 +3206,6 @@ QualType ASTContext::getBlockParmType(
llvm::SmallVectorImpl<const Expr *> &Layout) { llvm::SmallVectorImpl<const Expr *> &Layout) {
// FIXME: Move up // FIXME: Move up
static unsigned int UniqueBlockParmTypeID = 0;
llvm::SmallString<36> Name; llvm::SmallString<36> Name;
llvm::raw_svector_ostream(Name) << "__block_literal_" llvm::raw_svector_ostream(Name) << "__block_literal_"
<< ++UniqueBlockParmTypeID; << ++UniqueBlockParmTypeID;