summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclSerialization.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-11-09 23:41:00 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-11-09 23:41:00 +0000
commit9e59b577d8221601419f734f14ff19c594c269d6 (patch)
tree1425c0ffa3234253224d48a6715d79b4ac7620dc /clang/lib/AST/DeclSerialization.cpp
parent4fb13c051d7a628ae024ba59073221e234b5d4e1 (diff)
downloadbcm5719-llvm-9e59b577d8221601419f734f14ff19c594c269d6.tar.gz
bcm5719-llvm-9e59b577d8221601419f734f14ff19c594c269d6.zip
Introduce ScopedDecl::getLexicalDeclContext() which is different from ScopedDecl::getDeclContext() when there are nested-names.
e.g.: namespace A { void f(); // SemanticDC (getDeclContext) == LexicalDC (getLexicalDeclContext) == 'namespace A' } void A::f(); // SemanticDC == namespace 'A' // LexicalDC == global namespace llvm-svn: 58948
Diffstat (limited to 'clang/lib/AST/DeclSerialization.cpp')
-rw-r--r--clang/lib/AST/DeclSerialization.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/clang/lib/AST/DeclSerialization.cpp b/clang/lib/AST/DeclSerialization.cpp
index 34066a5039d..04cb71983ba 100644
--- a/clang/lib/AST/DeclSerialization.cpp
+++ b/clang/lib/AST/DeclSerialization.cpp
@@ -145,15 +145,31 @@ void ScopedDecl::EmitInRec(Serializer& S) const {
NamedDecl::EmitInRec(S);
S.EmitPtr(getNext()); // From ScopedDecl.
S.EmitPtr(cast_or_null<Decl>(getDeclContext())); // From ScopedDecl.
+ S.EmitPtr(cast_or_null<Decl>(getLexicalDeclContext())); // From ScopedDecl.
}
void ScopedDecl::ReadInRec(Deserializer& D, ASTContext& C) {
NamedDecl::ReadInRec(D, C);
D.ReadPtr(Next); // From ScopedDecl.
-
- assert(DeclCtx == 0); // Allow back-patching. Observe that we register
- D.ReadPtr(DeclCtx); // the variable of the *object* for back-patching.
- // Its actual value will get filled in later.
+
+ assert(DeclCtx == 0);
+
+ const SerializedPtrID &SemaDCPtrID = D.ReadPtrID();
+ const SerializedPtrID &LexicalDCPtrID = D.ReadPtrID();
+
+ if (SemaDCPtrID == LexicalDCPtrID) {
+ // Allow back-patching. Observe that we register the variable of the
+ // *object* for back-patching. Its actual value will get filled in later.
+ D.ReadUIntPtr(DeclCtx, SemaDCPtrID);
+ }
+ else {
+ MultipleDC *MDC = new MultipleDC();
+ DeclCtx = reinterpret_cast<uintptr_t>(MDC) | 0x1;
+ // Allow back-patching. Observe that we register the variable of the
+ // *object* for back-patching. Its actual value will get filled in later.
+ D.ReadUIntPtr(reinterpret_cast<uintptr_t&>(MDC->SemanticDC), SemaDCPtrID);
+ D.ReadUIntPtr(reinterpret_cast<uintptr_t&>(MDC->LexicalDC), LexicalDCPtrID);
+ }
}
//===------------------------------------------------------------===//
OpenPOWER on IntegriCloud