[cfe-commits] r44089 - /cfe/trunk/AST/ASTContext.cpp
Ted Kremenek
kremenek at apple.com
Tue Nov 13 16:03:20 PST 2007
Author: kremenek
Date: Tue Nov 13 18:03:20 2007
New Revision: 44089
URL: http://llvm.org/viewvc/llvm-project?rev=44089&view=rev
Log:
Modified ASTContext::getTagDeclType() to accept a NULL pointer for the passed
in TagDecl*. This allows the deserializer to use ASTContext to create the
TagTypes. Deserialize TagTypes then rely on pointer-backpatching to resolve
the decls.
This may not be the interface that we want, but as the implementation of
TagTypes will potentially change significantly in the future, I'm leaving this
for now. An appropriate FIXME is in place.
Modified:
cfe/trunk/AST/ASTContext.cpp
Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=44089&r1=44088&r2=44089&view=diff
==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Tue Nov 13 18:03:20 2007
@@ -717,12 +717,19 @@
/// getTagDeclType - Return the unique reference to the type for the
/// specified TagDecl (struct/union/class/enum) decl.
QualType ASTContext::getTagDeclType(TagDecl *Decl) {
+ // FIXME: This method currently accepts "Decl" to be NULL for use
+ // by the deserializer. This interface may wished to be changed
+ // in the future.
+
// The decl stores the type cache.
- if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
+ if (Decl && Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
+
+ TagType* T = new TagType(Decl, QualType());
+ Types.push_back(T);
- Decl->TypeForDecl = new TagType(Decl, QualType());
- Types.push_back(Decl->TypeForDecl);
- return QualType(Decl->TypeForDecl, 0);
+ if (Decl) Decl->TypeForDecl = T;
+
+ return QualType(T, 0);
}
/// getSizeType - Return the unique type for "size_t" (C99 7.17), the result
More information about the cfe-commits
mailing list