summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-04-17 14:40:12 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-04-17 14:40:12 +0000
commitc3b69ae815298eeb29d849537ad229ba9bcf0f9c (patch)
treeea0f0f40e0c9174f8f0ad7d412e758bcab3eb364 /clang/lib/AST/ASTContext.cpp
parent3da1d68662e5f9796de1692ae69d6c5393842cf6 (diff)
downloadbcm5719-llvm-c3b69ae815298eeb29d849537ad229ba9bcf0f9c.tar.gz
bcm5719-llvm-c3b69ae815298eeb29d849537ad229ba9bcf0f9c.zip
Addition of TranslationUnitDecl to the AST:
-Added TranslationUnitDecl class to serve as top declaration context -ASTContext gets a TUDecl member and a getTranslationUnitDecl() function -All ScopedDecls get the TUDecl as DeclContext when declared at global scope llvm-svn: 49855
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index e4b48e21e44..7220ce4f9f0 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1175,7 +1175,7 @@ int ASTContext::getIntegerTypeOrder(QualType LHS, QualType RHS) {
QualType ASTContext::getCFConstantStringType() {
if (!CFConstantStringTypeDecl) {
CFConstantStringTypeDecl =
- RecordDecl::Create(*this, Decl::Struct, NULL, SourceLocation(),
+ RecordDecl::Create(*this, Decl::Struct, TUDecl, SourceLocation(),
&Idents.get("NSConstantString"), 0);
QualType FieldTypes[4];
@@ -1727,6 +1727,8 @@ void ASTContext::Emit(llvm::Serializer& S) const {
I!=E;++I)
(*I)->Emit(S);
+ S.EmitOwnedPtr(TUDecl);
+
// FIXME: S.EmitOwnedPtr(CFConstantStringTypeDecl);
}
@@ -1743,6 +1745,8 @@ ASTContext* ASTContext::Create(llvm::Deserializer& D) {
for (unsigned i = 0; i < size_reserve; ++i)
Type::Create(*A,i,D);
+ A->TUDecl = cast<TranslationUnitDecl>(D.ReadOwnedPtr<Decl>(*A));
+
// FIXME: A->CFConstantStringTypeDecl = D.ReadOwnedPtr<RecordDecl>();
return A;
OpenPOWER on IntegriCloud