diff options
| author | Francois Pichet <pichet2000@gmail.com> | 2010-11-21 06:08:52 +0000 |
|---|---|---|
| committer | Francois Pichet <pichet2000@gmail.com> | 2010-11-21 06:08:52 +0000 |
| commit | 783dd6ece4d1cacbbe9c5790c5a0b6cf9a4b7c9c (patch) | |
| tree | 835aace2ba6a248986b02e383139a1f63bfb80fa /clang/lib/Serialization/ASTReaderDecl.cpp | |
| parent | e040a46eb354d1eb3d2102b416620e869a10883b (diff) | |
| download | bcm5719-llvm-783dd6ece4d1cacbbe9c5790c5a0b6cf9a4b7c9c.tar.gz bcm5719-llvm-783dd6ece4d1cacbbe9c5790c5a0b6cf9a4b7c9c.zip | |
Major anonymous union/struct redesign.
A new AST node is introduced:
def IndirectField : DDecl<Value>;
IndirectFields are injected into the anonymous's parent scope and chain back to
the original field. Name lookup for anonymous entities now result in an
IndirectFieldDecl instead of a FieldDecl.
There is no functionality change, the code generated should be the same.
llvm-svn: 119919
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
| -rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 9f5d0c11d19..b1e46a623e4 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -107,6 +107,7 @@ namespace clang { void VisitCXXDestructorDecl(CXXDestructorDecl *D); void VisitCXXConversionDecl(CXXConversionDecl *D); void VisitFieldDecl(FieldDecl *FD); + void VisitIndirectFieldDecl(IndirectFieldDecl *FD); void VisitVarDecl(VarDecl *VD); void VisitImplicitParamDecl(ImplicitParamDecl *PD); void VisitParmVarDecl(ParmVarDecl *PD); @@ -635,6 +636,17 @@ void ASTDeclReader::VisitFieldDecl(FieldDecl *FD) { } } +void ASTDeclReader::VisitIndirectFieldDecl(IndirectFieldDecl *FD) { + VisitValueDecl(FD); + + FD->ChainingSize = Record[Idx++]; + assert(FD->ChainingSize >= 2 && "Anonymous chaining must be >= 2"); + FD->Chaining = new (*Reader.getContext())NamedDecl*[FD->ChainingSize]; + + for (unsigned I = 0; I != FD->ChainingSize; ++I) + FD->Chaining[I] = cast<NamedDecl>(Reader.GetDecl(Record[Idx++])); +} + void ASTDeclReader::VisitVarDecl(VarDecl *VD) { VisitDeclaratorDecl(VD); VisitRedeclarable(VD); @@ -1475,6 +1487,10 @@ Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) { D = FieldDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0, 0, false); break; + case DECL_INDIRECTFIELD: + D = IndirectFieldDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), + 0, 0); + break; case DECL_VAR: D = VarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0, SC_None, SC_None); |

