aboutsummaryrefslogtreecommitdiff
path: root/lib/AST
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST')
-rw-r--r--lib/AST/ASTConsumer.cpp5
-rw-r--r--lib/AST/DeclGroup.cpp17
-rw-r--r--lib/AST/DeclSerialization.cpp2
-rw-r--r--lib/AST/StmtIterator.cpp9
4 files changed, 15 insertions, 18 deletions
diff --git a/lib/AST/ASTConsumer.cpp b/lib/AST/ASTConsumer.cpp
index 6c44d1ab7b..f37cbdea54 100644
--- a/lib/AST/ASTConsumer.cpp
+++ b/lib/AST/ASTConsumer.cpp
@@ -12,7 +12,8 @@
//===----------------------------------------------------------------------===//
#include "clang/AST/ASTConsumer.h"
-#include "clang/AST/Decl.h"
+#include "clang/AST/DeclGroup.h"
using namespace clang;
-ASTConsumer::~ASTConsumer() {}
+void ASTConsumer::HandleTopLevelDecl(DeclGroupRef D) {}
+
diff --git a/lib/AST/DeclGroup.cpp b/lib/AST/DeclGroup.cpp
index 36a7c2b400..64b0399901 100644
--- a/lib/AST/DeclGroup.cpp
+++ b/lib/AST/DeclGroup.cpp
@@ -19,13 +19,12 @@
#include "llvm/Bitcode/Deserialize.h"
using namespace clang;
-DeclGroup* DeclGroup::Create(ASTContext& C, unsigned numdecls, Decl** decls) {
- assert (numdecls > 0);
- unsigned size = sizeof(DeclGroup) + sizeof(Decl*) * numdecls;
- unsigned alignment = llvm::AlignOf<DeclGroup>::Alignment;
- void* mem = C.Allocate(size, alignment);
- new (mem) DeclGroup(numdecls, decls);
- return static_cast<DeclGroup*>(mem);
+DeclGroup* DeclGroup::Create(ASTContext &C, Decl **Decls, unsigned NumDecls) {
+ assert(NumDecls > 1 && "Invalid DeclGroup");
+ unsigned Size = sizeof(DeclGroup) + sizeof(Decl*) * NumDecls;
+ void* Mem = C.Allocate(Size, llvm::AlignOf<DeclGroup>::Alignment);
+ new (Mem) DeclGroup(NumDecls, Decls);
+ return static_cast<DeclGroup*>(Mem);
}
/// Emit - Serialize a DeclGroup to Bitcode.
@@ -37,9 +36,9 @@ void DeclGroup::Emit(llvm::Serializer& S) const {
/// Read - Deserialize a DeclGroup from Bitcode.
DeclGroup* DeclGroup::Read(llvm::Deserializer& D, ASTContext& C) {
unsigned NumDecls = (unsigned) D.ReadInt();
- unsigned size = sizeof(DeclGroup) + sizeof(Decl*) * NumDecls;
+ unsigned Size = sizeof(DeclGroup) + sizeof(Decl*) * NumDecls;
unsigned alignment = llvm::AlignOf<DeclGroup>::Alignment;
- DeclGroup* DG = (DeclGroup*) C.Allocate(size, alignment);
+ DeclGroup* DG = (DeclGroup*) C.Allocate(Size, alignment);
new (DG) DeclGroup();
DG->NumDecls = NumDecls;
D.BatchReadOwnedPtrs(NumDecls, &(*DG)[0], C);
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index 8e3ef08d2c..acaced2468 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -39,7 +39,6 @@ void Decl::Emit(Serializer& S) const {
S.EmitInt(Access);
S.EmitPtr(cast_or_null<Decl>(getDeclContext())); // From Decl.
S.EmitPtr(cast_or_null<Decl>(getLexicalDeclContext())); // From Decl.
- S.EmitPtr(NextDeclarator);
if (const DeclContext *DC = dyn_cast<const DeclContext>(this))
DC->EmitOutRec(S);
@@ -144,7 +143,6 @@ Decl* Decl::Create(Deserializer& D, ASTContext& C) {
D.ReadPtr(MDC->SemanticDC, SemaDCPtrID);
D.ReadPtr(MDC->LexicalDC, LexicalDCPtrID);
}
- D.ReadPtr(Dcl->NextDeclarator);
if (DeclContext *DC = dyn_cast<DeclContext>(Dcl))
DC->ReadOutRec(D, C);
bool OwnsNext = D.ReadBool();
diff --git a/lib/AST/StmtIterator.cpp b/lib/AST/StmtIterator.cpp
index 94829c01e3..20024f513f 100644
--- a/lib/AST/StmtIterator.cpp
+++ b/lib/AST/StmtIterator.cpp
@@ -67,12 +67,11 @@ void StmtIteratorBase::NextDecl(bool ImmediateAdvance) {
if (inDecl()) {
assert (decl);
+ // FIXME: SIMPLIFY AWAY.
if (ImmediateAdvance)
- decl = decl->getNextDeclarator();
-
- for ( ; decl ; decl = decl->getNextDeclarator())
- if (HandleDecl(decl))
- return;
+ decl = 0;
+ else if (HandleDecl(decl))
+ return;
}
else {
assert (inDeclGroup());